This repository has been archived by the owner on Dec 18, 2024. It is now read-only.
Pin Heroku Deploy action #104
This file contains 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: Node.js CI | |
on: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build: | |
env: | |
DATABASE_URL: postgres://postgres:@localhost:4211/postgres | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Start dev service containers | |
run: docker compose up --detach | |
- name: Set up Node.js environment | |
uses: textbook/take-action@nodejs | |
with: | |
checkout: "false" | |
node-version-file: ".nvmrc" | |
- name: Apply database migrations | |
run: npm run migration -- up | |
- name: Check code style | |
run: npm run lint | |
- name: Run low-level tests | |
run: npm run test:cover | |
env: | |
FORCE_COLOR: true | |
LOG_LEVEL: debug | |
OAUTH_CLIENT_ID: unused | |
OAUTH_CLIENT_SECRET: unused | |
SESSION_SECRET: correct-horse-battery-staple | |
SUDO_TOKEN: make-me-a-sandwich | |
- name: Store coverage report | |
uses: actions/upload-artifact@v3 | |
with: | |
if-no-files-found: error | |
name: coverage-report | |
path: reports/coverage/ | |
- name: Run end-to-end tests | |
run: npm run e2e | |
env: | |
CYPRESS_VIDEO: true | |
- name: Get service logs and stop containers | |
if: always() | |
run: | | |
docker compose logs | |
docker compose down | |
- name: Store Cypress test outputs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
if-no-files-found: ignore | |
name: cypress-outputs | |
path: | | |
e2e/screenshots/ | |
e2e/videos/ | |
deploy: | |
uses: "./.github/workflows/deploy.yml" | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
with: | |
environment: heroku | |
secrets: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }} | |
publish-coverage: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
permissions: | |
contents: write | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Check out source code | |
uses: actions/checkout@v4 | |
- name: Download coverage report | |
uses: actions/download-artifact@v4 | |
with: | |
name: coverage-report | |
path: reports/coverage/ | |
- name: Publish coverage report | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
folder: reports/coverage/lcov-report |