Skip to content

fmt tf

fmt tf #518

Workflow file for this run

name: bin-ci
on:
push:
branches: '**'
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
get-go-version:
needs: action-lint
uses: ./.github/workflows/reusable-get-go-version.yml
lint:
defaults:
run:
# run lint inside ./consul-lambda
working-directory: ./consul-lambda
runs-on: ubuntu-latest
needs:
- 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: ./consul-lambda/go.sum
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
version: v1.51
args: "--verbose --enable gofmt"
only-new-issues: false
skip-pkg-cache: true
skip-build-cache: true
# run lint inside ./consul-lambda
working-directory: ./consul-lambda
test:
name: unit test (consul-version=${{ matrix.consul-version }}) - platform=${{ matrix.platform.goos }}_${{ matrix.platform.goarch }}
strategy:
matrix:
consul-version:
- 1.15.2
- 1.15.2+ent
platform:
- { goos: "linux", goarch: "amd64"}
- { goos: "linux", goarch: "arm64"}
needs:
- get-go-version
defaults:
run:
# run all tests inside ./consul-lambda
working-directory: ./consul-lambda
env:
TEST_RESULTS_DIR: /tmp/test-results
GOTESTSUM_VERSION: 1.8.0
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 }}
cache-dependency-path: ./consul-lambda/go.sum
- name: Install emulation
if: matrix.platform.goarch == 'arm64'
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
with:
platforms: arm64
- name: Install Consul
shell: bash
run: |
CONSUL_VERSION="${{ matrix.consul-version }}"
PLATFORM="${{ matrix.platform.goos }}_${{ matrix.platform.goarch }}"
FILENAME="consul_${CONSUL_VERSION}_${PLATFORM}.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: |
PLATFORM="${{ matrix.platform.goos }}_${{ matrix.platform.goarch }}"
url=https://github.com/gotestyourself/gotestsum/releases/download
curl -sSL "${url}/v${{ env.GOTESTSUM_VERSION }}/gotestsum_${{ env.GOTESTSUM_VERSION }}_${PLATFORM}.tar.gz" | \
tar -xz --overwrite -C /usr/local/bin gotestsum
- name: Test
env:
CGO_ENABLED: 1
run: |
mkdir -p "$TEST_RESULTS_DIR/${{ matrix.consul-version }}/json"
read -r -a PACKAGE_NAMES <<<"$(go list ./... | grep -v 'mocks' | grep -v 'testing' | tr '\n' ' ')"
echo "Testing $(echo "${PACKAGE_NAMES[@]}" | wc -w) packages"
if echo "${{ matrix.consul-version }}" | grep -q '.*\+ent'; then
FLAG=-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" -- \
-race "${PACKAGE_NAMES[@]}" \
-- "$FLAG"
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: test-results
path: ${{ env.TEST_RESULTS_DIR }}/${{ matrix.consul-version }}