feat: add CI #4
Workflow file for this run
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: | |
| branches: ['main'] | |
| pull_request: | |
| type: [opened, synchronize] | |
| merge_group: | |
| type: [checks_requested] | |
| jobs: | |
| build: | |
| name: Build, Test and Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Check out code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Cache turbo build setup | |
| uses: actions/cache@v4 | |
| with: | |
| path: .turbo | |
| key: ${{ runner.os }}-turbo-${{ github.sha }} | |
| restore-keys: | | |
| ${{ runner.os }}-turbo- | |
| - name: Install build dependencies | |
| run: | | |
| sudo apt-get update | |
| - name: Setup Node.JS environment | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| - name: Install pnpm via corepack | |
| shell: bash | |
| run: | | |
| corepack enable | |
| corepack prepare --activate | |
| - name: Get pnpm store directory | |
| id: pnpm-cache | |
| shell: bash | |
| run: | | |
| echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
| - name: Setup pnpm cache | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
| key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-pnpm-store- | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Build | |
| run: pnpm build | |
| env: | |
| SQLX_OFFLINE: true | |
| - name: Lint | |
| run: pnpm lint | |
| env: | |
| SQLX_OFFLINE: true | |
| - name: Start docker compose | |
| run: docker-compose -f docket-compose.test.yaml -d | |
| - name: Test | |
| run: pnpm test | |
| env: | |
| SQLX_OFFLINE: true | |
| DATABASE_URL: postgresql://unen:unen@localhost/unen |