feat: 🎸 working Dockerfile #12
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: Workflow | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - beta | |
| - alpha | |
| pull_request: | |
| jobs: | |
| prepare-environment: | |
| name: Prepare environment | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "pnpm" | |
| cache-dependency-path: pnpm-lock.yaml | |
| env: | |
| FORCE_COLOR: 0 | |
| - name: Get pnpm store directory path | |
| id: pnpm-store-dir-path | |
| run: | | |
| echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| echo "version=$(pnpm -v)" >> $GITHUB_OUTPUT | |
| - name: Install canvas native dependencies | |
| run: | |
| sudo apt-get update && sudo apt-get install -y build-essential libcairo2-dev libjpeg-dev libpango1.0-dev | |
| libgif-dev librsvg2-dev libpixman-1-dev | |
| - name: Install node_modules | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: pnpm install --frozen-lockfile | |
| - name: Cache node_modules | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| uses: actions/cache/save@v3 | |
| with: | |
| path: | | |
| ${{ steps.pnpm-store-dir-path.outputs.dir }} | |
| '**/node_modules' | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| tests: | |
| name: Run tests | |
| runs-on: ubuntu-latest | |
| needs: prepare-environment | |
| # Tests timeout after 40 minutes | |
| timeout-minutes: 40 | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| run_install: false | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: .nvmrc | |
| cache: "pnpm" | |
| cache-dependency-path: pnpm-lock.yaml | |
| - name: Get pnpm store directory path | |
| id: pnpm-store-dir-path | |
| run: | | |
| echo "dir=$(pnpm store path --silent)" >> $GITHUB_OUTPUT | |
| echo "version=$(pnpm -v)" >> $GITHUB_OUTPUT | |
| - name: Restore node_modules | |
| uses: actions/cache/restore@v3 | |
| id: cache-node-modules | |
| with: | |
| path: | | |
| **/node_modules | |
| **/.eslintcache | |
| ${{ steps.pnpm-store-dir-path.outputs.dir }} | |
| key: ${{ runner.os }}-pnpm-${{ hashFiles('pnpm-lock.yaml') }} | |
| - name: Install canvas native dependencies | |
| run: | |
| sudo apt-get update && sudo apt-get install -y build-essential libcairo2-dev libjpeg-dev libpango1.0-dev | |
| libgif-dev librsvg2-dev libpixman-1-dev | |
| - name: Install node_modules on cache miss | |
| if: steps.cache-node-modules.outputs.cache-hit != 'true' | |
| run: pnpm install --frozen-lockfile | |
| - name: Build | |
| run: pnpm run build | |
| - name: Lint | |
| run: pnpm run lint | |
| - name: Typecheck | |
| run: pnpm run typecheck | |
| - name: Start test services | |
| run: docker compose -f apps/backend/docker-compose.test.yml --env-file apps/backend/.env.test up -d --wait | |
| - name: Run test migrations | |
| run: pnpm --filter @hype-stack/backend test:migrate | |
| - name: Test | |
| run: pnpm run test |