Skip to content

Simplify release workflows by removing matrix strategy and steps #167

Simplify release workflows by removing matrix strategy and steps

Simplify release workflows by removing matrix strategy and steps #167

name: release-pullrequest
on:
pull_request:
branches:
- main
env:
GHCR_REPO: ghcr.io/${{ github.repository }}
LOCAL_KIND: false
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.GHCR_REPO }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build (no push)
uses: docker/build-push-action@v5
with:
push: false
load: ${{ env.LOCAL_KIND == 'true' }}
no-cache: ${{ env.LOCAL_KIND == 'true' }}
platforms: ${{ env.LOCAL_KIND == 'true' && 'linux/amd64' || 'linux/amd64,linux/arm64' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
CACHEBUST=${{ github.sha }}
COMMIT_HASH=${{ github.sha }}
cache-from: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha' }}
cache-to: ${{ env.LOCAL_KIND == 'true' && '' || 'type=gha,mode=max' }}
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 'stable'
- name: Gather dependencies
run: go mod download
- name: Run coverage
run: go test -race -tags=unit,integration -p 1 -coverprofile=coverage.txt -covermode=atomic ./...
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}