Skip to content

Add VinuChain (coin type 10000207) #528

Add VinuChain (coin type 10000207)

Add VinuChain (coin type 10000207) #528

Workflow file for this run

name: Rust CI
on:
push:
branches: [ dev, master ]
pull_request:
branches: [ dev, master ]
env:
SCCACHE_GHA_ENABLED: "true"
RUSTC_WRAPPER: "sccache"
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Check formatting, clippy warnings, run tests and check code coverage.
rust-lints:
permissions:
contents: read
checks: write
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install system dependencies
run: |
tools/install-sys-dependencies-linux
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@65101d47ea8028ed0c98a1cdea8dd9182e9b5133 # v0.0.8
- name: Cache Rust
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: |
rust
- name: Install Rust dependencies
run: |
tools/install-rust-dependencies dev
- name: Check code formatting
run: |
cargo fmt --check
working-directory: rust
- name: Check Clippy warnings
run: |
cargo clippy -- -D warnings
working-directory: rust
# Run Rust tests in WASM.
test-wasm:
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install system dependencies
run: |
tools/install-sys-dependencies-linux
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@65101d47ea8028ed0c98a1cdea8dd9182e9b5133 # v0.0.8
- name: Cache Rust
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: |
rust
- name: Install Rust dependencies
run: |
tools/install-rust-dependencies
- name: Install emsdk
run: tools/install-wasm-dependencies
- name: Run tests in WASM
run: tools/rust-test wasm
check-binary-sizes:
permissions:
contents: read
pull-requests: write
runs-on: macos-latest-xlarge
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install system dependencies
run: |
tools/install-sys-dependencies-mac
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@65101d47ea8028ed0c98a1cdea8dd9182e9b5133 # v0.0.8
- name: Cache Rust
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: |
rust
- name: Install Rust dependencies
run: tools/install-rust-dependencies
- name: Install emsdk
run: tools/install-wasm-dependencies
- name: Compile release binaries
run: |
mkdir -p build/local/lib
source emsdk/emsdk_env.sh
tools/rust-bindgen
- name: Generate release report
run: |
./tools/release-size measure-rust > release-report.json
- name: Upload release report
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
with:
name: release_report
path: release-report.json
# Download previous release report, compare the release binary sizes, and post/update a comment at the Pull Request.
- name: Download previous release report
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
run: ./tools/gh-download-workflow-artifact
env:
COMMIT: ${{github.event.pull_request.base.sha}}
DOWNLOAD_PATH: previous
# Same artifact name as at the "Upload release report" step.
ARTIFACT_NAME: release_report
GH_TOKEN: ${{ github.token }}
- name: Craft Comment Body
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
run: |
# Please note `previous/release-report.json` may not exist if the previous report was not found.
./tools/release-size compare --before previous/release-report.json --current release-report.json > report-diff.md
- name: Create or Update Comment
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.fork == false
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
with:
script: |
const script = require('./tools/gh-create-or-update-comment.js');
await script({github, context, bodyPath: 'report-diff.md', bodyIncludes: 'Binary size comparison'});
memory-profiler:
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
with:
submodules: true
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@65101d47ea8028ed0c98a1cdea8dd9182e9b5133 # v0.0.8
- name: Cache Rust
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: |
rust
- name: Install llvm
run: |
# to get the symbolizer for debug symbol resolution
sudo apt install llvm
- name: Install Rust dependencies
run: |
tools/install-rust-dependencies
- name: Enable debug symbols
run: |
cd rust
# to fix buggy leak analyzer:
# https://github.com/japaric/rust-san#unrealiable-leaksanitizer
# ensure there's a profile.dev section
if ! grep -qE '^[ \t]*[profile.dev]' Cargo.toml; then
echo >> Cargo.toml
echo '[profile.dev]' >> Cargo.toml
fi
# remove pre-existing opt-levels in profile.dev
sed -i '/^\s*\[profile.dev\]/,/^\s*\[/ {/^\s*opt-level/d}' Cargo.toml
# now set opt-level to 1
sed -i '/^\s*\[profile.dev\]/a opt-level = 1' Cargo.toml
cat Cargo.toml
- name: cargo test -Zsanitizer=address
# only --lib --tests b/c of https://github.com/rust-lang/rust/issues/53945
run: |
cd rust
cargo test --lib --tests --all-features --target x86_64-unknown-linux-gnu
env:
ASAN_OPTIONS: "detect_odr_violation=0:detect_leaks=0"
RUSTFLAGS: "-Z sanitizer=address"
# Clean up build directory to free up the disc space.
- name: Clean up after ASAN
run: |
cd rust
cargo clean
- name: cargo test -Zsanitizer=leak
if: always()
run: |
cd rust
cargo test --all-features --target x86_64-unknown-linux-gnu
env:
RUSTFLAGS: "-Z sanitizer=leak"
coverage:
runs-on: ubuntu-24.04
if: github.event.pull_request.draft == false
steps:
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- name: Install system dependencies
run: |
tools/install-sys-dependencies-linux
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@65101d47ea8028ed0c98a1cdea8dd9182e9b5133 # v0.0.8
- name: Cache Rust
uses: Swatinem/rust-cache@779680da715d629ac1d338a641029a2f4372abb5 # v2.8.2
with:
workspaces: |
rust
- name: Install Rust dependencies
run: |
tools/install-rust-dependencies dev
- name: cargo generate-lockfile
if: hashFiles('Cargo.lock') == ''
run: |
cd rust
cargo generate-lockfile
- name: Run tests
run: |
tools/rust-coverage
- name: Run Doc tests
run: |
tools/rust-test doc
- name: Record Rust version
run: echo "RUST=$(rustc --version)" >> "$GITHUB_ENV"
# TODO: Uncomment this when we have a codecov token
# - name: Upload to codecov.io
# uses: codecov/codecov-action@671740ac38dd9b0130fbe1cec585b89eea48d3de # v5.5.2
# with:
# fail_ci_if_error: true
# token: ${{ secrets.CODECOV_TOKEN }}
# env_vars: OS,RUST
- name: Gather and check Rust code coverage
run: |
tools/check-coverage rust/coverage.stats rust/lcov.info