Skip to content

Fix changelog dates (#231) #590

Fix changelog dates (#231)

Fix changelog dates (#231) #590

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@v2
- 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@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
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.13.7
- 1.13.7+ent
- 1.14.5
- 1.14.5+ent
- 1.15.1
- 1.15.1+ent
env:
TEST_RESULTS_DIR: /tmp/test-results
GOTESTSUM_VERSION: 1.8.2
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- uses: actions/setup-go@v3
with:
go-version: ${{ needs.get-go-version.outputs.go-version }}
- uses: actions/cache@v3
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@v3
with:
name: test-results
path: ${{ env.TEST_RESULTS_DIR }}/${{ matrix.consul-version }}