Bump github.com/stretchr/testify from 1.9.0 to 1.10.0 (#354) #1022
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: CI | |
on: | |
push: | |
pull_request: | |
permissions: | |
contents: read | |
jobs: | |
go-lint: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
name: Go Lint | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
id: setup-go | |
uses: ./.github/actions/setup-go | |
with: | |
cache-prefix: go-lint | |
- name: Compute tools cache info | |
id: tools-cache-info | |
run: | | |
echo path=bin/tooling >> $GITHUB_OUTPUT | |
echo make-hash=$(make -n install-tools | sha256sum | cut -d' ' -f1) >> $GITHUB_OUTPUT | |
- name: Setup tools cache | |
uses: actions/cache@v4 | |
id: tools-cache | |
with: | |
path: ${{ steps.tools-cache-info.outputs.path }} | |
key: tools-go-${{ steps.setup-go.outputs.go-version }}-make-${{ steps.tools-cache-info.outputs.make-hash }} | |
- name: Install tools | |
if: steps.tools-cache.outputs.cache-hit != 'true' | |
env: | |
GOCACHE: /tmp/tools/go-build | |
GOMODCACHE: /tmp/tools/go-mod | |
run: make install-tools | |
- name: Check module files | |
run: | | |
go mod tidy | |
modified=$(git ls-files --modified -- go.{mod,sum}) | |
if [ -n "$modified" ]; then | |
for file in $modified; do | |
echo "::error file=$file::$file is not up to date (hint: run \"go mod tidy\" to fix this)" | |
done | |
exit 1 | |
fi | |
- name: Compute golangci-lint cache info | |
id: golangci-lint-cache-info | |
run: | | |
version_regex=" v([0-9]+\.[0-9]+\.[0-9]+) " | |
[[ "$(bin/tooling/golangci-lint version)" =~ $version_regex ]] | |
echo version=${BASH_REMATCH[1]} >> $GITHUB_OUTPUT | |
cache_regex='Dir: (.*)\n' | |
[[ "$(bin/tooling/golangci-lint cache status)" =~ $cache_regex ]] | |
echo path=${BASH_REMATCH[1]} >> $GITHUB_OUTPUT | |
- name: Setup golangci-lint cache | |
uses: actions/cache@v4 | |
with: | |
path: ${{ steps.golangci-lint-cache-info.outputs.path }} | |
key: golangci-lint-${{ steps.golangci-lint-cache-info.outputs.version }}-go-${{ steps.setup-go.outputs.go-version }}-mod-${{ hashFiles('go.sum') }} | |
- name: Run golangci-lint | |
run: make go-lint | |
go-unit-tests: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
name: Go Unit Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
with: | |
cache-prefix: go-unit-tests | |
- name: Run Go Unit Tests | |
run: make test-go-unit | |
go-integration-tests: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
name: Go Integration Tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
with: | |
cache-prefix: go-unit-tests | |
- name: Run Go Integration Tests | |
run: make integration-tests | |
codegen: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
name: Check codegen diff | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
with: | |
cache-prefix: generate | |
- name: Generate code | |
run: make codegen | |
- name: Check diff | |
run: git diff --exit-code | |
build: | |
if: github.event_name == 'push' || github.event.pull_request.head.repo.id != github.event.pull_request.base.repo.id | |
name: Build (${{ matrix.os }}/${{ matrix.arch }}) | |
needs: | |
- go-lint | |
- go-unit-tests | |
- go-integration-tests | |
- codegen | |
strategy: | |
matrix: | |
os: [linux] | |
arch: [amd64, arm64] | |
include: | |
- os: linux | |
runner: ubuntu-latest | |
fail-fast: true | |
runs-on: ${{ matrix.runner }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup Go | |
uses: ./.github/actions/setup-go | |
with: | |
cache-prefix: build-${{ matrix.os }}-${{ matrix.arch }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Docker metadata | |
id: docker-metadata | |
uses: docker/metadata-action@v5 | |
with: | |
images: unicorn-history-server | |
tags: | | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=edge | |
- name: Build software distribution | |
run: make docker-build-tarball | |
env: | |
OS: ${{ matrix.os }} | |
ARCH: ${{ matrix.arch }} | |
DOCKER_METADATA: ${{ steps.docker-metadata.outputs.json }} | |
- name: Upload Docker artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: unicorn-history-server-oci-images-${{ matrix.arch }} | |
path: bin/docker/unicorn-history-server-oci-*.tar | |
# Virtual job that can be configured as a required check before a PR can be merged. | |
# As GitHub considers a check as successful if it is skipped, we need to check its status in | |
# another workflow (check-required.yml) and create a check there. | |
all-required-checks-done: | |
name: All required checks done | |
needs: | |
- build | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "All required checks done" | |
release: | |
name: Release | |
needs: all-required-checks-done | |
if: ${{ !github.event.repository.fork && github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main') }} | |
permissions: | |
actions: write | |
contents: write | |
pages: write | |
id-token: write | |
secrets: inherit | |
uses: ./.github/workflows/release.yml |