Skip to content

Commit 8d7c9e8

Browse files
committed
Use OFT run's exit code as job's exit code
Made sure that the job for checking up-spec compliance fails if either the tests fail or any of the relevant requirements from up-spec are not covered. This way we get an "early warning" if the current up-rust code base does not comply (yet) with upcoming changes in the spec.
1 parent 5edbda8 commit 8d7c9e8

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

.github/workflows/check-up-spec-compatibility.yaml

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,8 @@
1212
# *******************************************************************************/
1313

1414
# Verifies that this crate can be built using the uProtocol Core API from up-spec's main branch.
15-
# Also performs requirements tracing using OpenFastTrace. For that purpose, the workflow requires
16-
# the UP_SPEC_OPEN_FAST_TRACE_FILE_PATTERNS variable to contain the file patterns to use for
17-
# invoking the "run-oft" Action.
15+
# Also performs requirements tracing using OpenFastTrace. The job fails if any of the two
16+
# activities fail.
1817

1918
name: uP Spec Compatibility
2019

@@ -33,7 +32,7 @@ env:
3332
CARGO_TERM_COLOR: always
3433

3534
jobs:
36-
tests:
35+
up-spec-check:
3736
runs-on: ubuntu-latest
3837
steps:
3938
- uses: actions/checkout@v4
@@ -49,9 +48,10 @@ jobs:
4948
git status
5049
cd "${{ github.workspace }}"
5150
52-
# run OpenFastTrace first because OFT will always succeed and produce
51+
# run OpenFastTrace first because the action will always succeed and produce
5352
# a tracing report
5453
- name: Run OpenFastTrace
54+
id: run-oft
5555
uses: eclipse-uprotocol/ci-cd/.github/actions/run-oft@main
5656
with:
5757
file-patterns: "${{ vars.UP_SPEC_OPEN_FAST_TRACE_FILE_PATTERNS }} ${{ vars.UP_COMPONENT_OPEN_FAST_TRACE_FILE_PATTERNS }}"
@@ -70,3 +70,13 @@ jobs:
7070
cargo nextest run --all-features
7171
# but it cannot execute doc tests
7272
cargo test --doc --all-features
73+
74+
# This step will only be run if the tests in the previous step have succeeded.
75+
# In that case, we use the exit code produced by the OFT run as the job's
76+
# overall outcome. This means that the job fails if the tests run successfully
77+
# but some of the requirements from up-spec are not covered.
78+
- name: Determine exit status
79+
env:
80+
OFT_EXIT_CODE: ${{ steps.run-oft.outputs.oft-exit-code }}
81+
run: |
82+
exit $OFT_EXIT_CODE

0 commit comments

Comments
 (0)