Ooops #26
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
| # @format | |
| name: Build | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| runs-on: ubuntu-22.04 | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache: true | |
| - name: Install wasm-pack | |
| uses: jetli/[email protected] | |
| with: | |
| version: "latest" | |
| # Cache the WASM build artifacts with optimal keys | |
| # This handles all Rust packages in the lib directory | |
| - name: Cache WASM build artifacts | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| lib/*/target | |
| packages/@derivean/@wasm/** | |
| key: ${{ runner.os }}-wasm-${{ hashFiles('lib/*/Cargo.toml', 'lib/*/Cargo.lock', 'lib/*/src/**/*.rs') }} | |
| restore-keys: | | |
| ${{ runner.os }}-wasm- | |
| # Cache Bun dependencies | |
| - name: Cache node_modules | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| node_modules | |
| */*/node_modules | |
| packages/*/*/node_modules | |
| key: ${{ runner.os }}-bun-${{ hashFiles('bun.lock') }} | |
| restore-keys: | | |
| ${{ runner.os }}-bun- | |
| # Cache Turborepo's local cache | |
| # Note: This caches the .turbo directory but Turborepo itself | |
| # will still handle invalidation of actual build artifacts based on | |
| # source file changes as defined in your turbo.json inputs | |
| - name: Cache Turborepo | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ hashFiles('**/package.json', 'bun.lock', 'turbo.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo-${{ github.ref_name }}- | |
| ${{ runner.os }}-turbo- | |
| - name: Build WASM packages | |
| run: bunx turbo run wasm | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Lint and typecheck | |
| run: bunx turbo run lint typecheck --parallel | |
| - name: Build application | |
| run: bunx turbo run build | |
| # Save Turborepo cache for future workflows | |
| # This saves the entire .turbo directory, but individual task caches will | |
| # still be properly invalidated by Turborepo when source files change | |
| - name: Save Turborepo cache | |
| uses: actions/cache/save@v4 | |
| if: always() | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ hashFiles('**/package.json', 'bun.lock', 'turbo.json') }} | |
| # Upload build artifacts | |
| - name: Upload build artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-artifacts | |
| path: apps/derivean/dist | |
| retention-days: 7 |