11name : Functional tests
22
33on :
4+ workflow_call :
45 pull_request :
56 merge_group :
67 push :
1011 CARGO_TERM_COLOR : always
1112
1213concurrency :
13- group : ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
14+ group : functional-tests- ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
1415 cancel-in-progress : true
1516
1617permissions : {}
7677
7778 - name : Install Rust toolchain
7879 run : |
79- rustup toolchain install nightly --profile minimal
80+ rustup toolchain install nightly --profile minimal --component llvm-tools-preview
8081 rustup default nightly
8182
83+ - name : Install cargo-llvm-cov
84+ uses : taiki-e/install-action@81ecf985428d5c2ea81dbf079bceca32bc9604ab # v2.62.43
85+ with :
86+ tool : cargo-llvm-cov
87+
8288 - name : Rust cache
8389 uses : Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2
8490 with :
@@ -93,13 +99,47 @@ jobs:
9399 cache-suffix : " functional-tests"
94100 python-version : " 3.12"
95101
102+ - name : Build with coverage instrumentation
103+ run : |
104+ COV_TARGET_DIR="$GITHUB_WORKSPACE/target/llvm-cov-target"
105+ RUSTFLAGS="-Cinstrument-coverage" cargo build --locked --bin strata-asm-runner --target-dir "$COV_TARGET_DIR"
106+
96107 - name : Run functional tests
108+ id : funcTestsRun
109+ continue-on-error : true
97110 env :
98111 NO_COLOR : " 1"
99112 LOG_LEVEL : " info"
100113 run : |
114+ export LLVM_PROFILE_FILE="$GITHUB_WORKSPACE/target/llvm-cov-target/asm-%p-%m.profraw"
115+ NEWPATH="$GITHUB_WORKSPACE/target/llvm-cov-target/debug"
116+ export PATH="$NEWPATH:$PATH"
117+ export STRATA_ASM_RUNNER_BIN="$NEWPATH/strata-asm-runner"
101118 cd functional-tests
102- ./run_test.sh
119+ source ./env.bash
120+ uv run python entry.py
121+
122+ - name : Generate coverage lcov
123+ id : genFunctionalLcov
124+ continue-on-error : true
125+ run : |
126+ export CARGO_TARGET_DIR="$GITHUB_WORKSPACE/target"
127+ export LLVM_PROFILE_FILE="$GITHUB_WORKSPACE/target/llvm-cov-target/asm-%p-%m.profraw"
128+ cargo llvm-cov report --lcov > lcov.functional.info
129+
130+ - name : Upload coverage lcov artifact
131+ if : steps.genFunctionalLcov.outcome == 'success'
132+ continue-on-error : true
133+ uses : actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
134+ with :
135+ name : functional-lcov
136+ path : lcov.functional.info
137+
138+ - name : Fail job if functional tests fail
139+ if : steps.funcTestsRun.outcome == 'failure'
140+ run : |
141+ echo "Functional tests failed"
142+ exit 1
103143
104144 functional-success :
105145 name : Check that functional tests pass
0 commit comments