Skip to content
Open
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
52 changes: 29 additions & 23 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Comment on lines +30 to +32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 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
# Restore the nx compilation cache for the latest commit to main.
# The subsequent 'npm run compile' should only need to compile changed packages.

- name: Compile Cache Lookup
uses: actions/cache/restore@v4
Copy link
Contributor

Choose a reason for hiding this comment

The 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"?
IIUC, the way it is now, that compile-cache-main will never start fresh. After a year, it will have a year of possible cruft in it, right? I realize that would mean doing a full clean npm run compile for pushes to main, but we'd still get the benefit of the cache for the more common updates to PRs.

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
Expand Down Expand Up @@ -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
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions packages/instrumentation-undici/src/undici.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ export class UndiciInstrumentation extends InstrumentationBase<UndiciInstrumenta

// No need to instrument files/modules
protected override init() {
// TODO: remove this after checking the compilatin step in test workflow
this._diag.debug('UndiciInstrumentation init');
return undefined;
}

Expand Down