Skip to content
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

fix: ensure generated type linting occurs on server changes #2629

Merged
merged 13 commits into from
Jan 31, 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
18 changes: 0 additions & 18 deletions .github/workflows/lint-client.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ jobs:
node-version: 20.10.0
cache: 'yarn'

- name: Setup Java v17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: gradle

- name: Install packages
run: yarn install --immutable

Expand All @@ -51,14 +44,3 @@ jobs:

- name: Run Typechecks
run: yarn typecheck

- name: Check Generated Types
run: |
./gradlew generateTypeScript

MODIFIED_FILES=`git status -s | grep "Types.ts" | wc -l`
if (( MODIFIED_FILES > 0 )); then
echo "Error! Generated file Types.ts must be generated and committed"
git status -s
fi
exit $MODIFIED_FILES
40 changes: 40 additions & 0 deletions .github/workflows/lint-types.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Lint Generated Types
on:
workflow_call:
push:
paths:
- 'packages/client/hmi-client/src/types/Types.ts'
- 'packages/server/**'
branches: ['main']
pull_request:
paths:
- 'packages/client/hmi-client/src/types/Types.ts'
- 'packages/server/**'
branches: ['main']
jobs:
lintTypes:
name: Lint Generated Types
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3

# Debugging purposes to verify branch being worked on
- run: git branch

- name: Setup Java v17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: 17
cache: gradle

- name: Check Generated Types
run: |
./gradlew generateTypeScript

MODIFIED_FILES=`git status -s | grep "Types.ts" | wc -l`
if (( MODIFIED_FILES > 0 )); then
echo "Error! Generated file Types.ts must be generated and committed"
git status -s
exit 1
fi
3 changes: 3 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ jobs:
lint:
uses: ./.github/workflows/lint.yaml

lint-types:
uses: ./.github/workflows/lint-types.yaml

# Lint Client Code
lint-client:
uses: ./.github/workflows/lint-client.yaml
Expand Down
Loading