Merge pull request #181 from Magrexy/fix/magrexy-app-structure #88
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: STELLARHUNTS | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| permissions: read-all | |
| # Cancels any in-progress run for the same branch / PR so we don't | |
| # waste runner minutes on superseded pushes. | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| # ───────────────────────────────────────────────────────────────────── | |
| # Onchain jobs (contracts) | |
| # ───────────────────────────────────────────────────────────────────── | |
| jobs: | |
| onchain-build: | |
| name: Build contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| # Cache Scarb / cargo artifacts and any (future) root-level | |
| # node_modules. Keyed on the lockfile hash so a dependency change | |
| # invalidates the entry, but identical lockfiles re-use the | |
| # previous cache. The `**/node_modules` path is currently a | |
| # no-op target because no JS step runs in this workflow — it is | |
| # included so that when npm-based jobs are added in the future, | |
| # the cache key already covers them. | |
| - name: Cache Scarb, Cargo and node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| ~/.cache/scarb | |
| ~/.local/share/scarb | |
| ~/.scarb | |
| onchain/target | |
| **/node_modules | |
| key: ${{ runner.os }}-scarb-cargo-${{ hashFiles('onchain/Scarb.lock', 'onchain/Scarb.toml', '**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-scarb-cargo- | |
| - uses: software-mansion/setup-scarb@v1 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: wasm32-unknown-unknown | |
| components: rustfmt | |
| # See onchain/Cargo.lock for pinned dependency resolutions. | |
| - name: Build contracts (release wasm) | |
| working-directory: onchain | |
| run: cargo build --workspace --target wasm32-unknown-unknown --release --locked | |
| - name: Format check | |
| working-directory: onchain | |
| run: cargo fmt --all -- --check | |
| # ── cargo-deny ──────────────────────────────────────────── | |
| # Audit dependencies for security advisories, license compliance, | |
| # and duplicate crate versions. | |
| - name: Install cargo-deny | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: cargo-deny | |
| - name: cargo-deny check | |
| working-directory: onchain | |
| run: cargo deny --locked check advisories licenses bans sources | |
| onchain-test: | |
| name: Test contracts | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Cache Scarb, Cargo and node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.cargo/registry | |
| ~/.cargo/git | |
| ~/.cache/scarb | |
| ~/.local/share/scarb | |
| ~/.scarb | |
| onchain/target | |
| **/node_modules | |
| key: ${{ runner.os }}-scarb-cargo-${{ hashFiles('onchain/Scarb.lock', 'onchain/Scarb.toml', '**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-scarb-cargo- | |
| - uses: software-mansion/setup-scarb@v1 | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| toolchain: stable | |
| - name: Build contracts (test profile) | |
| working-directory: onchain | |
| run: cargo build --workspace --tests --locked | |
| - name: Run unit tests | |
| working-directory: onchain | |
| run: cargo test --workspace --locked | |
| # ───────────────────────────────────────────────────────────────────── | |
| # Backend CI | |
| # ───────────────────────────────────────────────────────────────────── | |
| backend-lint: | |
| name: Backend lint | |
| 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 | |
| working-directory: backend | |
| run: npm ci | |
| - name: Lint | |
| working-directory: backend | |
| run: npm run lint | |
| - name: npm audit | |
| working-directory: backend | |
| # --audit-level=high exits with non-zero if any advisory at | |
| # severity high or critical is found. | |
| run: npm audit --audit-level=high | |
| continue-on-error: true | |
| backend-test: | |
| name: Backend 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 | |
| working-directory: backend | |
| run: npm ci | |
| - name: Run unit tests | |
| working-directory: backend | |
| run: npm test -- --passWithNoTests | |
| # ───────────────────────────────────────────────────────────────────── | |
| # Frontend CI | |
| # ───────────────────────────────────────────────────────────────────── | |
| frontend-lint: | |
| name: Frontend lint | |
| 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 | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Lint | |
| working-directory: frontend | |
| run: npm run lint | |
| - name: npm audit | |
| working-directory: frontend | |
| run: npm audit --audit-level=high | |
| continue-on-error: true | |
| frontend-build: | |
| name: Frontend build | |
| 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 | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build | |
| working-directory: frontend | |
| run: npm run build |