test(contract): add version tag and upgrade path tests (#62) #5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| pull_request: | |
| jobs: | |
| contract: | |
| name: Rust contract | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable + wasm32 target | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: contracts/subscription | |
| - name: Build (wasm32 release) | |
| run: cargo build --manifest-path contracts/subscription/Cargo.toml --target wasm32-unknown-unknown --release | |
| - name: Test & summary | |
| run: | | |
| set -o pipefail | |
| cargo test --manifest-path contracts/subscription/Cargo.toml 2>&1 \ | |
| | tee /tmp/contract-test-output.txt | |
| echo "--- Test summary ---" | |
| grep -E "^test result|FAILED|ok$" /tmp/contract-test-output.txt || true | |
| contract-coverage: | |
| name: Rust contract coverage | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| components: llvm-tools-preview | |
| - name: Cache Rust dependencies | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: contracts/subscription | |
| - name: Install cargo-llvm-cov | |
| run: cargo install cargo-llvm-cov --locked | |
| - name: Generate coverage report | |
| run: make test-coverage | |
| - name: Upload LCOV report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: contract-coverage-lcov | |
| path: contracts/target/lcov.info | |
| - name: Upload HTML report | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: contract-coverage-html | |
| path: contracts/target/coverage-html/ | |
| backend-integration: | |
| name: Backend integration tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: backend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: backend | |
| - name: Run integration tests | |
| run: npm run test:integration | |
| working-directory: backend | |
| # #191: Frontend type check + unit tests on every push/PR | |
| frontend: | |
| name: Frontend type check and unit tests | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: frontend | |
| # #191: TypeScript type checking — catches type errors before merge | |
| - name: Type check | |
| run: npm run type-check | |
| working-directory: frontend | |
| frontend-typecheck: | |
| name: Frontend strict type check | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: npm | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Install dependencies | |
| run: npm ci | |
| working-directory: frontend | |
| - name: Type check (fail on errors) | |
| run: npm run type-check | |
| working-directory: frontend |