Skip to content

Commit 3bf395b

Browse files
committed
Merge remote-tracking branch 'origin/main' into mael/pnpm-lockfile
2 parents 36b0e9c + defef18 commit 3bf395b

File tree

338 files changed

+31377
-3595
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

338 files changed

+31377
-3595
lines changed

.claude/skills/running-tests.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# Running Tests
2+
3+
## Prerequisites
4+
5+
Before running tests, you must build the release binaries:
6+
7+
```bash
8+
cargo build --release
9+
```
10+
11+
## Running Integration Tests
12+
13+
Use the following command to run integration tests:
14+
15+
```bash
16+
yarn test:integration <jest cli options>
17+
```
18+
19+
For example:
20+
- Run all tests: `yarn test:integration`
21+
- Run a specific test file: `yarn test:integration path/to/test.ts`
22+
- Run tests matching a pattern: `yarn test:integration -t "pattern"`
23+
- Run in watch mode: `yarn test:integration --watch`
24+
25+
## Reading spawn logs
26+
27+
You can access the logs of any Yarn command spawned within a test by adding the `JEST_LOG_SPAWNS=1` environment variable.
28+
29+
## Creating temporary projects
30+
31+
You can setup temporary projects by:
32+
33+
1. Creating a new temporary folder
34+
2. Adding an empty `package.json` file
35+
3. Running `yarn switch link path/to/target/Release/yarn-bin` inside this temporary folder
36+
4. Subsequent `yarn` commands should then use the local binary

.cursor/rules/tests.mdc

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
FROM ubuntu:24.04
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
RUN apt-get update \
6+
&& apt-get install -y --no-install-recommends \
7+
bash \
8+
ca-certificates \
9+
curl \
10+
git \
11+
jq \
12+
nodejs \
13+
npm \
14+
python3 \
15+
python-is-python3 \
16+
&& rm -rf /var/lib/apt/lists/*
17+
18+
COPY entrypoint.sh /entrypoint.sh
19+
RUN chmod +x /entrypoint.sh
20+
21+
ENTRYPOINT ["/entrypoint.sh"]
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Run E2E Sandbox
2+
description: Run an e2e shell test inside a Docker action sandbox and stream logs
3+
4+
inputs:
5+
test-name:
6+
description: E2E test name (filename without .sh extension)
7+
required: true
8+
log-file:
9+
description: Relative path to the log file to write in repository root
10+
required: true
11+
12+
outputs:
13+
exit-code:
14+
description: Exit code returned by the test script
15+
16+
runs:
17+
using: docker
18+
image: Dockerfile
19+
args:
20+
- ${{ inputs.test-name }}
21+
- ${{ inputs.log-file }}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
TEST_NAME="${1:-}"
5+
LOG_FILE="${2:-}"
6+
WORKSPACE="${GITHUB_WORKSPACE:-/github/workspace}"
7+
8+
if [[ -z "${TEST_NAME}" ]]; then
9+
echo "Missing required argument: test-name" >&2
10+
echo "exit-code=2" >> "${GITHUB_OUTPUT}"
11+
exit 0
12+
fi
13+
14+
if [[ -z "${LOG_FILE}" ]]; then
15+
echo "Missing required argument: log-file" >&2
16+
echo "exit-code=2" >> "${GITHUB_OUTPUT}"
17+
exit 0
18+
fi
19+
20+
if [[ "${LOG_FILE}" != /* ]]; then
21+
LOG_FILE="${WORKSPACE}/${LOG_FILE}"
22+
fi
23+
24+
mkdir -p "$(dirname "${LOG_FILE}")"
25+
export HOME="${HOME:-/tmp/e2e-home}"
26+
mkdir -p "${HOME}"
27+
28+
cd "${WORKSPACE}"
29+
chmod +x "${WORKSPACE}/tests/e2e/${TEST_NAME}.sh"
30+
31+
set +e
32+
bash "${WORKSPACE}/scripts/e2e/run.sh" "${TEST_NAME}" 2>&1 | tee "${LOG_FILE}"
33+
exit_code=${PIPESTATUS[0]}
34+
set -e
35+
36+
echo "exit-code=${exit_code}" >> "${GITHUB_OUTPUT}"
37+
exit 0

.github/workflows/build.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@ name: Build
33
on:
44
push:
55
branches: [main]
6+
paths-ignore:
7+
- 'documentation/**'
8+
- 'README.md'
69
pull_request:
710
branches: [main]
11+
paths-ignore:
12+
- 'documentation/**'
13+
- 'README.md'
814

915
env:
1016
CARGO_TERM_COLOR: always
@@ -98,7 +104,11 @@ jobs:
98104

99105
- name: Generate the test report
100106
run: |
107+
chmod +x artifacts/{yarn,yarn-bin}
108+
101109
export TEST_BINARY=$(pwd)/artifacts/yarn-bin
110+
export TEST_SWITCH_BINARY=$(pwd)/artifacts/yarn
111+
102112
yarn ./tests/acceptance-tests jest --json --outputFile=$(pwd)/report.json || true
103113
104114
- name: Upload test report

.github/workflows/e2e.yml

Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
name: E2E
2+
3+
on:
4+
push:
5+
branches: [main]
6+
pull_request:
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
CARGO_TERM_COLOR: always
14+
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
15+
16+
jobs:
17+
discover-e2e:
18+
name: Discover E2E tests
19+
runs-on: ubuntu-latest
20+
outputs:
21+
tests: ${{ steps.discover.outputs.tests }}
22+
23+
steps:
24+
- name: Checkout the repo
25+
uses: actions/checkout@v4
26+
with:
27+
persist-credentials: false
28+
29+
- name: Build matrix data
30+
id: discover
31+
shell: bash
32+
run: |
33+
set -euo pipefail
34+
35+
mapfile -t tests < <(find tests/e2e -maxdepth 1 -type f -name '*.sh' | sort)
36+
if [[ "${#tests[@]}" -eq 0 ]]; then
37+
echo "No e2e tests found" >&2
38+
exit 1
39+
fi
40+
41+
matrix_json="$(printf '%s\n' "${tests[@]}" | jq -R -s -c 'split("\n")[:-1]')"
42+
echo "tests=${matrix_json}" >> "$GITHUB_OUTPUT"
43+
echo "Discovered e2e tests: ${matrix_json}"
44+
45+
build-e2e-binary:
46+
name: Build e2e binary
47+
runs-on: ubuntu-latest
48+
needs: [discover-e2e]
49+
50+
steps:
51+
- name: Checkout the repo
52+
uses: actions/checkout@v4
53+
with:
54+
persist-credentials: false
55+
56+
- name: Rust cache
57+
uses: Swatinem/rust-cache@98c8021b550208e191a6a3145459bfc9fb29c4c0 # v2.8.0
58+
with:
59+
shared-key: e2e-linux-release
60+
61+
- name: Build yarn-bin
62+
shell: bash
63+
run: |
64+
set -euo pipefail
65+
cargo build -r -p zpm
66+
tar -czf e2e-binary-yarn-bin.tgz -C target/release yarn-bin
67+
68+
- name: Upload e2e binary
69+
uses: actions/upload-artifact@v4
70+
with:
71+
name: e2e-binary-yarn-bin
72+
path: e2e-binary-yarn-bin.tgz
73+
74+
run-e2e:
75+
name: Run ${{ matrix.test }}
76+
runs-on: ubuntu-latest
77+
needs: [discover-e2e, build-e2e-binary]
78+
strategy:
79+
fail-fast: false
80+
matrix:
81+
test: ${{ fromJson(needs.discover-e2e.outputs.tests) }}
82+
83+
steps:
84+
- name: Checkout the repo
85+
uses: actions/checkout@v4
86+
with:
87+
persist-credentials: false
88+
89+
- name: Download e2e binary
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: e2e-binary-yarn-bin
93+
path: .
94+
95+
- name: Extract e2e binary
96+
shell: bash
97+
run: |
98+
set -euo pipefail
99+
mkdir -p target/release
100+
tar -xzf e2e-binary-yarn-bin.tgz -C target/release
101+
102+
- name: Resolve test metadata
103+
id: meta
104+
shell: bash
105+
run: |
106+
set -euo pipefail
107+
test_name="$(basename "${{ matrix.test }}" .sh)"
108+
echo "test_name=${test_name}" >> "$GITHUB_OUTPUT"
109+
110+
- name: Prepare e2e artifact paths
111+
id: artifact-paths
112+
shell: bash
113+
env:
114+
TEST_SCRIPT: ${{ matrix.test }}
115+
TEST_NAME: ${{ steps.meta.outputs.test_name }}
116+
run: |
117+
set -euo pipefail
118+
artifact_dir="e2e-artifacts/${TEST_NAME}"
119+
log_file="${artifact_dir}/run.log"
120+
status_file="${artifact_dir}/status.json"
121+
mkdir -p "${artifact_dir}"
122+
123+
echo "artifact_dir=${artifact_dir}" >> "$GITHUB_OUTPUT"
124+
echo "log_file=${log_file}" >> "$GITHUB_OUTPUT"
125+
echo "status_file=${status_file}" >> "$GITHUB_OUTPUT"
126+
127+
- name: Run test in Docker sandbox action
128+
id: run-in-sandbox
129+
uses: ./.github/actions/run-e2e-sandbox
130+
with:
131+
test-name: ${{ steps.meta.outputs.test_name }}
132+
log-file: ${{ steps.artifact-paths.outputs.log_file }}
133+
134+
- name: Write test status
135+
id: write-status
136+
shell: bash
137+
env:
138+
TEST_SCRIPT: ${{ matrix.test }}
139+
STATUS_FILE: ${{ steps.artifact-paths.outputs.status_file }}
140+
EXIT_CODE: ${{ steps.run-in-sandbox.outputs.exit-code || '1' }}
141+
run: |
142+
set -euo pipefail
143+
jq -n \
144+
--arg test "${TEST_SCRIPT}" \
145+
--argjson exitCode "${EXIT_CODE}" \
146+
'{test:$test, exitCode:$exitCode}' > "${STATUS_FILE}"
147+
148+
- name: Fail job if test failed
149+
if: ${{ steps.run-in-sandbox.outputs.exit-code != '0' }}
150+
shell: bash
151+
run: |
152+
set -euo pipefail
153+
exit 1
154+
155+
- name: Upload e2e logs and status
156+
if: always()
157+
uses: actions/upload-artifact@v4
158+
with:
159+
name: e2e-result-${{ steps.meta.outputs.test_name }}
160+
path: e2e-artifacts/${{ steps.meta.outputs.test_name }}
161+
if-no-files-found: warn
162+
163+
report-e2e-failures:
164+
name: Report e2e failures
165+
runs-on: ubuntu-latest
166+
needs: [run-e2e]
167+
if: always() && github.ref == 'refs/heads/main'
168+
permissions:
169+
contents: read
170+
issues: write
171+
172+
steps:
173+
- name: Checkout the repo
174+
uses: actions/checkout@v4
175+
176+
- name: Setup Node.js
177+
uses: actions/setup-node@v4
178+
with:
179+
node-version: 22
180+
181+
- name: Download e2e result artifacts
182+
continue-on-error: true
183+
uses: actions/download-artifact@v4
184+
with:
185+
path: e2e-artifacts
186+
pattern: e2e-result-*
187+
merge-multiple: false
188+
189+
- name: Create or update GitHub issues for failing tests
190+
env:
191+
E2E_ARTIFACTS_DIR: e2e-artifacts
192+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
193+
shell: bash
194+
run: |
195+
yarn node --experimental-strip-types scripts/e2e/report-failures.ts

0 commit comments

Comments
 (0)