Skip to content

Bump docker/metadata-action from 4 to 5 (#293) #911

Bump docker/metadata-action from 4 to 5 (#293)

Bump docker/metadata-action from 4 to 5 (#293) #911

Workflow file for this run

name: Hegel
on:
push:
branches:
- "*"
tags-ignore:
- "v*"
pull_request:
env:
REGISTRY: quay.io
IMAGE: quay.io/${{ github.repository }}
CGO_ENABLED: 0
GO_VERSION: "1.20"
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- run: make lint
test:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: Run tests
run: go test -coverprofile=coverage.txt ./...
- name: Upload coverage report (codcov.io)
run: bash <(curl -s https://codecov.io/bash)
integration:
name: Test - Integration
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: Run integration tests
run: make test-integration
- name: Upload coverage report (codcov.io)
run: bash <(curl -s https://codecov.io/bash)
build:
name: Build
strategy:
matrix:
platform: [amd64, arm64]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: Build linux/${{ matrix.platform }}
run: make build GOARCH=${{ matrix.platform }}
- name: Upload linux/${{ matrix.platform }} binary
uses: actions/upload-artifact@v3
with:
name: hegel
retention-days: 1
path: hegel-linux-${{ matrix.platform }}
e2e:
name: Test - E2E
runs-on: ubuntu-latest
needs: [test, integration]
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: "${{ env.GO_VERSION }}"
cache: true
- name: Run end-to-end tests
run: make test-e2e
- name: Upload coverage report (codcov.io)
run: bash <(curl -s https://codecov.io/bash)
package:
name: Package
runs-on: ubuntu-latest
needs: [lint, build, test, e2e]
steps:
- uses: actions/checkout@v4
# We need to specify a name for the download action else artifacts are downloaded with
# whatever name they were uploaded with. Its required because the Dockerfile expects
# the filenames to be formatted appropriately for the platform.
- name: Download all binaries
uses: actions/download-artifact@v3
with:
name: hegel
# The upload/download actions do not preserve permissions so they need explicitly setting.
- name: Fix binary permissions
run: chmod +x hegel-linux-*
- name: Generate image tags
uses: docker/metadata-action@v5
id: meta
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
images: ${{ env.IMAGE }}
flavor: latest=false
tags: |
type=sha
- name: Login to quay.io
uses: docker/login-action@v2
if: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }}
with:
registry: ${{ env.REGISTRY }}
username: ${{ secrets.QUAY_USERNAME }}
password: ${{ secrets.QUAY_PASSWORD }}
- uses: docker/setup-buildx-action@v3
- name: Build images and push
uses: docker/build-push-action@v5
with:
context: ./
cache-from: type=registry,ref=${{ env.IMAGE }}:latest
push: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }}
tags: ${{ steps.meta.outputs.tags }}
platforms: linux/amd64,linux/arm64