2023-03-28 21:29:27 +00:00
|
|
|
name: go-tests
|
|
|
|
|
|
|
|
on:
|
|
|
|
pull_request:
|
|
|
|
branches-ignore:
|
|
|
|
- stable-website
|
|
|
|
- 'docs/**'
|
|
|
|
- 'ui/**'
|
|
|
|
- 'mktg-**' # Digital Team Terraform-generated branches' prefix
|
|
|
|
- 'backport/docs/**'
|
|
|
|
- 'backport/ui/**'
|
|
|
|
- 'backport/mktg-**'
|
|
|
|
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
|
|
|
env:
|
|
|
|
TEST_RESULTS: /tmp/test-results
|
|
|
|
GOTESTSUM_VERSION: 1.8.2
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
setup:
|
|
|
|
name: Setup
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
compute-small: ${{ steps.setup-outputs.outputs.compute-small }}
|
|
|
|
compute-medium: ${{ steps.setup-outputs.outputs.compute-medium }}
|
|
|
|
compute-large: ${{ steps.setup-outputs.outputs.compute-large }}
|
|
|
|
compute-xl: ${{ steps.setup-outputs.outputs.compute-xl }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
|
|
|
- id: setup-outputs
|
|
|
|
name: Setup outputs
|
|
|
|
run: ./.github/scripts/get_runner_classes.sh
|
|
|
|
|
|
|
|
check-go-mod:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
uses: ./.github/workflows/reusable-check-go-mod.yml
|
|
|
|
with:
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-small }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
check-generated-protobuf:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2023-03-28 21:29:27 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- run: make proto-tools
|
|
|
|
name: Install protobuf
|
|
|
|
- run: make proto-format
|
|
|
|
name: "Protobuf Format"
|
|
|
|
- run: make --always-make proto
|
|
|
|
- run: |
|
|
|
|
if ! git diff --exit-code; then
|
|
|
|
echo "Generated code was not updated correctly"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
- run: make proto-lint
|
|
|
|
name: "Protobuf Lint"
|
|
|
|
- name: Notify Slack
|
2023-03-30 16:57:11 +00:00
|
|
|
if: ${{ failure() }}
|
2023-03-28 21:29:27 +00:00
|
|
|
run: .github/scripts/notify_slack.sh
|
|
|
|
check-generated-deep-copy:
|
|
|
|
needs:
|
|
|
|
- setup
|
2023-04-04 15:15:45 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
|
2023-03-28 21:29:27 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2023-03-28 21:29:27 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- run: make --always-make deep-copy
|
|
|
|
- run: |
|
|
|
|
if ! git diff --exit-code; then
|
|
|
|
echo "Generated code was not updated correctly"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
- name: Notify Slack
|
2023-03-30 16:57:11 +00:00
|
|
|
if: ${{ failure() }}
|
|
|
|
run: .github/scripts/notify_slack.sh
|
|
|
|
|
2023-03-28 21:29:27 +00:00
|
|
|
lint-enums:
|
|
|
|
needs:
|
|
|
|
- setup
|
2023-04-04 15:15:45 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-large) }}
|
2023-03-28 21:29:27 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2023-03-28 21:29:27 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- run: go install github.com/reillywatson/enumcover/cmd/enumcover@master && enumcover ./...
|
|
|
|
- name: Notify Slack
|
2023-03-30 16:57:11 +00:00
|
|
|
if: ${{ failure() }}
|
2023-03-28 21:29:27 +00:00
|
|
|
run: .github/scripts/notify_slack.sh
|
|
|
|
|
|
|
|
lint-container-test-deps:
|
2023-03-30 16:57:11 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2023-03-28 21:29:27 +00:00
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2023-03-28 21:29:27 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
2023-03-30 16:57:11 +00:00
|
|
|
- run: make lint-container-test-deps
|
2023-03-28 21:29:27 +00:00
|
|
|
- name: Notify Slack
|
2023-03-30 16:57:11 +00:00
|
|
|
if: ${{ failure() }}
|
2023-03-28 21:29:27 +00:00
|
|
|
run: .github/scripts/notify_slack.sh
|
|
|
|
|
|
|
|
lint-consul-retry:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
runs-on: ${{ fromJSON(needs.setup.outputs.compute-small) }}
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # pin@v3.3.0
|
2023-03-30 16:57:11 +00:00
|
|
|
# NOTE: This step is specifically needed for ENT. It allows us to access the required private HashiCorp repos.
|
|
|
|
- name: Setup Git
|
|
|
|
if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
run: git config --global url."https://${{ secrets.ELEVATED_GITHUB_TOKEN }}:@github.com".insteadOf "https://github.com"
|
2023-03-28 21:29:27 +00:00
|
|
|
- uses: actions/setup-go@6edd4406fa81c3da01a34fa6f6343087c207a568 # pin@v3.5.0
|
|
|
|
with:
|
|
|
|
go-version-file: 'go.mod'
|
|
|
|
- run: go install github.com/hashicorp/lint-consul-retry@master && lint-consul-retry
|
|
|
|
- name: Notify Slack
|
2023-03-30 16:57:11 +00:00
|
|
|
if: ${{ failure() }}
|
2023-03-28 21:29:27 +00:00
|
|
|
run: .github/scripts/notify_slack.sh
|
|
|
|
|
|
|
|
lint:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
uses: ./.github/workflows/reusable-lint.yml
|
|
|
|
with:
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
lint-32bit:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
uses: ./.github/workflows/reusable-lint.yml
|
|
|
|
with:
|
|
|
|
go-arch: "386"
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
# create a development build
|
|
|
|
dev-build:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
uses: ./.github/workflows/reusable-dev-build.yml
|
|
|
|
with:
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
|
2023-04-05 23:10:31 +00:00
|
|
|
# dev-build-arm64:
|
|
|
|
# # only run on enterprise because GHA does not have arm64 runners in OSS
|
|
|
|
# if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
# needs:
|
|
|
|
# - setup
|
|
|
|
# uses: ./.github/workflows/reusable-dev-build.yml
|
|
|
|
# with:
|
|
|
|
# uploaded-binary-name: 'consul-bin-arm64'
|
|
|
|
# runs-on: ${{ needs.setup.outputs.compute-xl }}
|
|
|
|
# go-arch: "arm64"
|
|
|
|
# repository-name: ${{ github.repository }}
|
|
|
|
# secrets:
|
|
|
|
# elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-04-05 23:10:31 +00:00
|
|
|
# go-test-arm64:
|
|
|
|
# # only run on enterprise because GHA does not have arm64 runners in OSS
|
|
|
|
# if: ${{ endsWith(github.repository, '-enterprise') }}
|
|
|
|
# needs:
|
|
|
|
# - setup
|
|
|
|
# - dev-build-arm64
|
|
|
|
# uses: ./.github/workflows/reusable-unit-split.yml
|
|
|
|
# with:
|
|
|
|
# directory: .
|
|
|
|
# uploaded-binary-name: 'consul-bin-arm64'
|
|
|
|
# runner-count: 12
|
|
|
|
# runs-on: "['self-hosted', 'ondemand', 'os=macos-arm', 'arm64']"
|
|
|
|
# go-test-flags: 'if ! [[ "$GITHUB_REF_NAME" =~ ^main$|^release/ ]]; then export GO_TEST_FLAGS="-short"; fi'
|
|
|
|
# repository-name: ${{ github.repository }}
|
|
|
|
# secrets:
|
|
|
|
# elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
# consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
2023-04-05 22:49:48 +00:00
|
|
|
go-test-oss:
|
2023-03-28 21:29:27 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit-split.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
|
|
|
runner-count: 12
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: ""
|
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
|
|
|
|
|
|
|
go-test-enterprise:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit-split.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
|
|
|
runner-count: 12
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
|
|
|
repository-name: ${{ github.repository }}
|
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-race:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
|
|
|
go-test-flags: 'GO_TEST_FLAGS="-race -gcflags=all=-d=checkptr=0"'
|
2023-03-31 03:39:34 +00:00
|
|
|
package-names-command: "go list ./... | grep -E -v '^github.com/hashicorp/consul/agent(/consul|/local|/routine-leak-checker)?$' | grep -E -v '^github.com/hashicorp/consul(/command|/connect|/snapshot)'"
|
2023-03-28 21:29:27 +00:00
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-32bit:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: .
|
|
|
|
go-arch: "386"
|
|
|
|
go-test-flags: 'export GO_TEST_FLAGS="-short"'
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-envoyextensions:
|
2023-03-30 16:57:11 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: envoyextensions
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-troubleshoot:
|
2023-03-30 16:57:11 +00:00
|
|
|
needs:
|
|
|
|
- setup
|
2023-03-28 21:29:27 +00:00
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: troubleshoot
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-api-1-19:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: api
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-api-1-20:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: api
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-sdk-1-19:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: sdk
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
go-test-sdk-1-20:
|
|
|
|
needs:
|
|
|
|
- setup
|
|
|
|
- dev-build
|
|
|
|
uses: ./.github/workflows/reusable-unit.yml
|
|
|
|
with:
|
|
|
|
directory: sdk
|
|
|
|
runs-on: ${{ needs.setup.outputs.compute-xl }}
|
2023-03-30 16:57:11 +00:00
|
|
|
repository-name: ${{ github.repository }}
|
2023-04-05 22:49:48 +00:00
|
|
|
go-tags: "${{ github.event.repository.name == 'consul-enterprise' && 'consulent consulprem consuldev' || '' }}"
|
2023-03-30 16:57:11 +00:00
|
|
|
secrets:
|
|
|
|
elevated-github-token: ${{ secrets.ELEVATED_GITHUB_TOKEN }}
|
|
|
|
consul-license: ${{secrets.CONSUL_LICENSE}}
|
2023-03-28 21:29:27 +00:00
|
|
|
|
|
|
|
noop:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- run: "echo ok"
|