Fix module name after the repo transfer (#270) #1
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: Main commit workflow | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
tags: | |
- v* | |
paths-ignore: | |
- '**.md' | |
pull_request: | |
branches: | |
- main | |
paths-ignore: | |
- 'docs/**' | |
- '**/*.md' | |
env: | |
platforms: linux/amd64,linux/arm64 | |
registry: ghcr.io | |
image: ghcr.io/${{ github.repository_owner }}/ipam | |
jobs: | |
go-lint: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Configure git for private modules | |
run: ./hack/setup-git-redirect.sh | |
env: | |
GITHUB_PAT: ${{ secrets.BOT_PAT }} | |
- name: Lint golang sources | |
uses: golangci/golangci-lint-action@v4 | |
with: | |
args: -e S1008 --timeout 15m | |
go-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Setup golang | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: go.mod | |
- name: Configure git for private modules | |
run: ./hack/setup-git-redirect.sh | |
env: | |
GITHUB_PAT: ${{ secrets.BOT_PAT }} | |
- name: Run tests | |
run: make test | |
kustomize-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Complie manifests | |
uses: azure/k8s-bake@v2 | |
with: | |
renderEngine: 'kustomize' | |
kustomizationPath: './config/default/' | |
kubectl-version: 'latest' | |
silent: 'false' | |
docker-build: | |
needs: [ kustomize-test, go-lint, go-test ] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.pull_request.head.sha }} | |
- name: Login to Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{ env.registry }} | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get metadata for docker | |
uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: | | |
${{ env.image }} | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=tag | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=sha | |
flavor: | | |
latest=${{ github.ref == 'refs/heads/main' }} | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
with: | |
image: tonistiigi/binfmt:latest | |
platforms: ${{env.platforms}} | |
- name: Set up Docker Context for Buildx | |
id: buildx-context | |
run: | | |
docker context create builders | |
- name: Set up Docker Buildx | |
timeout-minutes: 5 | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: latest | |
endpoint: builders | |
- name: Build and push | |
uses: docker/build-push-action@v5 | |
timeout-minutes: 60 | |
with: | |
context: . | |
platforms: ${{ env.platforms }} | |
push: true | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
GOPRIVATE=github.com/onmetal/* | |
secrets: | | |
"github_pat=${{ secrets.BOT_PAT }}" |