Skip to content
This repository has been archived by the owner on Mar 19, 2024. It is now read-only.

Update testing matrix + pre-release version #2399

Update testing matrix + pre-release version

Update testing matrix + pre-release version #2399

Workflow file for this run

name: ci
on:
push:
branches: ["main"]
pull_request:
branches: ["main", "release/**"]
env:
GO_VERSION: '1.19'
CONSUL_LICENSE: ${{ secrets.CONSUL_LICENSE }}
jobs:
lint:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: ./.github/actions/goenv
with:
go-version: ${{ env.GO_VERSION }}
- name: golangci-lint
uses: golangci/golangci-lint-action@08e2f20817b15149a52b5b3ebe7de50aff2ba8c5 # v3.4.0
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: v1.53.3
# Optional: golangci-lint command line arguments.
args: |
--verbose
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: false
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
skip-pkg-cache: true
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
skip-build-cache: true
test:
name: unit test (consul-version=${{ matrix.consul-version }})
strategy:
matrix:
consul-version:
- 1.14.8
- 1.14.8+ent
- 1.15.4
- 1.15.4+ent
- 1.16.0
- 1.16.0+ent
runs-on: ubuntu-latest
env:
TEST_RESULTS_DIR: /tmp/test-results/consul@${{ matrix.consul-version }}
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: ./.github/actions/goenv
with:
go-version: ${{ env.GO_VERSION }}
- 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: Clean Generate
run: |
echo "Checking that code generation is up-to-date"
make gen
git diff --quiet || (echo 'Working tree is dirty' && git --no-pager diff && exit 1)
- name: Test
run: |
mkdir -p $TEST_RESULTS_DIR/json
PACKAGE_NAMES=$(go list ./... | grep -v 'mocks' | grep -v 'testing' | tr '\n' ' ')
echo "Testing $(echo $PACKAGE_NAMES | wc -w) packages"
echo $PACKAGE_NAMES
gotestsum \
--format=short-verbose \
--jsonfile $TEST_RESULTS_DIR/json/go-test-race.log \
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
-race $PACKAGE_NAMES
- uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: test-results
path: ${{ env.TEST_RESULTS_DIR }}
e2e:
name: e2e tests (consul-image=${{ matrix.consul-image }})
strategy:
fail-fast: false
matrix:
consul-image:
- 'hashicorp/consul:1.14.8'
- 'hashicorp/consul-enterprise:1.14.8-ent'
- 'hashicorp/consul:1.15.4'
- 'hashicorp/consul-enterprise:1.15.4-ent'
- 'hashicorp/consul:1.16.0'
- 'hashicorp/consul-enterprise:1.16.0-ent'
runs-on: ubuntu-latest
env:
TEST_RESULTS_DIR: /tmp/test-results/e2e@${{ matrix.consul-image }}
steps:
- name: Checkout
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- name: Install Dependencies
run: |
curl -L https://kind.sigs.k8s.io/dl/v0.16.0/kind-linux-amd64 -o ./kind
chmod +x ./kind
mv ./kind /usr/local/bin/kind
curl -L https://dl.k8s.io/release/v1.22.0/bin/linux/amd64/kubectl -o ./kubectl
chmod +x ./kubectl
mv ./kubectl /usr/local/bin/kubectl
curl -L https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize%2Fv4.4.0/kustomize_v4.4.0_linux_amd64.tar.gz -o kustomize_v4.4.0_linux_amd64.tar.gz
tar xvzf kustomize_v4.4.0_linux_amd64.tar.gz
mv kustomize /usr/local/bin/kustomize
rm kustomize_v4.4.0_linux_amd64.tar.gz
docker version
- uses: ./.github/actions/goenv
with:
go-version: ${{ env.GO_VERSION }}
- name: Test
env:
DOCKER_HOST_ROUTE: 172.17.0.1
DOCKER_API_VERSION: 1.41
E2E_APIGW_CONSUL_IMAGE: ${{ matrix.consul-image }}
run: |
mkdir -p $TEST_RESULTS_DIR/json
gotestsum \
--format=short-verbose \
--jsonfile $TEST_RESULTS_DIR/json/go-test-race.log \
--junitfile $TEST_RESULTS_DIR/gotestsum-report.xml -- \
-tags e2e ./internal/commands/server --failfast