From 1868adbb814e6742ad360643714a4e4eda4ed4ac Mon Sep 17 00:00:00 2001 From: Mickael Stanislas Date: Tue, 29 Oct 2024 11:05:17 +0100 Subject: [PATCH 1/3] ci: add kubebuilder check and update doc.crds.dev update --- .github/workflows/go-generate.yml | 5 +++- .github/workflows/go-proxy.yml | 27 ++++++++++++------- .github/workflows/go-test.yml | 2 ++ .github/workflows/kubebuilder-generate.yaml | 29 +++++++++++++++++++++ .github/workflows/new-release.yaml | 18 ++++++++++++- .github/workflows/publish-doc.yaml | 2 +- 6 files changed, 70 insertions(+), 13 deletions(-) create mode 100644 .github/workflows/kubebuilder-generate.yaml diff --git a/.github/workflows/go-generate.yml b/.github/workflows/go-generate.yml index 0989251..49a83cc 100644 --- a/.github/workflows/go-generate.yml +++ b/.github/workflows/go-generate.yml @@ -1,4 +1,3 @@ -# Terraform Provider testing workflow. name: go-generate # This GitHub action runs your tests for each pull request and push. @@ -9,6 +8,10 @@ on: - 'docs/**' - 'tools/**' +# Testing only needs permissions to read the repository contents. +permissions: + contents: read + jobs: generate: name: Generate diff --git a/.github/workflows/go-proxy.yml b/.github/workflows/go-proxy.yml index ce4e2f0..a4782f6 100644 --- a/.github/workflows/go-proxy.yml +++ b/.github/workflows/go-proxy.yml @@ -1,14 +1,21 @@ -name: 'Force pkg.go.dev release sync' +name: 'Force update pkg.go.dev/doc.crds.dev release sync' on: - release: - types: [published] + release: + types: [published] jobs: - build: - name: Renew documentation - runs-on: - group: Default - steps: - - name: Pull new module version - uses: andrewslotin/go-proxy-pull-action@master + pkg-go-dev: + name: Renew documentation + runs-on: + group: Default + steps: + - name: Pull new module version + uses: andrewslotin/go-proxy-pull-action@master + doc-crds-dev: + name: Renew documentation + runs-on: + group: Default + steps: + - name: update doc.crds.dev + uses: azrod/doc-crds-dev-update-action@master diff --git a/.github/workflows/go-test.yml b/.github/workflows/go-test.yml index 14ffd0c..fe51cd8 100644 --- a/.github/workflows/go-test.yml +++ b/.github/workflows/go-test.yml @@ -2,6 +2,8 @@ name: Unit tests on: pull_request: + paths: + - '**.go' workflow_dispatch: permissions: diff --git a/.github/workflows/kubebuilder-generate.yaml b/.github/workflows/kubebuilder-generate.yaml new file mode 100644 index 0000000..e34967a --- /dev/null +++ b/.github/workflows/kubebuilder-generate.yaml @@ -0,0 +1,29 @@ +name: kubebuidler-generate + +# This GitHub action runs your tests for each pull request and push. +# Optionally, you can turn it on using a schedule for regular testing. +on: + pull_request: + paths: + - 'api/**' + - 'internal/controller/**' + +# only needs permissions to read the repository contents. +permissions: + contents: read + +jobs: + kubebuilder: + name: Kube Builder + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 # v3.5.0 + - uses: actions/setup-go@v5 # v4.0.0 + with: + go-version-file: 'go.mod' + - run: make manifests + - run: make generate + - name: git diff + run: | + git diff --compact-summary --exit-code || \ + (echo; echo "Unexpected difference in directories after code generation. Run 'make generate and make manifests' command and commit."; exit 1) diff --git a/.github/workflows/new-release.yaml b/.github/workflows/new-release.yaml index ab0ef71..5a14863 100644 --- a/.github/workflows/new-release.yaml +++ b/.github/workflows/new-release.yaml @@ -97,9 +97,25 @@ jobs: run: | git diff --compact-summary --exit-code || \ (echo; echo "Unexpected difference in directories after code generation. Run 'go generate ./...' command and commit."; exit 1) + kubebuilder: + needs: [pre-check] + name: Kube Builder + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 # v3.5.0 + - uses: actions/setup-go@v5 # v4.0.0 + with: + go-version-file: 'go.mod' + - run: make manifests + - run: make generate + - name: git diff + run: | + git diff --compact-summary --exit-code || \ + (echo; echo "Unexpected difference in directories after code generation. Run 'make generate and make manifests' command and commit."; exit 1) + # * Step 2: Create a new tag tag: - needs: [golangci-lint, pre-check, tag-already-exist, testsunit, generate] + needs: [golangci-lint, pre-check, tag-already-exist, testsunit, generate, kubebuilder] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/publish-doc.yaml b/.github/workflows/publish-doc.yaml index 827dca2..ba37fbd 100644 --- a/.github/workflows/publish-doc.yaml +++ b/.github/workflows/publish-doc.yaml @@ -27,5 +27,5 @@ jobs: path: .cache restore-keys: | mkdocs-material- - - run: pip install mkdocs-material pymdown-extensions mkdocs-video mkdocs-macros-plugin + - run: pip install mkdocs-material pymdown-extensions mkdocs-macros-plugin - run: mkdocs gh-deploy --force From 79864981dbc72cadfd9e4afb1a3d025f2b78f299 Mon Sep 17 00:00:00 2001 From: Mickael Stanislas Date: Tue, 29 Oct 2024 11:47:52 +0100 Subject: [PATCH 2/3] chore: try netlify From 4ffe5506a52011e05c2b7b530d014c4342fa996d Mon Sep 17 00:00:00 2001 From: Mickael Stanislas Date: Tue, 29 Oct 2024 11:54:11 +0100 Subject: [PATCH 3/3] ci: add netlify settings --- .github/workflows/publish-doc.yaml | 2 +- netlify.toml | 3 +++ requirements.txt | 3 +++ 3 files changed, 7 insertions(+), 1 deletion(-) create mode 100644 netlify.toml create mode 100644 requirements.txt diff --git a/.github/workflows/publish-doc.yaml b/.github/workflows/publish-doc.yaml index ba37fbd..4f9dded 100644 --- a/.github/workflows/publish-doc.yaml +++ b/.github/workflows/publish-doc.yaml @@ -27,5 +27,5 @@ jobs: path: .cache restore-keys: | mkdocs-material- - - run: pip install mkdocs-material pymdown-extensions mkdocs-macros-plugin + - run: pip install requirements.txt - run: mkdocs gh-deploy --force diff --git a/netlify.toml b/netlify.toml new file mode 100644 index 0000000..b94d3e2 --- /dev/null +++ b/netlify.toml @@ -0,0 +1,3 @@ +[build] + command = "mkdocs build" + publish = "site" \ No newline at end of file diff --git a/requirements.txt b/requirements.txt new file mode 100644 index 0000000..4bbc0cc --- /dev/null +++ b/requirements.txt @@ -0,0 +1,3 @@ +mkdocs-material +pymdown-extensions +mkdocs-macros-plugin \ No newline at end of file