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
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
|
||||
- name: Setup Rust, checkout and restore caches
|
||||
uses: ./.github/actions/setup-rust
|
||||
|
||||
@@ -32,9 +32,9 @@ jobs:
|
||||
cargo run -- db:migrate_and_generate --output-path ../../public/database/src/generated/entities
|
||||
- name: Check for uncommitted changes in /generated/
|
||||
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."
|
||||
git status --porcelain | grep '^ M .*\/generated\/'
|
||||
git status --porcelain --untracked-files=all | grep '/generated/'
|
||||
exit 1
|
||||
else
|
||||
echo "Generated code is up to date."
|
||||
@@ -131,7 +131,7 @@ jobs:
|
||||
- name: Setup Rust, checkout and restore caches
|
||||
if: steps.check_changes.outputs.changed == 'true'
|
||||
uses: ./.github/actions/setup-rust
|
||||
|
||||
|
||||
- name: Generate dummy frontend build (to satisfy dependencies)
|
||||
if: steps.check_changes.outputs.changed == 'true'
|
||||
run: |
|
||||
@@ -143,13 +143,13 @@ jobs:
|
||||
run: |
|
||||
cd apps/api
|
||||
cargo run -- generate:openapi --output-path ./swagger.json
|
||||
|
||||
|
||||
- name: Check for uncommitted changes in swagger.json
|
||||
if: steps.check_changes.outputs.changed == 'true'
|
||||
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."
|
||||
git status --porcelain | grep '^ M apps/api/swagger.json'
|
||||
git status --porcelain --untracked-files=all | grep 'apps/api/swagger.json'
|
||||
exit 1
|
||||
else
|
||||
echo "OpenAPI spec is up to date."
|
||||
@@ -214,13 +214,13 @@ jobs:
|
||||
node-version: 22
|
||||
cache: 'pnpm'
|
||||
cache-dependency-path: apps/frontend/pnpm-lock.yaml
|
||||
|
||||
|
||||
- name: Install frontend dependencies
|
||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||
run: |
|
||||
cd apps/frontend
|
||||
pnpm install
|
||||
|
||||
|
||||
- name: Generate frontend API client
|
||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||
run: |
|
||||
@@ -230,14 +230,14 @@ jobs:
|
||||
- name: Check for uncommitted changes in frontend API client
|
||||
if: steps.check_swagger_changes.outputs.changed == 'true'
|
||||
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."
|
||||
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
|
||||
else
|
||||
echo "Frontend API client is up to date."
|
||||
fi
|
||||
|
||||
|
||||
- name: Skip frontend API client generation (no relevant changes)
|
||||
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."
|
||||
Reference in New Issue
Block a user