CI #455
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: CI | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build | |
run: make | |
linux: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Build for all Linux Architectures | |
run: make all-build | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.2 | |
- name: Lint Code | |
run: make vendor lint | |
container: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.2 | |
- name: Container | |
run: CONTAINERIZE_BUILD=false make container | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.2 | |
- name: Build Container | |
run: | | |
CONTAINERIZE_BUILD=false make container-latest | |
docker tag squat/generic-device-plugin:amd64-latest squat/generic-device-plugin | |
- name: Test Code | |
run: make unit | |
push: | |
if: github.event_name != 'pull_request' && github.event_name != 'schedule' | |
needs: | |
- build | |
- linux | |
- lint | |
- container | |
- test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v4 | |
with: | |
go-version: 1.20.2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Login to DockerHub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v2 | |
with: | |
registry: ghcr.io | |
username: ${{ github.repository_owner }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
run: | | |
CONTAINERIZE_BUILD=false make manifest | |
make clean | |
CONTAINERIZE_BUILD=false REGISTRY=ghcr.io make manifest | |
- name: Build and push latest | |
if: github.ref == 'refs/heads/main' | |
run: | | |
CONTAINERIZE_BUILD=false make manifest-latest | |
make clean | |
CONTAINERIZE_BUILD=false REGISTRY=ghcr.io make manifest-latest |