ci: migrate publish container workflow to GHA #14
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: Push/PR | |
on: | |
pull_request: {} | |
push: | |
branches: | |
- main | |
jobs: | |
deps: | |
name: Check dependencies | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Ensure deps are clean | |
run: | | |
make deps | |
./scripts/enforce-clean | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 # Needed for version script to work. | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Build | |
run: | | |
make build | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- name: Build container | |
uses: docker/build-push-action@v6 | |
with: | |
push: false | |
platforms: linux/amd64,linux/arm64 | |
# Needed for this action to use local context incl. binaries built in the previous step. | |
# https://github.com/docker/build-push-action?tab=readme-ov-file#path-context | |
# TODO: Make docker build self-contained. | |
context: . | |
tags: ci.local/${{ github.repository }} | |
test: | |
name: Test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Test | |
run: | | |
make build-xk6-linux-amd64 # Tests require a valid k6 binary in dist/k6 | |
make test | |
lint: | |
name: Lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
# Get golangci-lint version that `make lint` uses. | |
- name: Retrieve golangci-lint version | |
id: version | |
run: |- | |
echo "golangci=$(make golangci-lint-version)" >> $GITHUB_OUTPUT | |
# Use the golangci-lint action, which provides Github-specific features such as diff annotations. | |
- name: Run golangi-lint | |
uses: golangci/golangci-lint-action@v6 | |
with: | |
version: ${{ steps.version.outputs.golangci }} | |
args: --timeout=5m # 1m is not enough, experimentally. | |
only-new-issues: true | |
- name: Run the rest of the linters | |
run: |- | |
make lint GOLANGCI_LINT=/bin/true |