Skip to content

Commit c82f231

Browse files
authored
Enable dynamically skipping tests in JUnit XML reports (#7925)
* Add an example failing test * Rely on TAB to determine if tests should block merge * Revert "Add an example failing test" This reverts commit 4d484a5.
1 parent cebc183 commit c82f231

File tree

2 files changed

+22
-18
lines changed

2 files changed

+22
-18
lines changed

.github/ci-cd-scripts/upload-results.sh

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,17 @@
22
set -euo pipefail
33

44
if [ -z "${TAB_API_URL:-}" ] || [ -z "${TAB_API_KEY:-}" ]; then
5+
echo "WARNING: TAB_API_URL and TAB_API_KEY must be set to analyze results"
6+
grep --quiet 'failures="0"' test-results/junit.xml
57
exit 0
68
fi
79

8-
project="https://github.com/KittyCAD/modeling-app"
10+
project="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}"
911
suite="${CI_SUITE:-unit}"
1012
branch="${GITHUB_HEAD_REF:-${GITHUB_REF_NAME:-}}"
1113
commit="${CI_COMMIT_SHA:-${GITHUB_SHA:-}}"
1214

13-
echo "Uploading batch results"
15+
echo "Uploading batch results:"
1416
curl --silent --request POST \
1517
--header "X-API-Key: ${TAB_API_KEY}" \
1618
--form "project=${project}" \
@@ -29,10 +31,11 @@ curl --silent --request POST \
2931
--form "GITHUB_SHA=${GITHUB_SHA:-}" \
3032
--form "GITHUB_WORKFLOW=${GITHUB_WORKFLOW:-}" \
3133
--form "RUNNER_ARCH=${RUNNER_ARCH:-}" \
32-
${TAB_API_URL}/api/results/bulk
34+
${TAB_API_URL}/api/results/bulk > test-results/tab.json
35+
cat test-results/tab.json
3336

3437
echo
35-
echo "Sharing updated report"
38+
echo "Sharing updated report:"
3639
curl --silent --request POST \
3740
--header "Content-Type: application/json" \
3841
--header "X-API-Key: ${TAB_API_KEY}" \
@@ -42,3 +45,6 @@ curl --silent --request POST \
4245
\"commit\": \"${commit}\"
4346
}" \
4447
${TAB_API_URL}/api/share
48+
echo
49+
50+
grep --quiet '"block": false' test-results/tab.json

.github/workflows/cargo-test.yml

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,9 @@ jobs:
8787
set -euo pipefail
8888
cd rust
8989
cargo nextest run \
90-
--workspace --features=artifact-graph --retries=10 --no-fail-fast --profile=ci \
91-
simulation_tests::kcl_samples \
92-
2>&1 | tee /tmp/github-actions.log
90+
--workspace --features=artifact-graph --retries=10 --no-fail-fast --profile=ci \
91+
simulation_tests::kcl_samples \
92+
2>&1 | tee /tmp/github-actions.log
9393
env:
9494
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN_DEV}}
9595
ZOO_HOST: https://api.dev.zoo.dev
@@ -178,19 +178,17 @@ jobs:
178178
shell: bash
179179
run: |-
180180
cp nextest-archive.tar.zst rust/nextest-archive.tar.zst
181-
cd rust
181+
pushd rust
182182
cargo nextest run \
183-
--retries=10 --no-fail-fast --profile=ci --archive-file nextest-archive.tar.zst \
184-
--partition count:${{ matrix.partitionIndex}}/${{ matrix.partitionTotal }} \
185-
2>&1 | tee /tmp/github-actions.log
183+
--retries=10 --no-fail-fast --profile=ci --archive-file nextest-archive.tar.zst \
184+
--partition count:${{ matrix.partitionIndex}}/${{ matrix.partitionTotal }} \
185+
2>&1 | tee /tmp/github-actions.log || true # let TAB determine failure
186+
popd
187+
.github/ci-cd-scripts/upload-results.sh
186188
env:
187189
KITTYCAD_API_TOKEN: ${{secrets.KITTYCAD_API_TOKEN_DEV}}
188190
ZOO_HOST: https://api.dev.zoo.dev
189191
RUST_MIN_STACK: 10485760000
190-
- name: Upload results
191-
if: always()
192-
run: .github/ci-cd-scripts/upload-results.sh
193-
env:
194192
TAB_API_URL: ${{ secrets.TAB_API_URL }}
195193
TAB_API_KEY: ${{ secrets.TAB_API_KEY }}
196194
CI_COMMIT_SHA: ${{ github.event.pull_request.head.sha }}
@@ -231,9 +229,9 @@ jobs:
231229
run: |-
232230
cd rust/kcl-lib
233231
cargo nextest run \
234-
--retries=10 --no-fail-fast --features=artifact-graph --profile=ci \
235-
internal \
236-
2>&1 | tee /tmp/github-actions.log
232+
--retries=10 --no-fail-fast --features=artifact-graph --profile=ci \
233+
internal \
234+
2>&1 | tee /tmp/github-actions.log
237235
env:
238236
TWENTY_TWENTY: overwrite
239237
INSTA_UPDATE: always

0 commit comments

Comments
 (0)