Merge pull request #257 from jacobweinstock/update-crd-generation #617
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: For each commit and PR | |
on: | |
push: | |
branches: | |
- "*" | |
tags-ignore: | |
- "v*" | |
pull_request: | |
env: | |
CGO_ENABLED: 0 | |
GO_VERSION: '1.21' | |
jobs: | |
verify: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "${{ env.GO_VERSION }}" | |
- name: make vet | |
run: make vet | |
- name: lint | |
run: make lint | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "${{ env.GO_VERSION }}" | |
- name: Unit test | |
run: make test | |
- name: Upload codecov | |
uses: codecov/codecov-action@v4 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
build: | |
runs-on: ubuntu-latest | |
needs: | |
- verify | |
- test | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to quay.io | |
uses: docker/login-action@v3 | |
if: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }} | |
with: | |
registry: quay.io | |
username: ${{ secrets.QUAY_USERNAME }} | |
password: ${{ secrets.QUAY_PASSWORD }} | |
- name: Docker build meta | |
id: image-meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: quay.io/tinkerbell/rufio | |
tags: | | |
type=raw,value=latest,enable={{is_default_branch}} | |
type=ref,event=branch,enable=${{ !startsWith(github.ref, 'refs/heads/main') }} | |
type=sha | |
- name: Docker build quay.io/tinkerbell/rufio | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./ | |
file: ./Dockerfile | |
cache-from: type=registry,ref=quay.io/tinkerbell/rufio:latest | |
tags: ${{ steps.image-meta.outputs.tags }} | |
platforms: linux/amd64,linux/arm64 | |
push: ${{ startsWith(github.ref, 'refs/heads/main') || startsWith(github.ref, 'refs/heads/v') }} |