-
Notifications
You must be signed in to change notification settings - Fork 23
ci: add reusable CI validation workflow and run it before releases #1032
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
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,168 @@ | ||
| name: CI Validation | ||
|
|
||
| on: | ||
| workflow_call: | ||
| pull_request: | ||
| types: | ||
| - opened | ||
| - reopened | ||
| - synchronize | ||
|
|
||
| # Restrict permissions to read-only since validation jobs only need to checkout | ||
| # and analyse the code. This limits the blast radius when called from workflows | ||
| # that have broader permissions (e.g., the release workflow). | ||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| prepare-workflow: | ||
| name: Prepare Workflow | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Prepare Node.js environment | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| cache: npm | ||
| node-version-file: .node-version | ||
|
|
||
| - name: Cache project 'node_modules' directory | ||
| id: node-modules-cache | ||
| uses: actions/cache@v5 | ||
| with: | ||
| key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version', 'patches/**') }} | ||
| path: node_modules/ | ||
|
|
||
| - name: Install project npm dependencies | ||
| if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }} | ||
| run: | | ||
| npm ci | ||
|
|
||
| static-code-analysis: | ||
| name: Static Code Analysis | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| needs: | ||
| - prepare-workflow | ||
|
|
||
| steps: | ||
| # Full history is needed for the React Compiler compatibility check, | ||
| # which diffs changed files against the base branch. | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 0 | ||
|
|
||
| - name: Prepare Node.js environment | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| cache: npm | ||
| node-version-file: .node-version | ||
|
|
||
| - name: Cache project 'node_modules' directory | ||
| id: node-modules-cache | ||
| uses: actions/cache@v5 | ||
| with: | ||
| key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version', 'patches/**') }} | ||
| path: node_modules/ | ||
|
|
||
| - name: Install project npm dependencies | ||
| if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }} | ||
| run: | | ||
| npm ci | ||
|
|
||
| - name: Analyse code quality with ESLint | ||
| run: | | ||
| npm run lint | ||
|
|
||
| - name: Perform type checking with TypeScript | ||
| run: | | ||
| npm run type-check | ||
|
|
||
| - name: Check React Compiler compatibility | ||
| if: ${{ github.event_name == 'pull_request' }} | ||
| run: | | ||
| CHANGED_FILES=$(git diff --name-only --diff-filter=ACMR origin/${{ github.base_ref }}...HEAD -- 'src/**/*.ts' 'src/**/*.tsx' 'src/**/*.js' 'src/**/*.jsx' | tr '\n' ' ') | ||
| if [ -n "$CHANGED_FILES" ]; then | ||
| echo "Checking React Compiler compatibility for: $CHANGED_FILES" | ||
| npx @doist/react-compiler-tracker --check-files $CHANGED_FILES | ||
| else | ||
| echo "No source files changed, skipping React Compiler check" | ||
| fi | ||
|
|
||
| unit-testing: | ||
| name: Unit Testing | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| needs: | ||
| - prepare-workflow | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Prepare Node.js environment | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| cache: npm | ||
| node-version-file: .node-version | ||
|
|
||
| - name: Cache project 'node_modules' directory | ||
| id: node-modules-cache | ||
| uses: actions/cache@v5 | ||
| with: | ||
| key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version', 'patches/**') }} | ||
| path: node_modules/ | ||
|
|
||
| - name: Install project npm dependencies | ||
| if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }} | ||
| run: | | ||
| npm ci | ||
|
|
||
| - name: Test codebase correctness | ||
| run: | | ||
| npm run test | ||
|
|
||
| build-package: | ||
| name: Build Package | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| needs: | ||
| - prepare-workflow | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| - name: Prepare Node.js environment | ||
| uses: actions/setup-node@v6 | ||
| with: | ||
| cache: npm | ||
| node-version-file: .node-version | ||
|
|
||
| - name: Cache project 'node_modules' directory | ||
| id: node-modules-cache | ||
| uses: actions/cache@v5 | ||
| with: | ||
| key: node-modules-cache-${{ hashFiles('**/package-lock.json', '**/.node-version', 'patches/**') }} | ||
| path: node_modules/ | ||
|
|
||
| - name: Install project npm dependencies | ||
| if: ${{ steps.node-modules-cache.outputs.cache-hit != 'true' }} | ||
| run: | | ||
| npm ci | ||
|
|
||
| - name: Build `@doist/reactist` package | ||
| run: | | ||
| npm run build | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.