feat(recipe): persist recipe drafts across navigation and reload #110
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: | |
| pull_request: | |
| push: | |
| branches: [main] | |
| jobs: | |
| quality: | |
| runs-on: [self-hosted, linux, x64, t31-project2-ci] | |
| env: | |
| DATABASE_URL: ${{ secrets.TEST_DATABASE_URL }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Require test database connection | |
| run: | | |
| if [ -z "$DATABASE_URL" ]; then | |
| echo "::error::Set the TEST_DATABASE_URL Actions secret to a dedicated PostgreSQL test database accessible from this runner." | |
| exit 1 | |
| fi | |
| - uses: actions/setup-node@v4 | |
| with: { node-version-file: .node-version, cache: npm } | |
| - run: npm ci | |
| - name: Verify generated GraphQL types | |
| run: npm run types:check | |
| - name: Verify database migrations | |
| run: npm run db:check | |
| - name: Lint, typecheck, test and build | |
| run: npm run check | |
| - name: Test database constraints and migrations | |
| run: npm run test:db | |
| - name: Test recipe API and image storage | |
| run: npm run test:api | |
| - run: npx playwright install chromium | |
| - run: npm run test:e2e | |
| - name: Save tested release | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-artifact@v3.2.1-node20 | |
| with: | |
| name: project2-${{ github.sha }}-${{ github.run_attempt }} | |
| path: | | |
| apps/api/dist | |
| apps/api/migrations | |
| apps/api/package.json | |
| apps/validation/dist | |
| apps/validation/package.json | |
| apps/web/dist | |
| apps/web/package.json | |
| package.json | |
| package-lock.json | |
| deploy: | |
| needs: quality | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: [self-hosted, linux, x64, t31-project2-deploy] | |
| environment: | |
| name: production | |
| url: http://it2810-31.idi.ntnu.no/project2/ | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/download-artifact@v3-node20 | |
| with: | |
| name: project2-${{ github.sha }}-${{ github.run_attempt }} | |
| path: release | |
| - name: Install production dependencies | |
| run: cd release && npm ci --omit=dev | |
| - name: Apply database migrations | |
| run: cd release && node --env-file=/etc/t31-project2.env apps/api/dist/db/migrate.js | |
| - name: Publish and restart the API service | |
| run: bash scripts/deploy.sh release "$GITHUB_SHA-$GITHUB_RUN_ID-$GITHUB_RUN_ATTEMPT" |