Skip to content

Build, test and tag for release #812

Build, test and tag for release

Build, test and tag for release #812

name: Build, test and tag for release
on:
push:
branches:
- main
paths-ignore:
- "**.md"
workflow_dispatch:
schedule:
- cron: "0 19 * * *"
permissions:
contents: read
packages: write
id-token: write
jobs:
build:
runs-on: ubuntu-24.04
strategy:
matrix:
os: [linux]
arch: [arm64, amd64]
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/build-builder
- name: Build
uses: ./.github/actions/run-in-builder
with:
cmd: >
docker login --username ${{ github.repository_owner }} --password ${{ github.token }} ghcr.io
&& make build-image push-image
env:
K6_DIST_LOCATION: k6-${{ matrix.arch }}
FULL_IMAGE_NAME: ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}-${{ matrix.arch }}
GOOS: ${{ matrix.os }}
GOARCH: ${{ matrix.arch }}
- uses: actions/upload-artifact@v4
with:
name: k6-${{ matrix.arch }}
path: ./k6-${{ matrix.arch }}
build-multiarch-docker-manifest:
runs-on: ubuntu-24.04
outputs:
image: ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login ghcr.io
shell: bash
run: docker login --username ${{ github.repository_owner }} --password ${{ github.token }} ghcr.io
- name: Create multiarch manifest
run: |
docker manifest create \
ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }} \
--amend ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}-arm64 \
--amend ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}-amd64
- run: docker manifest push ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}
needs:
- build
test:
runs-on: ubuntu-24.04
environment: Test
steps:
- uses: actions/checkout@v4
- name: Login ghcr.io
shell: bash
run: >
docker login --username ${{ github.repository_owner }} --password ${{ github.token }} ghcr.io
&& docker pull ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}
- uses: ./.github/actions/build-builder
- name: Integration Tests
uses: ./.github/actions/integration-tests
with:
image: ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}
aws-role-arn: ${{ secrets.AWS_ROLE_ARN }}
- name: Integration Tests (cross-region)
uses: ./.github/actions/integration-tests
with:
image: ghcr.io/${{ github.repository_owner }}/k6:${{ github.sha }}
region: eu-west-1
aws-role-arn: ${{ secrets.AWS_ROLE_ARN }}
needs:
- build-multiarch-docker-manifest
build-grafana:
uses: ./.github/workflows/_build-grafana.yaml
with:
push: true
tag-release:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
with:
# Needed so that we trigger the version tag action - see
# https://github.com/orgs/community/discussions/27028#discussioncomment-3254367
ssh-key: "${{ secrets.SSH_KEY_GITHUB }}"
fetch-depth: 0
- uses: gembaadvantage/uplift-action@v2
with:
args: release --skip-changelog
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
needs:
- build
- build-multiarch-docker-manifest
- test
- build-grafana