Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/workflows/check-codegen.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Check Codegen

on:
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
check-codegen:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Run make generate
run: make generate

- name: Run make docs
run: make docs

- name: Run make helm
run: make helm

- name: Run fmt
run: make fmt

- name: Compare the expected and actual generated/* directories
run: |
if [ "$(git diff | wc -l)" -gt "0" ]; then
echo "Detected uncommitted changes after build. Consider running 'make generate && make docs && make helm'."
echo "See status below:"
git diff
exit 1
fi
65 changes: 0 additions & 65 deletions .github/workflows/checks.yaml

This file was deleted.

56 changes: 0 additions & 56 deletions .github/workflows/ci.yaml

This file was deleted.

10 changes: 1 addition & 9 deletions .github/workflows/goreleaser.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
################################################################################
# This file is AUTOGENERATED with <https://github.com/sapcc/go-makefile-maker> #
# Edit Makefile.maker.yaml instead. #
################################################################################

# SPDX-FileCopyrightText: 2024 SAP SE or an SAP affiliate company
# SPDX-License-Identifier: Apache-2.0

name: goreleaser
"on":
push:
Expand All @@ -16,7 +8,7 @@ permissions:
packages: write
jobs:
release:
name: goreleaser
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Check out code
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/kustomize-validation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Kustomize Validation

on:
pull_request:
types: [ assigned, opened, synchronize, reopened ]
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
kustomize-validation:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v5

- name: Install Kustomize
run: |
make kustomize
mv ./bin/kustomize /usr/local/bin

- run: |
./hack/validate-kustomize.sh
26 changes: 26 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Lint

on:
pull_request:
paths-ignore:
- 'docs/**'
- '**/*.md'

jobs:
lint:
name: Run on Ubuntu
runs-on: ubuntu-latest
steps:
- name: Clone the code
uses: actions/checkout@v5

- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod

- name: Run linter
run: |
make golangci-lint
cp ./bin/golangci-lint /usr/local/bin/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we otherwise use mv <binary> /usr/local/bin, e.g. in the kustomize-validation workflow. Ideally this would be consistent.

go list -f '{{.Dir}}' ./... | grep -v nxos/ | xargs golangci-lint run
85 changes: 85 additions & 0 deletions .github/workflows/publish-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Release Helm Chart

on:
release:
types:
- published
push:
branches:
- main
tags:
- 'v*.*.*'
paths-ignore:
- 'docs/**'
- '**/*.md'
pull_request:
branches:
- main
paths-ignore:
- 'docs/**'
- '**/*.md'
types: [labeled, opened, synchronize, reopened]

jobs:
helm-chart:
name: Run on Ubuntu
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

if: |
github.event_name == 'push' ||
(github.event_name == 'pull_request' && contains(github.event.pull_request.labels.*.name, 'ok-to-charts')) ||
(github.event_name == 'release' && github.event.action == 'published')
steps:
- name: Checkout code
uses: actions/checkout@v5

- name: Set up Helm
uses: azure/setup-helm@v4
with:
version: v3.17.0

- name: Determine chart version
id: chart_version
run: |
if [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" == "refs/heads/main" ]]; then
# Use SHA for main branch
CHART_VERSION="0.0.0-$(echo ${{ github.sha }} | cut -c1-7)"
elif [[ "${{ github.event_name }}" == "push" && "${{ github.ref }}" =~ ^refs/tags/v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
# Use tag version (strip 'v' prefix)
CHART_VERSION="${GITHUB_REF#refs/tags/v}"
else
# Use PR SHA for dry run
CHART_VERSION="0.0.0-$(echo ${{ github.sha }} | cut -c1-7)"
fi
echo "version=$CHART_VERSION" >> $GITHUB_OUTPUT

- name: Install Kustomize
run: |
make kustomize
mv ./bin/kustomize /usr/local/bin

- name: Package Helm chart with crds folder in template
run: |
helm package charts/network-operator --version ${{ steps.chart_version.outputs.version }}-crds

- name: Prepare CRDs folder
run: |
mkdir -p charts/network-operator/crds
kustomize build config/default | yq ea 'select(.kind == "CustomResourceDefinition")' > charts/network-operator/crds/crds.yaml
rm -rf charts/network-operator/templates/crd

- name: Package Helm chart with removed crds folder from template folder
run: |
helm package charts/network-operator --version ${{ steps.chart_version.outputs.version }}

- name: Log in to GitHub Container Registry
run: |
echo "${{ secrets.GITHUB_TOKEN }}" | helm registry login ghcr.io -u ${{ github.actor }} --password-stdin

- name: Push Helm chart to GHCR
run: |
helm push network-operator-${{ steps.chart_version.outputs.version }}.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
helm push network-operator-${{ steps.chart_version.outputs.version }}-crds.tgz oci://ghcr.io/${{ github.repository_owner }}/charts
Loading
Loading