diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 62a219d3..6cbd2e99 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -10,34 +10,13 @@ on: branches: - main pull_request: - types: [ opened, synchronize, reopened ] + types: [opened, synchronize, reopened] branches: - main # A workflow run is made up of one or more jobs, which run in parallel by default # Each job runs in a runner environment specified by runs-on jobs: - # Unique identifier of our job (`job_id`) - test: - # Sets the name `Test` for the job, which is displayed in the GitHub UI - name: Test - # Containers must run in Linux based operating systems - runs-on: ubuntu-latest - steps: - # Downloads a copy of the code in your repository before running CI tests - - name: Check out repository code - # The uses keyword specifies that this step will run v3 of the actions/checkout action. - # This is an action that checks out your repository onto the runner, allowing you to run scripts or other actions against your code (such as build and test tools). - # You should use the checkout action any time your workflow will run against the repository's code. - uses: actions/checkout@v4 - - # This GitHub Action installs a Rust toolchain using rustup. It is designed for one-line concise usage and good defaults. - - name: Install the Rust toolchain - uses: dtolnay/rust-toolchain@stable - - - name: Run tests - run: cargo test - # `fmt` container job fmt: name: Rustfmt diff --git a/.github/workflows/solana-native.yml b/.github/workflows/solana-native.yml index df3c66e4..97e89aed 100644 --- a/.github/workflows/solana-native.yml +++ b/.github/workflows/solana-native.yml @@ -135,6 +135,17 @@ jobs: return 1 fi + # Run Rust unit tests + if [ -d "program" ]; then + echo "Running Rust unit tests for $project" + if ! cargo test --manifest-path=./program/Cargo.toml; then + echo "::error::Rust unit tests failed for $project" + echo "$project: Rust unit tests failed with $solana_version" >> $GITHUB_WORKSPACE/failed_projects.txt + cd - > /dev/null + return 1 + fi + fi + # Test if ! pnpm build-and-test; then echo "::error::tests failed for $project"