Skip to content

Add generate-all make target #2122

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 20, 2024
Merged
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
34 changes: 17 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,8 @@ jobs:
run: go mod tidy && git diff --exit-code -- go.mod go.sum
working-directory: tests

- name: Check if generated go files are up to date
run: make generate && git diff --exit-code

- name: Check if generated CRDs and types are up to date
run: make generate-crds && git diff --exit-code

- name: Check if generated manifests are up to date
run: make generate-manifests && git diff --exit-code

- name: Check if helm docs are up to date
run: make helm-docs && git diff --exit-code

- name: Check if API docs are up to date
run: make generate-api-docs && git diff --exit-code
- name: Check if all the generated files are up to date
run: make generate-all && git diff --exit-code

unit-tests:
name: Unit Tests
Expand Down Expand Up @@ -230,7 +218,11 @@ jobs:
fail-fast: false
matrix:
image: [nginx, plus]
k8s-version: ["${{ needs.vars.outputs.min_k8s_version }}", "${{ needs.vars.outputs.k8s_latest }}"]
k8s-version:
[
"${{ needs.vars.outputs.min_k8s_version }}",
"${{ needs.vars.outputs.k8s_latest }}",
]
uses: ./.github/workflows/functional.yml
with:
image: ${{ matrix.image }}
Expand All @@ -245,7 +237,11 @@ jobs:
fail-fast: false
matrix:
image: [nginx, plus]
k8s-version: ["${{ needs.vars.outputs.min_k8s_version }}", "${{ needs.vars.outputs.k8s_latest }}"]
k8s-version:
[
"${{ needs.vars.outputs.min_k8s_version }}",
"${{ needs.vars.outputs.k8s_latest }}",
]
enable-experimental: [true, false]
uses: ./.github/workflows/conformance.yml
with:
Expand All @@ -262,7 +258,11 @@ jobs:
fail-fast: false
matrix:
image: [nginx, plus]
k8s-version: ["${{ needs.vars.outputs.min_k8s_version }}", "${{ needs.vars.outputs.k8s_latest }}"]
k8s-version:
[
"${{ needs.vars.outputs.min_k8s_version }}",
"${{ needs.vars.outputs.k8s_latest }}",
]
uses: ./.github/workflows/helm.yml
with:
image: ${{ matrix.image }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/release-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,15 @@ jobs:
include: "charts/nginx-gateway-fabric/*.yaml"
regex: false

- name: Generate manifests and changelog
- name: Generate files and changelog
run: |
sed -i -e "s/v${{ steps.vars.outputs.current_version }}/v${{ inputs.version }}/g" README.md
sed -i -e "s/\[${{ steps.vars.outputs.current_version }}\]/\[${{ inputs.version }}\]/g" README.md
sed -i -e "s/VERSION = edge/VERSION = ${{ inputs.version }}/g" Makefile
sed -i "6r .github/CHANGELOG_TEMPLATE.md" CHANGELOG.md
sed -i -e "s/%%VERSION%%/${{ inputs.version }}/g" CHANGELOG.md
sed -i "8a ${{ join(fromJson(steps.notes.outputs.release-sections).release-notes, '\n') }}\n" CHANGELOG.md
make generate-manifests
make generate-all

- name: Create Pull Request
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ generate-manifests: ## Generate manifests using Helm.
generate-api-docs: ## Generate API docs
go run github.com/ahmetb/gen-crd-api-reference-docs -config site/config/api/config.json -template-dir site/config/api -out-file site/content/reference/api.md -api-dir "github.com/nginxinc/nginx-gateway-fabric/apis"

.PHONY: generate-helm-docs
generate-helm-docs: ## Generate the Helm chart documentation
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric jnorwood/helm-docs:latest --chart-search-root=charts --template-files _templates.gotmpl --template-files README.md.gotmpl

.PHONY: generate-all
generate-all: generate generate-crds generate-manifests generate-api-docs generate-helm-docs ## Generate all the necessary files

.PHONY: clean
clean: ## Clean the build
-rm -r $(OUT_DIR)
Expand Down Expand Up @@ -202,10 +209,6 @@ njs-unit-test: ## Run unit tests for the njs httpmatches module
lint-helm: ## Run the helm chart linter
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric quay.io/helmpack/chart-testing:latest ct lint --config .ct.yaml

.PHONY: helm-docs
helm-docs: ## Generate the Helm chart documentation
docker run --pull always --rm -v $(CURDIR):/nginx-gateway-fabric -w /nginx-gateway-fabric jnorwood/helm-docs:latest --chart-search-root=charts --template-files _templates.gotmpl --template-files README.md.gotmpl

.PHONY: load-images
load-images: ## Load NGF and NGINX images on configured kind cluster.
kind load docker-image $(PREFIX):$(TAG) $(NGINX_PREFIX):$(TAG)
Expand Down
18 changes: 4 additions & 14 deletions docs/developer/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,10 @@ Run the following make command from the project's root directory to lint the Hel
make lint-helm
```

## Run Code Generation
## Update all the generated files

To ensure all the generated code is up to date, run the following make command from the project's root directory:
To update all the generated files, run the following make command from the project's root directory:

```shell
make generate
```

That command also will generate the avro scheme (`.avdl`) for product telemetry data points.

## Update Generated Manifests

To update the generated manifests, run the following make command from the project's root directory:

```shell
make generate-manifests
```makefile
make generate-all
```
Loading