-
Notifications
You must be signed in to change notification settings - Fork 0
156 lines (135 loc) · 4.96 KB
/
functional.yml
File metadata and controls
156 lines (135 loc) · 4.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
name: Functional tests
on:
workflow_call:
pull_request:
merge_group:
push:
branches: [main]
env:
CARGO_TERM_COLOR: always
concurrency:
group: functional-tests-${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: {}
jobs:
lint:
name: Lint functional test files
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
with:
persist-credentials: false
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
working-directory: functional-tests
activate-environment: true
enable-cache: true
cache-suffix: "functional-tests"
python-version: "3.12"
- name: Check formatting
working-directory: functional-tests
run: uv run ruff format --check
- name: Check types
working-directory: functional-tests
run: uv run ty check
- name: Lint
working-directory: functional-tests
run: uv run ruff check
run:
name: Run functional tests
runs-on: ubuntu-latest
timeout-minutes: 60
permissions:
contents: read
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v4
with:
persist-credentials: false
- name: Install bitcoind
env:
BITCOIND_VERSION: "30.2"
BITCOIND_ARCH: "x86_64-linux-gnu"
run: |
curl -fsSLO --proto "=https" --tlsv1.3 "https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz"
curl -fsSLO --proto "=https" --tlsv1.3 "https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/SHA256SUMS"
sha256sum --ignore-missing --check SHA256SUMS
tar xzf "bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz"
sudo install -m 0755 -t /usr/local/bin bitcoin-"$BITCOIND_VERSION"/bin/*
bitcoind --version
rm -rf SHA256SUMS "bitcoin-$BITCOIND_VERSION" "bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz"
- name: Install Rust toolchain
run: |
rustup toolchain install nightly --profile minimal --component llvm-tools-preview
rustup default nightly
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@81ecf985428d5c2ea81dbf079bceca32bc9604ab # v2.62.43
with:
tool: cargo-llvm-cov
- name: Rust cache
uses: Swatinem/rust-cache@c19371144df3bb44fab255c43d04cbc2ab54d1c4 # v2
with:
cache-on-failure: true
- name: Install uv
uses: astral-sh/setup-uv@eac588ad8def6316056a12d4907a9d4d84ff7a3b # v7.3.0
with:
working-directory: functional-tests
activate-environment: true
enable-cache: true
cache-suffix: "functional-tests"
python-version: "3.12"
- name: Build with coverage instrumentation
run: |
COV_TARGET_DIR="$GITHUB_WORKSPACE/target/llvm-cov-target"
RUSTFLAGS="-Cinstrument-coverage" cargo build --locked --bin strata-asm-runner --target-dir "$COV_TARGET_DIR"
- name: Run functional tests
id: funcTestsRun
continue-on-error: true
env:
NO_COLOR: "1"
LOG_LEVEL: "info"
run: |
export LLVM_PROFILE_FILE="$GITHUB_WORKSPACE/target/llvm-cov-target/asm-%p-%m.profraw"
NEWPATH="$GITHUB_WORKSPACE/target/llvm-cov-target/debug"
export PATH="$NEWPATH:$PATH"
export STRATA_ASM_RUNNER_BIN="$NEWPATH/strata-asm-runner"
cd functional-tests
source ./env.bash
uv run python entry.py
- name: Generate coverage lcov
id: genFunctionalLcov
continue-on-error: true
run: |
export CARGO_TARGET_DIR="$GITHUB_WORKSPACE/target"
export LLVM_PROFILE_FILE="$GITHUB_WORKSPACE/target/llvm-cov-target/asm-%p-%m.profraw"
cargo llvm-cov report --lcov > lcov.functional.info
- name: Upload coverage lcov artifact
if: steps.genFunctionalLcov.outcome == 'success'
continue-on-error: true
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: functional-lcov
path: lcov.functional.info
- name: Fail job if functional tests fail
if: steps.funcTestsRun.outcome == 'failure'
run: |
echo "Functional tests failed"
exit 1
functional-success:
name: Check that functional tests pass
runs-on: ubuntu-latest
if: always()
needs:
- lint
- run
timeout-minutes: 30
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}