Skip to content

Use container in ci #11

Use container in ci

Use container in ci #11

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
jobs:
prepare-container:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ghcr.io/${{ github.repository }}-pr${{ github.event.pull_request.number }}
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build:
needs: prepare-container
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}-pr${{ github.event.pull_request.number }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: make build
- run: make run args=-help
test:
needs: prepare-container
runs-on: ubuntu-latest
container:
image: ghcr.io/${{ github.repository }}-pr${{ github.event.pull_request.number }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: make test