Skip to content

Bring back dev version for 0.8.x #607

Bring back dev version for 0.8.x

Bring back dev version for 0.8.x #607

Workflow file for this run

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@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- 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 "go-version=$(cat .go-version)" >> $GITHUB_OUTPUT
lint:
needs:
- get-go-version
runs-on: ubuntu-latest
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 }}
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.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.18.0
- 1.18.0+ent
env:
TEST_RESULTS_DIR: /tmp/test-results
GOTESTSUM_VERSION: 1.8.2
runs-on: ubuntu-latest
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 }}
- uses: actions/cache@88522ab9f39a2ea568f7027eddc7d8d8bc9d59c8 # v3.3.1
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@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: test-results
path: ${{ env.TEST_RESULTS_DIR }}/${{ matrix.consul-version }}