Skip to content

Add Alternate Mocking Framework (2-of-3 / Update existing tests) #493

Add Alternate Mocking Framework (2-of-3 / Update existing tests)

Add Alternate Mocking Framework (2-of-3 / Update existing tests) #493

Workflow file for this run

name: Test
permissions:
contents: read
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
# Make sure CI fails on all warnings, including Clippy lints
env:
RUSTFLAGS: "-Dwarnings"
RIPPLED_DOCKER_IMAGE: rippleci/rippled:ripple_se_supported
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Cache dependencies
uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: clippy, rustfmt
# This runs the pre-commit hooks defined in .pre-commit-config.yaml
# TODO: figure out how to update to use pre-commit.ci
- uses: pre-commit/action@v3.0.1
clippy_linting:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Cache dependencies
uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run Clippy linting
run: ./scripts/clippy.sh
rustfmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Run formatting check
run: ./scripts/fmt.sh
check_wasm_exports:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Check WASM contract exports
run: ./scripts/check-wasm-exports.sh
host_function_audit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Run host function audit
run: ./scripts/host-function-audit.sh
validate_ui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Validate UI
run: ./scripts/validate-ui.sh
build_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Cache dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run build and test
run: ./scripts/build-and-test.sh
run-markdown:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Run code in Markdown files
run: ./scripts/run-markdown.sh
e2e-tests:
runs-on: ubuntu-latest
# needs: build_and_test
steps:
- uses: actions/checkout@v5
- name: Use Node.js v24
uses: actions/setup-node@v4
with:
node-version: 24.x
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Cache Node dependencies
id: cache-nodemodules
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
# caching node_modules
path: |
node_modules
key: ${{ runner.os }}-node-24-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-24-
- name: Install Node dependencies
if: steps.cache-nodemodules.outputs.cache-hit != 'true'
run: npm ci
- name: Run docker in background
run: |
docker run --detach --rm -p 5005:5005 -p 6006:6006 --volume "${{ github.workspace }}/.ci-config/":"/etc/opt/ripple/" --name rippled-service --health-cmd="rippled server_info || exit 1" --health-interval=5s --health-retries=10 --health-timeout=2s --entrypoint bash ${{ env.RIPPLED_DOCKER_IMAGE }} -c "rippled -a"
- name: Run end-to-end tests
run: ./scripts/run-tests.sh
- name: Stop docker container
if: always()
run: docker stop rippled-service
coverage:
runs-on: ubuntu-latest
env:
CARGO_TERM_COLOR: always
steps:
- uses: actions/checkout@v5
- name: Cache dependencies
uses: actions/cache/restore@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Install Rust
run: rustup update stable
- name: Install cargo-llvm-cov
uses: taiki-e/install-action@cargo-llvm-cov
- name: Generate code coverage
run: ./scripts/coverage.sh