Refactor #135
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: Build and Test Pull Request | |
# Trigger the workflow on push or pull request | |
on: | |
push: | |
branches-ignore: | |
- "dependabot/**" | |
pull_request: | |
types: [opened, synchronize] | |
permissions: | |
contents: read | |
env: | |
GOPROXY: https://proxy.golang.org/ | |
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} | |
GO_VERSION: 1.21.6 | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@3cfe3a4abbb849e10058ce4af15d205b6da42804 # v4.0.0 | |
with: | |
version: v1.55.2 | |
# TODO: re-enable linting tools package once https://github.com/projectcontour/contour/issues/5077 | |
# is resolved | |
args: --build-tags=e2e,conformance,gcp,oidc,none --out-format=colored-line-number | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
codespell: | |
name: Codespell | |
runs-on: ubuntu-latest | |
timeout-minutes: 5 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- name: Codespell | |
uses: codespell-project/actions-codespell@94259cd8be02ad2903ba34a22d9c13de21a74461 # v2.0 | |
with: | |
skip: .git,*.png,*.woff,*.woff2,*.eot,*.ttf,*.jpg,*.ico,*.svg,./site/themes/contour/static/fonts/README.md,./vendor,./site/public,./hack/actions/check-changefile-exists.go,go.mod,go.sum | |
ignore_words_file: './.codespell.ignorewords' | |
check_filenames: true | |
check_hidden: true | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
codegen: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: generate | |
run: | | |
make generate lint-yamllint lint-flags | |
./hack/actions/check-uncommitted-codegen.sh | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
build-image: | |
needs: | |
- lint | |
- codespell | |
- codegen | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 | |
with: | |
version: latest | |
- name: Build image | |
env: | |
TAG_LATEST: "false" | |
run: | | |
make multiarch-build | |
- name: Upload image | |
uses: actions/upload-artifact@5d5d22a31266ced268874388b861e4b58bb5c2f3 # v4.3.1 | |
with: | |
name: image | |
path: image/contour-*.tar | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
e2e: | |
runs-on: ubuntu-latest | |
needs: [build-image] | |
strategy: | |
matrix: | |
# use stable kubernetes_version values since they're included | |
# in the name of the GitHub Actions job, and we don't want to | |
# have to update branch protection rules every time we change | |
# a Kubernetes version number. | |
kubernetes_version: ["kubernetes:latest", "kubernetes:n-1", "kubernetes:n-2"] | |
# run tests using the configuration crd as well as without | |
config_type: ["ConfigmapConfiguration", "ContourConfiguration"] | |
# include defines an additional variable (the specific node | |
# image to use) for each kubernetes_version value. | |
include: | |
- kubernetes_version: "kubernetes:latest" | |
node_image: "docker.io/kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144" | |
- kubernetes_version: "kubernetes:n-1" | |
node_image: "docker.io/kindest/node:v1.28.6@sha256:b7e1cf6b2b729f604133c667a6be8aab6f4dde5bb042c1891ae248d9154f665b" | |
- kubernetes_version: "kubernetes:n-2" | |
node_image: "docker.io/kindest/node:v1.27.10@sha256:3700c811144e24a6c6181065265f69b9bf0b437c45741017182d7c82b908918f" | |
- config_type: "ConfigmapConfiguration" | |
use_config_crd: "false" | |
- config_type: "ContourConfiguration" | |
use_config_crd: "true" | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- name: Download image | |
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 | |
with: | |
name: image | |
path: image | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: e2e tests | |
env: | |
NODEIMAGE: ${{ matrix.node_image }} | |
LOAD_PREBUILT_IMAGE: "true" | |
USE_CONTOUR_CONFIGURATION_CRD: ${{ matrix.use_config_crd }} | |
run: | | |
export CONTOUR_E2E_IMAGE="ghcr.io/projectcontour/contour:$(ls ./image/contour-*.tar | sed -E 's/.*contour-(.*).tar/\1/')" | |
make e2e | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
upgrade: | |
runs-on: ubuntu-latest | |
needs: [build-image] | |
strategy: | |
matrix: | |
# use stable kubernetes_version values since they're included | |
# in the name of the GitHub Actions job, and we don't want to | |
# have to update branch protection rules every time we change | |
# a Kubernetes version number. | |
kubernetes_version: ["kubernetes:latest", "kubernetes:n-1", "kubernetes:n-2"] | |
# include defines an additional variable (the specific node | |
# image to use) for each kubernetes_version value. | |
include: | |
- kubernetes_version: "kubernetes:latest" | |
node_image: "docker.io/kindest/node:v1.29.1@sha256:a0cc28af37cf39b019e2b448c54d1a3f789de32536cb5a5db61a49623e527144" | |
- kubernetes_version: "kubernetes:n-1" | |
node_image: "docker.io/kindest/node:v1.28.6@sha256:b7e1cf6b2b729f604133c667a6be8aab6f4dde5bb042c1891ae248d9154f665b" | |
- kubernetes_version: "kubernetes:n-2" | |
node_image: "docker.io/kindest/node:v1.27.10@sha256:3700c811144e24a6c6181065265f69b9bf0b437c45741017182d7c82b908918f" | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
# Fetch history for all tags and branches so we can figure out most | |
# recent release tag. | |
fetch-depth: 0 | |
- name: Download image | |
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 | |
with: | |
name: image | |
path: image | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: upgrade tests | |
env: | |
NODEIMAGE: ${{ matrix.node_image }} | |
MULTINODE_CLUSTER: "true" | |
LOAD_PREBUILT_IMAGE: "true" | |
SKIP_GATEWAY_API_INSTALL: "true" | |
run: | | |
export CONTOUR_E2E_IMAGE="ghcr.io/projectcontour/contour:$(ls ./image/contour-*.tar | sed -E 's/.*contour-(.*).tar/\1/')" | |
make upgrade | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
test-linux: | |
needs: | |
- lint | |
- codespell | |
- codegen | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: test | |
run: | | |
make install | |
make check-coverage | |
- name: codeCoverage | |
if: ${{ success() }} | |
uses: codecov/codecov-action@e0b68c6749509c5f83f984dd99a76a1c1a231044 # v4.0.1 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: coverage.out | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
test-osx: | |
needs: | |
- lint | |
- codespell | |
- codegen | |
runs-on: macos-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# * Module download cache | |
# * Build cache (Windows) | |
path: | | |
~/go/pkg/mod | |
~/Library/Caches/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: test | |
run: | | |
make install | |
make check-coverage | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} | |
gateway-conformance: | |
runs-on: ubuntu-latest | |
needs: [build-image] | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
persist-credentials: false | |
- name: Download image | |
uses: actions/download-artifact@eaceaf801fd36c7dee90939fad912460b18a1ffe # v4.1.2 | |
with: | |
name: image | |
path: image | |
- uses: actions/cache@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0 | |
with: | |
# * Module download cache | |
# * Build cache (Linux) | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: ${{ runner.os }}-${{ github.job }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-${{ github.job }}-go- | |
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
cache: false | |
- name: add deps to path | |
run: | | |
./hack/actions/install-kubernetes-toolchain.sh $GITHUB_WORKSPACE/bin | |
echo "$GITHUB_WORKSPACE/bin" >> $GITHUB_PATH | |
- name: Gateway API conformance tests | |
env: | |
LOAD_PREBUILT_IMAGE: "true" | |
run: | | |
export CONTOUR_E2E_IMAGE="ghcr.io/projectcontour/contour:$(ls ./image/contour-*.tar | sed -E 's/.*contour-(.*).tar/\1/')" | |
make gateway-conformance | |
- uses: act10ns/slack@ed1309ab9862e57e9e583e51c7889486b9a00b0f # v2.0.0 | |
with: | |
status: ${{ job.status }} | |
steps: ${{ toJson(steps) }} | |
channel: '#contour-ci-notifications' | |
if: ${{ failure() && github.ref == 'refs/heads/main' }} |