Fix/checkpoint verification in CL STF #3641
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Run functional tests | |
on: | |
pull_request: | |
merge_group: | |
push: | |
branches: [main] | |
env: | |
CARGO_TERM_COLOR: always | |
permissions: {} | |
jobs: | |
lint: | |
name: Lint test files | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: "^3.10" # Keep in sync with `pyproject.toml` | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: functional-tests/.venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
working-directory: functional-tests | |
#if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' # this was giving issues in cache | |
run: poetry install --no-root --no-interaction | |
- name: Check formatting | |
working-directory: functional-tests | |
run: poetry run ruff format --check | |
- name: Lint | |
working-directory: functional-tests | |
run: poetry run ruff check | |
run: | |
name: Run functional tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Cleanup Space | |
uses: ./.github/actions/cleanup # zizmor: ignore[unpinned-uses] | |
- name: Install bitcoind | |
env: | |
BITCOIND_VERSION: "28.1" | |
BITCOIND_ARCH: "x86_64-linux-gnu" | |
SHASUM: "07f77afd326639145b9ba9562912b2ad2ccec47b8a305bd075b4f4cb127b7ed7" | |
run: | | |
curl -fsSLO --proto "=https" --tlsv1.2 "https://bitcoincore.org/bin/bitcoin-core-$BITCOIND_VERSION/bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz" | |
sha256sum -c <<< "$SHASUM bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz" | |
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 "bitcoin-$BITCOIND_VERSION" "bitcoin-$BITCOIND_VERSION-$BITCOIND_ARCH.tar.gz" | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
id: setup-python | |
with: | |
python-version: "^3.10" # Keep in sync with `pyproject.toml` | |
- name: Install poetry | |
uses: snok/install-poetry@v1 | |
with: | |
virtualenvs-create: true | |
virtualenvs-in-project: true | |
- name: Load cached venv | |
id: cached-poetry-dependencies | |
uses: actions/cache@v4 | |
with: | |
path: functional-tests/.venv | |
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }} | |
- name: Install dependencies | |
working-directory: functional-tests | |
#if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true' # this was giving issues in cache | |
run: poetry install --no-root --no-interaction | |
- name: Set up Rust | |
uses: dtolnay/rust-toolchain@nightly | |
with: | |
toolchain: nightly-2024-07-27 | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
cache-on-failure: true | |
- name: Build Cargo project | |
run: cargo build --locked -F debug-utils | |
- name: Run functional tests (1) | |
id: funcTestsRun1 | |
continue-on-error: true | |
env: | |
NO_COLOR: "1" | |
LOG_LEVEL: "info" | |
run: | | |
NEWPATH="$(realpath target/debug/)" | |
export PATH="${NEWPATH}:${PATH}" | |
which strata-client | |
cd functional-tests && poetry run python entry.py | |
# Run again just to be sure as some tests are flaky, with more logging | |
- name: Run functional tests (2) | |
id: funcTestsRun2 | |
if: steps.funcTestsRun1.outcome == 'failure' | |
continue-on-error: true | |
env: | |
RUST_LOG: "trace,hyper=warn,soketto=warn,jsonrpsee-server=warn,mio=warn" | |
NO_COLOR: "1" | |
RUST_BACKTRACE: "1" | |
LOG_LEVEL: "info" | |
run: | | |
NEWPATH="$(realpath target/debug/)" | |
export PATH="${NEWPATH}:${PATH}" | |
which strata-client | |
cd functional-tests && poetry run python entry.py | |
- name: Zip log files on failure | |
if: steps.funcTestsRun2.outcome == 'failure' | |
# Create a zip archive (logs.zip) that includes only service.log files, | |
# preserving the folder structure starting from functional-tests/_dd | |
# NOTE: Entire _dd ends up hundreds of MBs, so keep only logs (still huge...). | |
run: | | |
# service logs | |
find functional-tests/_dd -type f -name "service.log" | zip -@ logs.zip | |
# functional test logs | |
zip -r logs.zip functional-tests/_dd -i '*/logs/*.log' | |
- name: Upload logs as build artifact on failure | |
if: steps.funcTestsRun2.outcome == 'failure' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: fntest_dd | |
path: logs.zip | |
retention-days: 30 | |
if-no-files-found: error | |
compression-level: 0 # already compressed | |
- name: Fail job if functional tests fail | |
if: steps.funcTestsRun2.outcome == 'failure' | |
run: | | |
echo "Functional tests failed" | |
exit 1 | |
functional-tests-success: | |
name: Check that all checks pass | |
runs-on: ubuntu-latest | |
if: always() | |
needs: [lint, run] | |
timeout-minutes: 60 | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
with: | |
jobs: ${{ toJSON(needs) }} |