Skip to content

chore: update dryrun times | NPG-000 #1913

chore: update dryrun times | NPG-000

chore: update dryrun times | NPG-000 #1913

Workflow file for this run

name: Rust CI
on:
push:
branches:
- main
paths-ignore:
- '**.md'
- 'src/**/**.md'
- 'Makefiles/**'
- 'nix/**'
- 'book/**'
pull_request:
paths-ignore:
- '**.md'
- 'book/**'
- 'src/**/**.md'
- 'Makefiles/**'
- 'nix/**'
- 'book/**'
env:
RUST_LATEST_STABLE_VERSION: 1.71
CARGO_TERM_COLOR: always
RUSTFLAGS: -D warnings
RUST_BACKTRACE: 1
CARGO_INCREMENTAL: 0
CARGO_FLAGS: --verbose --locked
SEGMENT_DOWNLOAD_TIMEOUT_MINS: 15
jobs:
cancel:
name: Cancel previous runs
runs-on: ubuntu-latest
timeout-minutes: 3
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
build-test-dependencies:
name: Build test dependencies
runs-on: ubuntu-latest
steps:
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "test_cache"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install dependencies
run:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
- name: Build external dependencies
run:
cargo build -p vit-servicing-station-cli -p vit-servicing-station-server -p jcli -p jormungandr -p explorer
- name: Save external dependencies
uses: actions/cache/save@v3
with:
path: |
target/debug/vit-servicing-station-cli
target/debug/vit-servicing-station-server
target/debug/jcli
target/debug/jormungandr
target/debug/explorer
key: deps-${{ github.run_id }}-${{ github.run_attempt }}
build-tests-artifacts:
name: Build test artifacts
runs-on: ubuntu-latest
steps:
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "test_cache"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Install dependencies
run:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
# We are excluding cat-dat-service and event-db because we are already running it with Earthly
- name: Build and archive tests
run: |
cargo nextest archive \
--workspace \
--exclude vitup \
--exclude mainnet-lib \
--exclude jortestkit \
--exclude integration-tests \
--exclude vit-servicing-station-cli \
--exclude vit-servicing-station-server \
--exclude vit-servicing-station-tests \
--exclude vit-servicing-station-lib \
--exclude vit-servicing-station-cli-f10 \
--exclude vit-servicing-station-server-f10 \
--exclude vit-servicing-station-tests-f10 \
--exclude vit-servicing-station-lib-f10 \
--exclude cat-data-service \
--exclude event-db \
--exclude wallet-uniffi \
--archive-file nextest-archive.tar.zst
- name: Save test archive
uses: actions/cache/save@v3
with:
path: nextest-archive.tar.zst
key: nextest-archive-${{ github.run_id }}-${{ github.run_attempt }}
catalyst-core-tests:
name: Catalyst Core tests
runs-on: ubuntu-latest
needs: [build-tests-artifacts, build-test-dependencies]
services:
postgres:
image: postgres:15
env:
POSTGRES_PASSWORD: 123456
LC_ALL: C # string sorting in tests expect this
options:
>-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
strategy:
matrix:
partition: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
steps:
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "test_cache"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Restore test archive
id: archive-cache
uses: actions/cache/restore@v3
with:
path: nextest-archive.tar.zst
key: nextest-archive-${{ github.run_id }}-${{ github.run_attempt }}
- name: Restore external dependencies
id: deps-cache
uses: actions/cache/restore@v3
with:
path: |
target/debug/vit-servicing-station-cli
target/debug/vit-servicing-station-server
target/debug/vit-servicing-station-cli-f10
target/debug/vit-servicing-station-server-f10
target/debug/jcli
target/debug/jormungandr
target/debug/explorer
key: deps-${{ github.run_id }}-${{ github.run_attempt }}
- name: Install nextest
uses: taiki-e/install-action@nextest
- name: Install cargo-make
run: cargo install --force cargo-make --version 0.37.10 --locked
- name: Install refinery
run: cargo install refinery_cli --version 0.8.7 --locked
- name: Install dependencies
run:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
- name: Build external dependencies
if: steps.deps-cache.outputs.cache-hit != 'true'
run:
cargo build -p vit-servicing-station-cli -p vit-servicing-station-server -p vit-servicing-station-cli-f10 -p vit-servicing-station-server-f10 -p jcli -p jormungandr -p explorer
- name: Setup Event DB
env:
PGPASSWORD: 123456
run: cargo make local-event-db-test -h 127.0.0.1 -U postgres
# We are excluding cat-dat-service and event-db because we are already running it with Earthly
- name: Build and archive tests
if: steps.archive-cache.outputs.cache-hit != 'true'
run: |
cargo nextest archive \
--workspace \
--exclude vitup \
--exclude mainnet-lib \
--exclude jortestkit \
--exclude integration-tests \
--exclude vit-servicing-station-cli \
--exclude vit-servicing-station-server \
--exclude vit-servicing-station-tests \
--exclude vit-servicing-station-lib \
--exclude vit-servicing-station-cli-f10 \
--exclude vit-servicing-station-server-f10 \
--exclude vit-servicing-station-tests-f10 \
--exclude vit-servicing-station-lib-f10 \
--exclude cat-data-service \
--exclude event-db \
--exclude wallet-uniffi \
--archive-file nextest-archive.tar.zst
## - name: Run Catalyst Core tests
## env:
## TEST_DATABASE_URL: postgres://postgres:123456@localhost
## EVENT_DB_URL: postgres://catalyst-event-dev:CHANGE_ME@localhost/CatalystEventDev
## removing test ui_test because of bug https://github.com/rust-lang/cargo/issues/10352
## run: |
## cargo nextest run \
## -E "not (test(ui_test))" \
## --archive-file nextest-archive.tar.zst --extract-to ${{ github.workspace }} \
## --extract-overwrite --partition hash:${{ matrix.partition }}/10 --profile ci
test-results:
if: always()
runs-on: ubuntu-latest
name: Final test results
needs: catalyst-core-tests
steps:
- run: |
result="${{ needs.catalyst-core-tests.result }}"
if [[ $result == "success" ]]; then
exit 0
else
exit 1
fi
cleanup-cache:
name: Clean up run cache
runs-on: ubuntu-latest
permissions:
actions: write
needs: catalyst-core-tests
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Clean up archive and deps cache
run: |
gh extension install actions/gh-actions-cache
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
gh actions-cache delete nextest-archive-${{ github.run_id }}-${{ github.run_attempt }} --confirm
gh actions-cache delete deps-${{ github.run_id }}-${{ github.run_attempt }} --confirm
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
wallet-js-binding:
name: Wallet JS Binding Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: actions/setup-node@v3
with:
node-version: 19
- uses: actions/setup-node@v3
with:
node-version: 19
- uses: jetli/[email protected]
with:
version: 'latest'
- name: Build wasm package
run: |
cd src/chain-wallet-libs/bindings/wallet-wasm-js
wasm-pack build --release --target=nodejs -d pkg
- name: Build JS package
run: |
cd src/chain-wallet-libs/bindings/wallet-wasm-js/js
rm package.json
cp package_test.json package.json
npm install
- name: Run JS tests
run: |
cd src/chain-wallet-libs/bindings/wallet-wasm-js/js-test
npm install
npm test
clippy:
name: Clippy
runs-on: ubuntu-latest
steps:
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
df -h
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Cache rust
uses: Swatinem/rust-cache@v2
with:
shared-key: "build_cache"
save-if: ${{ github.ref == 'refs/heads/main' }}
- name: Install dependencies
run:
sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config
- name: Install uniffi
uses: actions-rs/[email protected]
with:
crate: uniffi_bindgen
version: 0.21.1
use-tool-cache: true
- name: Clippy and fmt
uses: actions-rs/toolchain@v1
with:
toolchain: ${{env.RUST_LATEST_STABLE_VERSION}}
components: rustfmt, clippy
- run: rustup component add clippy
- run: scripts/check-fmt.sh