refactor: small refactoring #82
Workflow file for this run
This file contains hidden or 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: Operator Build | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- '.github/**' | |
- 'hack/**' | |
- '*.md' | |
- 'MAKEFILE' | |
pull_request: | |
branches: | |
- main | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
permissions: | |
contents: read | |
jobs: | |
binary: | |
runs-on: ubuntu-latest | |
name: Build Operator Binary | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Cache tools | |
uses: actions/cache@v4 | |
with: | |
path: ./bin | |
key: ${{ runner.os }}-bin-${{ hashFiles('Makefile') }} | |
- name: Install go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: Verify tidy | |
run: | | |
go mod tidy | |
git diff -s --exit-code | |
- name: Lint codebase | |
run: make lint | |
- name: Run unit tests | |
run: make test | |
- name: Build the operator | |
run: make build | |
generation: | |
runs-on: ubuntu-latest | |
name: Generate Operator Manifests | |
needs: binary | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
- name: Cache tools | |
uses: actions/cache@v4 | |
with: | |
path: ./bin | |
key: ${{ runner.os }}-bin-${{ hashFiles('Makefile') }} | |
- name: Generate RBAC manifests | |
# tidy and restore are a patch required only for ci runner | |
run: | | |
go mod tidy | |
make generate manifests | |
git restore go.mod go.sum | |
- name: Fail if generated diff | |
run: git diff -s --exit-code | |
image: | |
runs-on: ubuntu-latest | |
name: Build Operator Image | |
needs: binary | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@v4 | |
# required for caching podman images | |
- name: Tar as root | |
run: | | |
sudo mv -fv /usr/bin/tar /usr/bin/tar.orig | |
echo -e '#!/bin/sh\n\nsudo /usr/bin/tar.orig "$@"' | sudo tee -a /usr/bin/tar | |
sudo chmod +x /usr/bin/tar | |
- name: Cache podman images | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.local/share/containers | |
~/.config/containers | |
key: ${{ runner.os }}-operator-image-${{ hashFiles('Containerfile') }} | |
- name: Build container image | |
run: make container-build |