2022-08-05 11:05:37 +00:00
|
|
|
name: Tests and Build
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ "*" ]
|
|
|
|
tags: [ "v*" ]
|
|
|
|
pull_request:
|
|
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
|
|
tests:
|
|
|
|
name: Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-02-23 11:07:56 +00:00
|
|
|
go-version: "1.20"
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
- name: Set up QEMU dependency
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Setup dependencies
|
2023-02-23 11:02:01 +00:00
|
|
|
run: sudo apt update && sudo apt install -y util-linux udev parted e2fsprogs mount tar extlinux qemu-utils qemu-system
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-tests-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-tests-
|
|
|
|
|
|
|
|
- name: Run tests
|
2022-09-12 09:47:11 +00:00
|
|
|
run: git --no-pager diff --exit-code HEAD~1 HEAD **/**.go templates/ || make tests
|
2022-08-05 11:05:37 +00:00
|
|
|
|
2023-09-12 11:59:11 +00:00
|
|
|
templates-tests:
|
|
|
|
name: Test Templates
|
2023-02-28 16:59:32 +00:00
|
|
|
runs-on: ubuntu-latest
|
2023-09-12 11:59:11 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
image:
|
|
|
|
- ubuntu
|
|
|
|
- debian
|
|
|
|
- kalilinux
|
|
|
|
- alpine
|
|
|
|
- centos
|
2024-07-09 16:32:19 +00:00
|
|
|
- quay.io/centos/centos:stream9
|
2023-02-28 16:59:32 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: "1.20"
|
|
|
|
|
|
|
|
- name: Set up QEMU dependency
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Setup dependencies
|
|
|
|
run: sudo apt update && sudo apt install -y util-linux udev parted e2fsprogs mount tar extlinux qemu-utils qemu-system
|
|
|
|
|
2023-09-12 11:59:11 +00:00
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-tests-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-tests-
|
|
|
|
|
|
|
|
- name: Run tests
|
|
|
|
run: git --no-pager diff --exit-code HEAD~1 HEAD **/**.go templates/ || IMAGE=${{ matrix.image }} make test-templates
|
|
|
|
|
|
|
|
|
|
|
|
e2e-tests:
|
|
|
|
name: End to end Tests
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
image:
|
|
|
|
- alpine:3.17
|
|
|
|
- ubuntu:20.04
|
|
|
|
- ubuntu:22.04
|
|
|
|
- debian:10
|
|
|
|
- debian:11
|
|
|
|
- centos:8
|
2024-07-09 16:32:19 +00:00
|
|
|
- quay.io/centos/centos:stream9
|
2023-09-12 11:59:11 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
|
|
|
go-version: "1.20"
|
|
|
|
|
|
|
|
- name: Set up QEMU dependency
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Setup dependencies
|
|
|
|
run: sudo apt update && sudo apt install -y util-linux udev parted e2fsprogs mount tar extlinux qemu-utils qemu-system ovmf
|
|
|
|
|
2023-02-28 16:59:32 +00:00
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-e2e-tests-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-tests-
|
|
|
|
|
2023-02-23 11:02:01 +00:00
|
|
|
- name: Run end-to-end tests
|
2023-09-12 11:59:11 +00:00
|
|
|
run: E2E_IMAGES=${{ matrix.image }} make e2e
|
2023-02-23 11:02:01 +00:00
|
|
|
|
2022-08-10 09:35:55 +00:00
|
|
|
docs-up-to-date:
|
|
|
|
name: Docs up to date
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-02-23 11:07:56 +00:00
|
|
|
go-version: "1.20"
|
2022-08-10 09:35:55 +00:00
|
|
|
|
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-tests-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-tests-
|
|
|
|
|
|
|
|
- name: Check if docs are up to date
|
|
|
|
run: make docs-up-to-date
|
|
|
|
|
2022-08-05 11:05:37 +00:00
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-02-23 11:07:56 +00:00
|
|
|
go-version: "1.20"
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
- name: Set up QEMU dependency
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-build-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
|
|
|
|
- name: Ensure all files were well formatted
|
|
|
|
run: make check-fmt
|
|
|
|
|
|
|
|
- name: Import GPG key
|
|
|
|
id: import_gpg
|
|
|
|
uses: crazy-max/ghaction-import-gpg@v4
|
2023-02-23 10:59:15 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
|
2022-08-05 11:05:37 +00:00
|
|
|
with:
|
|
|
|
gpg_private_key: ${{ secrets.GPG_KEY }}
|
|
|
|
passphrase: ${{ secrets.GPG_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Build Snapshot
|
|
|
|
run: make build-snapshot
|
|
|
|
|
|
|
|
- name: Release Snapshot
|
2023-02-23 10:59:15 +00:00
|
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
|
2022-08-05 11:05:37 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
|
|
|
|
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
|
|
|
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
|
|
|
run: make release-snapshot
|
|
|
|
|
|
|
|
build-image:
|
|
|
|
name: Build Docker Image
|
2023-06-04 13:16:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-08-05 11:05:37 +00:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-02-23 11:07:56 +00:00
|
|
|
go-version: "1.20"
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
- name: Set up QEMU dependency
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
if: startsWith(github.ref, 'refs/tags/v') || github.ref == 'refs/heads/main'
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-build-image-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-image-
|
|
|
|
|
|
|
|
- name: Build Docker images
|
|
|
|
run: make docker-build
|
|
|
|
|
|
|
|
- name: Push Docker images
|
|
|
|
if: github.ref == 'refs/heads/main'
|
|
|
|
run: make docker-push
|
|
|
|
|
|
|
|
release:
|
|
|
|
name: Release Binaries
|
2023-06-04 13:16:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-08-05 11:05:37 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags/v')
|
|
|
|
needs:
|
|
|
|
- tests
|
2023-09-12 11:59:11 +00:00
|
|
|
- templates-tests
|
2022-08-10 09:35:55 +00:00
|
|
|
- docs-up-to-date
|
2022-08-05 11:05:37 +00:00
|
|
|
- build
|
2023-02-28 17:12:38 +00:00
|
|
|
- e2e-tests
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-02-23 11:07:56 +00:00
|
|
|
go-version: "1.20"
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-build-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-
|
|
|
|
|
|
|
|
- name: Import GPG key
|
|
|
|
id: import_gpg
|
|
|
|
uses: crazy-max/ghaction-import-gpg@v4
|
|
|
|
with:
|
|
|
|
gpg_private_key: ${{ secrets.GPG_KEY }}
|
|
|
|
passphrase: ${{ secrets.GPG_PASSWORD }}
|
|
|
|
|
|
|
|
- name: Build binaries
|
|
|
|
run: make build
|
|
|
|
|
|
|
|
- name: Release binaries
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.REPOSITORIES_ACCESS_TOKEN }}
|
|
|
|
GPG_PASSWORD: ${{ secrets.GPG_PASSWORD }}
|
|
|
|
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}
|
|
|
|
run: make release
|
|
|
|
|
|
|
|
release-image:
|
|
|
|
name: Release Docker Image
|
2023-06-04 13:16:45 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-08-05 11:05:37 +00:00
|
|
|
if: startsWith(github.event.ref, 'refs/tags/v')
|
|
|
|
needs:
|
|
|
|
- tests
|
2022-08-10 09:35:55 +00:00
|
|
|
- docs-up-to-date
|
2022-08-05 11:05:37 +00:00
|
|
|
- build-image
|
2023-02-28 17:12:38 +00:00
|
|
|
- e2e-tests
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
with:
|
|
|
|
# fetching all tags is required for the Makefile to compute the right version
|
|
|
|
fetch-depth: 0
|
|
|
|
|
|
|
|
- name: Set up Go
|
|
|
|
uses: actions/setup-go@v2
|
|
|
|
with:
|
2023-02-23 11:07:56 +00:00
|
|
|
go-version: "1.20"
|
2022-08-05 11:05:37 +00:00
|
|
|
|
|
|
|
- name: Set up QEMU dependency
|
|
|
|
uses: docker/setup-qemu-action@v1
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
|
|
|
uses: docker/setup-buildx-action@v1
|
|
|
|
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v1
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_HUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }}
|
|
|
|
|
|
|
|
- name: Share cache with other actions
|
|
|
|
uses: actions/cache@v2
|
|
|
|
with:
|
|
|
|
path: |
|
|
|
|
~/go/pkg/mod
|
|
|
|
/tmp/.buildx-cache
|
|
|
|
key: ${{ runner.os }}-build-image-${{ github.sha }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-build-image-
|
|
|
|
|
|
|
|
- name: Build Docker images
|
|
|
|
run: make docker-build
|
|
|
|
|
|
|
|
- name: Release Docker images
|
|
|
|
run: make docker-push
|