build: Preparing release v0.9.3 #93
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: tests | |
on: | |
push: | |
branches: | |
- main | |
- release-v* | |
pull_request: | |
branches: | |
- main | |
jobs: | |
generate-checks: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: generate-check-go-${{ runner.os }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
generate-check-go-${{ runner.os }}- | |
- name: Verify generated source is up-to-date | |
run: | | |
make generate | |
if [ ! -z "$(git status --porcelain)" ]; then | |
echo "make generate must be invoked and the result committed" | |
git status | |
git diff | |
exit 1 | |
fi | |
- name: Verify generated manifests are up-to-date | |
run: | | |
make manifests | |
if [ ! -z "$(git status --porcelain)" ]; then | |
echo "make manifests must be invoked and the result committed" | |
git status | |
git diff | |
exit 1 | |
fi | |
- name: Verify generated docs are up-to-date | |
run: | | |
make api-docs | |
make helm-docs | |
if [ ! -z "$(git status --porcelain)" ]; then | |
echo "make api-docs must be invoked and the result committed" | |
git status | |
git diff | |
exit 1 | |
fi | |
- name: Verify go.mod and go.sum are clean | |
run: | | |
go mod tidy | |
if [ ! -z "$(git status --porcelain)" ]; then | |
echo "go mod tidy must be invoked and the result committed" | |
git status | |
git diff | |
exit 1 | |
fi | |
check-docker-images: | |
strategy: | |
matrix: | |
include: | |
- docker_platform: linux/amd64 | |
goarch: amd64 | |
arch_org: amd64 | |
- docker_platform: linux/arm64 | |
goarch: arm64 | |
arch_org: arm64v8 | |
fail-fast: false | |
runs-on: ubuntu-latest | |
name: check-docker-images-${{ matrix.docker_platform }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: check-docker-images-${{ matrix.docker_platform }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
check-docker-images-${{ runner.os }}- | |
- name: Setup QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Setup Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Build template-controller | |
run: | | |
GOARCH=${{ matrix.goarch }} make build-bin | |
- name: Build docker images | |
run: | | |
docker build -t test-image --platform=${{ matrix.docker_platform }} --build-arg=ARCH_ORG=${{ matrix.arch_org }} . | |
- name: Test if Jinja2 works inside container | |
run: | | |
# test if Jinja2 rendering is still working. It might break if the glibc version from wolfi-base is not | |
# recent enough to support the embedded Python distribution. | |
docker run --platform=${{ matrix.docker_platform }} --rm -i --entrypoint=/bin/sh test-image -c "/usr/bin/template-controller -test-jinja2" | |
tests: | |
runs-on: ubuntu-22.04 | |
name: tests | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
- uses: actions/cache@v4 | |
with: | |
path: | | |
~/go/pkg/mod | |
~/.cache/go-build | |
key: tests-go-${{ runner.os }}-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
tests-go-${{ runner.os }}- | |
- name: Run tests | |
shell: bash | |
run: | | |
make test |