Skip to content

bench ft

bench ft #11507

Workflow file for this run

name: CI Nayduck tests
on:
pull_request:
merge_group:
workflow_dispatch:
inputs:
neard-branch:
default: "master"
description: "nearcore git reference to test (branch-name or `refs/pull/$PR_NUMBER/head` or a commit hash)"
type: string
required: true
env:
CI_HACKS: 1
jobs:
nayduck_tests:
name: "Run Nayduck CI tests"
runs-on: ubuntu-latest
environment: development
timeout-minutes: 60
if: github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
steps:
- name: Install JQ json processor
run: sudo apt install jq
- name: Checkout nearcore repository
if: github.event_name != 'workflow_dispatch'
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Checkout nearcore repository for workflow dispatch
if: github.event_name == 'workflow_dispatch'
uses: actions/checkout@v4
with:
ref: ${{github.event.inputs.neard-branch}}
persist-credentials: false
- name: Install required python modules
run: |
pip3 install -r ./pytest/requirements.txt
- name: Create nayduck-code file
run: |
echo ${{ secrets.NAYDUCK_CODE }} > ~/.config/nayduck-code
- name: Run Nayduck tests and wait for results
id: nayduck_run
run: |
NEW_TEST=$(python3 ./scripts/nayduck.py --test-file nightly/ci.txt)
RUN_ID="$(echo $NEW_TEST | grep https | sed -E 's|.*\/run\/([0-9]+)|\1|' | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g')"
echo "nayduck_run_id=$RUN_ID" >> $GITHUB_OUTPUT
sleep 10
# wait all the tests to finish
while true; do
TEST_RESULTS=$(curl -s https://nayduck.nearone.org/api/run/$RUN_ID)
TESTS_FAILED=$(jq '.tests | .[] | select(.status == "FAILED") ' <<< ${TEST_RESULTS} )
if [ -n "$TESTS_FAILED" ]; then break; fi
TESTS_NOT_READY=$(jq '.tests | .[] | select(.status == "RUNNING" or .status == "PENDING") ' <<< ${TEST_RESULTS} )
if [ -z "$TESTS_NOT_READY" ]; then break; fi
echo "Tests are not ready yet. Sleeping 1 minute..."
sleep 60
done
UNSUCCESSFUL_TESTS=$(jq '.tests | .[] | select(.status != "PASSED" and .status != "IGNORED") ' <<< ${TEST_RESULTS} )
if [ -z "$UNSUCCESSFUL_TESTS" ]; then
echo "Nayduck CI tests passed."
echo "Results available at https://nayduck.nearone.org/#/run/$RUN_ID"
else
echo "CI Nayduck tests are failing https://nayduck.nearone.org/#/run/$RUN_ID."
echo "Fix them before merging"
exit 1
fi
- name: Cleanup Nayduck tests on cancel
if: cancelled()
run: |
python3 ./scripts/nayduck.py -c ${STEPS_NAYDUCK_RUN_OUTPUTS_NAYDUCK_RUN_ID}
env:
STEPS_NAYDUCK_RUN_OUTPUTS_NAYDUCK_RUN_ID: ${{ steps.nayduck_run.outputs.nayduck_run_id }}
pytest_tests:
name: "Large pytest Tests"
runs-on: warp-ubuntu-2204-x64-8x
if: github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: WarpBuilds/setup-python@v5
with:
python-version: 3.11
cache: pip
- uses: taiki-e/install-action@7852930e42e73b6c323ae4435f5135b58754dfdd
with:
tool: cargo-llvm-cov
- run: pip3 install --user -r pytest/requirements.txt
- run: cargo llvm-cov show-env | grep -v RUSTFLAGS | tr -d "'" >> "$GITHUB_ENV"
- run: echo "RUSTC_WORKSPACE_WRAPPER=$PWD/scripts/coverage-wrapper-rustc" >> "$GITHUB_ENV"
- run: echo "CARGO=1" >> "$GITHUB_ENV"
- run: cargo build --locked --profile dev-release -p neard --bin neard
- run: echo "CURRENT_NEARD=$PWD/target/dev-release/neard" >> "$GITHUB_ENV"
- run: echo "NEAR_ROOT=$PWD" >> "$GITHUB_ENV"
- run: pushd pytest && python3 tests/sanity/upgradable.py && popd
- run: pushd pytest && python3 tests/sanity/db_migration.py && popd
- run: pushd pytest && python3 tests/sanity/backward_compatible.py && popd