-
Notifications
You must be signed in to change notification settings - Fork 10
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
Include lint and test jobs for node-ci-push workflow (using reusable workflow) #2348
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
eb0ecc4
copy lint and test jobs from node-ci-pr.yml so that checks can be en…
beaesguerra c4dea85
set up separate lint workflow and test with pr workflow
beaesguerra 85b247d
temporarily disable other pr checks for testing
beaesguerra 8695578
add printing message to see if new workflow was used
beaesguerra 979c839
fix error
beaesguerra 6e587b1
update name in reusable workflow
beaesguerra f8ac5aa
add reusable workflow for tests
beaesguerra fab8c6d
Revert "temporarily disable other pr checks for testing"
beaesguerra a0d1409
cleanup
beaesguerra bda10f0
use shared workflows for node-ci-push
beaesguerra 89c9872
remove coverage job since the test workflow covers it
beaesguerra 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 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,73 @@ | ||
# This reusable workflow is executed to run linting checks for the project | ||
name: Run lint for the project | ||
|
||
on: | ||
workflow_call: | ||
|
||
jobs: | ||
lint: | ||
name: Lint | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node-version: [20.x] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install & cache node_modules | ||
uses: Khan/actions@shared-node-cache-v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Get All Changed Files | ||
uses: Khan/actions@get-changed-files-v2 | ||
id: changed | ||
|
||
- id: js-ts-files | ||
name: Find .js, .ts changed files | ||
uses: Khan/actions@filter-files-v1 | ||
with: | ||
changed-files: ${{ steps.changed.outputs.files }} | ||
extensions: '.js,.jsx,.ts,.tsx' | ||
|
||
- id: eslint-reset | ||
uses: Khan/actions@filter-files-v1 | ||
name: Files that would trigger a full eslint run | ||
with: | ||
changed-files: ${{ steps.changed.outputs.files }} | ||
files: '.eslintrc.js,yarn.lock,.eslintignore' | ||
|
||
- id: typecheck-reset | ||
uses: Khan/actions@filter-files-v1 | ||
name: Files that would trigger a typecheck run | ||
with: | ||
changed-files: ${{ steps.changed.outputs.files }} | ||
files: '.yarn.lock' | ||
|
||
# Linting / type checking | ||
- name: Eslint | ||
uses: Khan/actions@full-or-limited-v0 | ||
with: | ||
full-trigger: ${{ steps.eslint-reset.outputs.filtered }} | ||
full: yarn lint:ci . | ||
limited-trigger: ${{ steps.js-ts-files.outputs.filtered }} | ||
limited: yarn lint:ci {} | ||
|
||
- name: Typecheck | ||
if: always() # always run this check until we update the eslint config | ||
# if: steps.js-ts-files.outputs.filtered != '[]' || steps.typecheck-reset.outputs.filtered != '[]' | ||
run: yarn typecheck | ||
|
||
- name: Build .js bundles | ||
run: yarn build | ||
|
||
- name: Build .d.ts types | ||
run: yarn build:types | ||
|
||
- name: Check package.json files | ||
run: node utils/publish/pre-publish-check-ci.js |
This file contains 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 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 |
---|---|---|
|
@@ -11,8 +11,9 @@ on: | |
# 1. Prime caches for primary configuration (ubuntu on node 14). | ||
# This way the next two jobs can run in parallel but rely on this primed | ||
# cache. | ||
# 2. Coverage | ||
# 3. Chromatic autoApprove on squash commits | ||
# 2. Lint | ||
# 3. Test (with coverage) | ||
# 4. Chromatic autoApprove on squash commits | ||
# | ||
# For pushes directly to a branch, we assume a PR has been used with wider | ||
# checks, this just makes sure our coverage data is up-to-date. | ||
|
@@ -35,36 +36,14 @@ jobs: | |
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
lint: | ||
name: Lint | ||
needs: prime_cache_primary | ||
uses: ./.github/workflows/node-ci-lint.yml | ||
|
||
coverage: | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This job can be removed since the Test workflow also gathers coverage! |
||
needs: [prime_cache_primary] | ||
name: Gather coverage | ||
env: | ||
CI: true | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
# Use a matrix as it means we get the version info in the job name | ||
# which is very helpful. | ||
os: [ubuntu-latest] | ||
node-version: [20.x] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
# Cache and install dependencies | ||
- name: Install & cache node_modules | ||
uses: Khan/actions@shared-node-cache-v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Run Jest with coverage | ||
run: yarn coverage:ci | ||
- name: Upload Coverage | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage/coverage-final.json | ||
test: | ||
name: Test | ||
needs: prime_cache_primary | ||
uses: ./.github/workflows/node-ci-test.yml | ||
secrets: | ||
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} |
This file contains 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,37 @@ | ||
# This reusable workflow is executed to run test checks for the project | ||
name: Run tests for the project | ||
|
||
on: | ||
workflow_call: | ||
secrets: | ||
CODECOV_TOKEN: | ||
required: true | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest] | ||
node-version: [20.x] | ||
shard: ["1/2", "2/2"] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install & cache node_modules | ||
uses: Khan/actions@shared-node-cache-v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
# Testing and coverage | ||
- name: Run jest tests with coverage | ||
run: yarn coverage:ci --shard ${{ matrix.shard }} | ||
- name: Upload Coverage | ||
uses: codecov/codecov-action@v4 | ||
with: | ||
token: ${{ secrets.CODECOV_TOKEN }} | ||
files: ./coverage/coverage-final.json |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here, we are able to pass tokens using secrets