-
Notifications
You must be signed in to change notification settings - Fork 617
chore(ci): add compilation cache of main branch #3198
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
base: main
Are you sure you want to change the base?
Changes from all commits
a856514
e5bc26d
433e73a
69f68e0
7543da1
68ba7dd
cb448ca
5f17bcf
80fc46f
1bef6b6
9b112d0
43f9dda
25480cf
c1ad7ba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,25 +27,27 @@ jobs: | |
| node-version: 18 | ||
| - name: Install | ||
| run: npm ci --ignore-scripts | ||
| timeout-minutes: 10 | ||
| # Note: when pushing to main we want to test only what changed in | ||
| # last commit. Otherwise we want to test all changes from origin/main. | ||
| # So we set the right values for base and head commits depending | ||
| # on the type of event (PR or push) | ||
| # ref: https://nx.dev/ci/features/affected#configure-affected-on-ci | ||
| - name: Set base and head commits | ||
| run: | | ||
| if [ "${{github.event_name}}" == "push" ]; then | ||
| echo "NX_BASE=origin/main~1" >> "$GITHUB_ENV" | ||
| echo "NX_HEAD=origin/main" >> "$GITHUB_ENV" | ||
| else | ||
| echo "NX_BASE=origin/main" >> "$GITHUB_ENV" | ||
| echo "NX_HEAD=HEAD" >> "$GITHUB_ENV" | ||
| fi | ||
| - name: Compile (Delta) | ||
| run: npm run compile:ci:affected | ||
| - name: Upload Build Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| # Note: we restore the last compilation form main branch | ||
| # so NX will only compile what has changed since then. | ||
| # Cache action is used because can be restores from dfferen workfow runs | ||
| - name: Compile Cache Lookup | ||
| uses: actions/cache/restore@v4 | ||
|
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. Do we want to consider not using the cache for pushes to "main"? |
||
| with: | ||
| key: compile-cache-main | ||
| path: .nx | ||
| - name: Compile packages | ||
| run: npm run compile | ||
| # Note: update the compilation cache for main branch | ||
| - name: Compile Cache Update (Push) | ||
| if: ${{ github.event_name == 'push' }} | ||
| uses: actions/cache/save@v4 | ||
| with: | ||
| key: compile-cache-main | ||
| path: .nx | ||
| # Note: upload cache to be used in this worflow run | ||
| # by the unit-test and test-all-versions jobs | ||
| - name: Upload Compile Cache (PR) | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: compile-cache-${{ github.run_number }} | ||
| path: .nx | ||
|
|
@@ -205,7 +207,11 @@ jobs: | |
| with: | ||
| name: compile-cache-${{ github.run_number }} | ||
| path: .nx | ||
| # Note: see comment in the compile job | ||
| # Note: when pushing to main we want to test only what changed in | ||
| # last commit. Otherwise we want to test all changes from origin/main. | ||
| # So we set the right values for base and head commits depending | ||
| # on the type of event (PR or push) | ||
| # ref: https://nx.dev/ci/features/affected#configure-affected-on-ci | ||
| - name: Set base and head commits | ||
| run: | | ||
| if [ "${{github.event_name}}" == "push" ]; then | ||
|
|
@@ -220,7 +226,7 @@ jobs: | |
| - name: Unit tests (Browser - Delta) | ||
| if: ${{ matrix.node == '22' }} | ||
| run: npm run test:browser:ci:affected | ||
| - name: Unit tests (Nodejs - Delta) | ||
| - name: Unit tests (Node.js - Delta) | ||
| run: npm run test:ci:affected | ||
|
|
||
| test-all-versions: | ||
|
|
@@ -250,7 +256,7 @@ jobs: | |
| with: | ||
| name: compile-cache-${{ github.run_number }} | ||
| path: .nx | ||
| # Note: see comment in the compile job | ||
| # Note: see comment in the unit-test job | ||
| - name: Set base and head commits | ||
| run: | | ||
| if [ "${{github.event_name}}" == "push" ]; then | ||
|
|
@@ -265,7 +271,7 @@ jobs: | |
| - name: Test All Versions (Delta) | ||
| run: npm run test-all-versions:ci:affected | ||
| - name: Upload Test Artifacts | ||
| uses: actions/upload-artifact@v4 | ||
| uses: actions/upload-artifact@v5 | ||
| with: | ||
| name: tests-coverage-cache-${{ github.run_number }}-${{ matrix.node }} | ||
| include-hidden-files: true | ||
|
|
||
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.