Skip to content

NET-7753 - Support for arm64 builds #464

NET-7753 - Support for arm64 builds

NET-7753 - Support for arm64 builds #464

Workflow file for this run

name: terraform-ci
on:
push:
branches:
- 'main'
- 'release/**'
pull_request:
branches:
- 'main'
- 'release/**'
env:
CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }}
jobs:
action-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Lint workflow
uses: docker://docker.mirror.hashicorp.services/rhysd/actionlint:latest
terraform-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Setup Terraform
uses: hashicorp/setup-terraform@633666f66e0061ca3b725c73b2ec20cd13a8fdd1 # v2.0.3
with:
terraform_version: v1.3.1
- name: Validate
run: terraform fmt -check -recursive .
get-go-version:
uses: ./.github/workflows/reusable-get-go-version.yml
go-test-lint:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./test/acceptance
needs:
- get-go-version
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Setup go
uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
cache-dependency-path: ./test/acceptance/go.sum
- name: lint-consul-retry
run: |
go install github.com/hashicorp/lint-consul-retry@latest
lint-consul-retry
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
version: v1.51
args: "--verbose --enable gofmt --timeout 2m"
only-new-issues: false
skip-pkg-cache: true
skip-build-cache: true
working-directory: ./test/acceptance
acceptance:
strategy:
matrix:
platform:
- {goos: "linux", goarch: "amd64"}
- {goos: "linux", goarch: "arm64"}
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./test/acceptance
env:
TEST_RESULTS: /tmp/test-results
GOTESTSUM_VERSION: 1.8.0
OS: ${{ matrix.platform.goos }}
ARCH: ${{ matrix.platform.goarch }}
SESSION_MANAGER: ubuntu_64bit
needs:
- action-lint
- go-test-lint
- terraform-lint
- get-go-version
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-go@4d34df0c2316fe8122ab82dc22947d607c0c91f9 # v4.0.0
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
cache-dependency-path: ./test/acceptance/go.sum
- name: Install emulation
if: matrix.platform.goarch == 'arm64'
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: arm64
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@2a1a44ac4aa01993040736bd95bb470da1a38365 # v2.9.0
- name: Setup gotestsum
shell: bash
run: |
url=https://github.com/gotestyourself/gotestsum/releases/download
curl -sSL "${url}/v${{ env.GOTESTSUM_VERSION }}/gotestsum_${{ env.GOTESTSUM_VERSION }}_linux_amd64.tar.gz" | \
tar -xz --overwrite -C /usr/local/bin gotestsum
- name: Install dependencies
run: |
sudo apt-get install -y expect
curl "https://s3.amazonaws.com/session-manager-downloads/plugin/latest/${{ env.SESSION_MANAGER }}/session-manager-plugin.deb" -o "session-manager-plugin.deb"
sudo dpkg -i session-manager-plugin.deb
- name: Configure AWS
# Environment variables for IAM roles are unsupported: https://github.com/aws/aws-cli/issues/5639
run: |
aws configure --profile lambda_user set aws_access_key_id "${{ secrets.AWS_ACCESS_KEY_ID }}"
aws configure --profile lambda_user set aws_secret_access_key "${{ secrets.AWS_SECRET_ACCESS_KEY }}"
aws configure set role_arn "${{ secrets.AWS_ROLE_ARN }}"
aws configure set region us-west-2
aws configure set source_profile lambda_user
- name: terraform init & apply
run: |
cd setup-terraform
terraform init
terraform apply -var arch="${{matrix.platform.goarch}}" -auto-approve
- name: Run acceptance tests
run: |
mkdir -p "$TEST_RESULTS"
gotestsum \
--packages "./..." \
--junitfile "$TEST_RESULTS/gotestsum-report.xml" \
--format standard-verbose -- \
./... -p 1 -timeout 90m -v -failfast
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
if: always()
with:
name: acceptance-test-results
path: ${{ env.TEST_RESULTS }}/gotestsum-report.xml
- name: terraform destroy
if: always()
run: |
cd setup-terraform
terraform destroy -auto-approve