Updating GitHub action versions to the latest TSCCR approved version. #617
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: bin-ci | |
on: | |
push: | |
branches: '**' | |
env: | |
CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }} | |
jobs: | |
get-go-version: | |
name: "Determine Go toolchain version" | |
runs-on: ubuntu-latest | |
outputs: | |
go-version: ${{ steps.get-go-version.outputs.go-version }} | |
steps: | |
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- name: Determine Go version | |
id: get-go-version | |
# We use .go-version as our source of truth for current Go | |
# version, because "goenv" can react to it automatically. | |
run: | | |
echo "Building with Go $(cat .go-version)" | |
echo "::set-output name=go-version::$(cat .go-version)" | |
lint: | |
needs: | |
- get-go-version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ needs.get-go-version.outputs.go-version }} | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@38e1018663fa5173f3968ea0777460d3de38f256 # v5.3.0 | |
with: | |
version: v1.54.2 | |
args: | | |
--verbose | |
only-new-issues: false | |
skip-pkg-cache: true | |
skip-build-cache: true | |
- name: lint-consul-retry | |
shell: bash | |
run: | | |
go install github.com/hashicorp/lint-consul-retry@master && lint-consul-retry | |
test: | |
needs: | |
- get-go-version | |
name: unit test (consul-version=${{ matrix.consul-version }}) | |
strategy: | |
matrix: | |
consul-version: | |
- 1.17.2 | |
- 1.17.2+ent | |
env: | |
TEST_RESULTS_DIR: /tmp/test-results | |
GOTESTSUM_VERSION: 1.8.2 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4 | |
- uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1 | |
with: | |
go-version: ${{ needs.get-go-version.outputs.go-version }} | |
- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 | |
with: | |
path: | | |
~/.cache/go-build | |
~/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install Consul | |
shell: bash | |
run: | | |
CONSUL_VERSION="${{ matrix.consul-version }}" | |
FILENAME="consul_${CONSUL_VERSION}_linux_amd64.zip" | |
curl -sSLO "https://releases.hashicorp.com/consul/${CONSUL_VERSION}/${FILENAME}" && \ | |
unzip "${FILENAME}" -d /usr/local/bin && \ | |
rm "${FILENAME}" | |
consul version | |
- name: Build | |
run: go build -v ./... | |
- 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: Test | |
run: | | |
mkdir -p $TEST_RESULTS_DIR/${{ matrix.consul-version }}/json | |
PACKAGE_NAMES=$(go list ./... | grep -v 'mocks\|hack\|testing' | tr '\n' ' ') | |
echo "Testing $(echo $PACKAGE_NAMES | wc -w) packages" | |
if [[ "${{ matrix.consul-version }}" == *ent ]]; then | |
FLAGS=-enterprise | |
TAGS=-tags=enterprise | |
fi | |
gotestsum \ | |
--format=short-verbose \ | |
--jsonfile $TEST_RESULTS_DIR/${{ matrix.consul-version }}/json/go-test-race.log \ | |
--junitfile $TEST_RESULTS_DIR/${{ matrix.consul-version }}/gotestsum-report.xml \ | |
-- $PACKAGE_NAMES $TAGS -- $FLAGS | |
- uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3 | |
with: | |
name: test-results | |
path: ${{ env.TEST_RESULTS_DIR }}/${{ matrix.consul-version }} |