added verify for untracked generated files
This commit is contained in:
24
.github/workflows/verify.yml
vendored
24
.github/workflows/verify.yml
vendored
@@ -22,7 +22,7 @@ jobs:
|
|||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
|
||||||
- name: Setup Rust, checkout and restore caches
|
- name: Setup Rust, checkout and restore caches
|
||||||
uses: ./.github/actions/setup-rust
|
uses: ./.github/actions/setup-rust
|
||||||
|
|
||||||
@@ -32,9 +32,9 @@ jobs:
|
|||||||
cargo run -- db:migrate_and_generate --output-path ../../public/database/src/generated/entities
|
cargo run -- db:migrate_and_generate --output-path ../../public/database/src/generated/entities
|
||||||
- name: Check for uncommitted changes in /generated/
|
- name: Check for uncommitted changes in /generated/
|
||||||
run: |
|
run: |
|
||||||
if [[ -n $(git status --porcelain | grep '^ M .*\/generated\/') ]]; then
|
if [[ -n $(git status --porcelain --untracked-files=all | grep '/generated/') ]]; then
|
||||||
echo "Generated code is not up to date. Please run the code generation locally and commit the changes."
|
echo "Generated code is not up to date. Please run the code generation locally and commit the changes."
|
||||||
git status --porcelain | grep '^ M .*\/generated\/'
|
git status --porcelain --untracked-files=all | grep '/generated/'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Generated code is up to date."
|
echo "Generated code is up to date."
|
||||||
@@ -131,7 +131,7 @@ jobs:
|
|||||||
- name: Setup Rust, checkout and restore caches
|
- name: Setup Rust, checkout and restore caches
|
||||||
if: steps.check_changes.outputs.changed == 'true'
|
if: steps.check_changes.outputs.changed == 'true'
|
||||||
uses: ./.github/actions/setup-rust
|
uses: ./.github/actions/setup-rust
|
||||||
|
|
||||||
- name: Generate dummy frontend build (to satisfy dependencies)
|
- name: Generate dummy frontend build (to satisfy dependencies)
|
||||||
if: steps.check_changes.outputs.changed == 'true'
|
if: steps.check_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
@@ -143,13 +143,13 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
cd apps/api
|
cd apps/api
|
||||||
cargo run -- generate:openapi --output-path ./swagger.json
|
cargo run -- generate:openapi --output-path ./swagger.json
|
||||||
|
|
||||||
- name: Check for uncommitted changes in swagger.json
|
- name: Check for uncommitted changes in swagger.json
|
||||||
if: steps.check_changes.outputs.changed == 'true'
|
if: steps.check_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
if [[ -n $(git status --porcelain | grep '^ M apps/api/swagger.json') ]]; then
|
if [[ -n $(git status --porcelain --untracked-files=all | grep 'apps/api/swagger.json') ]]; then
|
||||||
echo "OpenAPI spec is not up to date. Please run the OpenAPI generation locally and commit the changes."
|
echo "OpenAPI spec is not up to date. Please run the OpenAPI generation locally and commit the changes."
|
||||||
git status --porcelain | grep '^ M apps/api/swagger.json'
|
git status --porcelain --untracked-files=all | grep 'apps/api/swagger.json'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "OpenAPI spec is up to date."
|
echo "OpenAPI spec is up to date."
|
||||||
@@ -214,13 +214,13 @@ jobs:
|
|||||||
node-version: 22
|
node-version: 22
|
||||||
cache: 'pnpm'
|
cache: 'pnpm'
|
||||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
||||||
|
|
||||||
- name: Install frontend dependencies
|
- name: Install frontend dependencies
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
cd apps/frontend
|
cd apps/frontend
|
||||||
pnpm install
|
pnpm install
|
||||||
|
|
||||||
- name: Generate frontend API client
|
- name: Generate frontend API client
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
@@ -230,14 +230,14 @@ jobs:
|
|||||||
- name: Check for uncommitted changes in frontend API client
|
- name: Check for uncommitted changes in frontend API client
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||||
run: |
|
run: |
|
||||||
if [[ -n $(git status --porcelain | grep '^ M apps/frontend/app/generated/api-client') ]]; then
|
if [[ -n $(git status --porcelain --untracked-files=all | grep 'apps/frontend/app/generated/api-client') ]]; then
|
||||||
echo "Frontend API client is not up to date. Please run the API client generation locally and commit the changes."
|
echo "Frontend API client is not up to date. Please run the API client generation locally and commit the changes."
|
||||||
git status --porcelain | grep '^ M apps/frontend/app/generated/api-client'
|
git status --porcelain --untracked-files=all | grep 'apps/frontend/app/generated/api-client'
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
echo "Frontend API client is up to date."
|
echo "Frontend API client is up to date."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Skip frontend API client generation (no relevant changes)
|
- name: Skip frontend API client generation (no relevant changes)
|
||||||
if: steps.check_swagger_changes.outputs.changed == 'false'
|
if: steps.check_swagger_changes.outputs.changed == 'false'
|
||||||
run: echo "No changes in apps/api/swagger.json nor apps/frontend/app/generated/api-client, skipping frontend API client generation verification."
|
run: echo "No changes in apps/api/swagger.json nor apps/frontend/app/generated/api-client, skipping frontend API client generation verification."
|
||||||
Reference in New Issue
Block a user