2022-05-14 10:22:06 +00:00
|
|
|
name: CI
|
2021-08-20 00:33:28 +00:00
|
|
|
|
2021-08-20 06:28:34 +00:00
|
|
|
on: [push, pull_request]
|
2021-08-20 00:33:28 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-08-20 06:28:34 +00:00
|
|
|
lint:
|
|
|
|
name: Lint
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-10-01 21:06:26 +00:00
|
|
|
node-version: 16
|
2022-05-14 10:22:06 +00:00
|
|
|
cache: "npm"
|
2021-08-27 16:48:24 +00:00
|
|
|
- run: npm ci
|
2021-08-20 06:28:34 +00:00
|
|
|
- run: npm run lint
|
|
|
|
|
2022-05-14 10:22:06 +00:00
|
|
|
e2e:
|
|
|
|
name: E2E tests
|
2021-08-20 06:28:34 +00:00
|
|
|
runs-on: ubuntu-latest
|
2022-05-14 10:22:06 +00:00
|
|
|
services:
|
|
|
|
postgres:
|
|
|
|
image: postgres:13-alpine
|
|
|
|
options: >-
|
|
|
|
--health-cmd pg_isready
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
env:
|
|
|
|
POSTGRES_USER: pgremixtape
|
|
|
|
POSTGRES_PASSWORD: pgpassword
|
|
|
|
POSTGRES_DB: remixtape
|
|
|
|
ports:
|
|
|
|
- "5432:5432"
|
|
|
|
redis:
|
|
|
|
image: redis:6-alpine
|
|
|
|
options: >-
|
|
|
|
--health-cmd "redis-cli ping"
|
|
|
|
--health-interval 10s
|
|
|
|
--health-timeout 5s
|
|
|
|
--health-retries 5
|
|
|
|
ports:
|
|
|
|
- "6379:6379"
|
2021-09-02 18:50:58 +00:00
|
|
|
env:
|
2022-05-14 10:22:06 +00:00
|
|
|
DATABASE_URL: postgresql://pgremixtape:pgpassword@localhost:5432/remixtape
|
|
|
|
REDIS_URL: redis://localhost:6379
|
|
|
|
CI: true
|
2021-08-20 06:28:34 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2022-05-14 10:22:06 +00:00
|
|
|
- run: cp .env.example .env
|
2021-08-20 06:28:34 +00:00
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-10-01 21:06:26 +00:00
|
|
|
node-version: 16
|
2022-05-14 10:22:06 +00:00
|
|
|
cache: "npm"
|
2021-08-27 16:48:24 +00:00
|
|
|
- run: npm ci
|
2022-05-14 10:22:06 +00:00
|
|
|
- run: npm run db:setup
|
|
|
|
- run: npm run build
|
|
|
|
- run: npx dotenv npm run e2e:ci
|
2021-08-20 06:28:34 +00:00
|
|
|
|
2022-05-14 10:22:06 +00:00
|
|
|
typecheck:
|
|
|
|
name: Typecheck
|
2021-08-20 06:28:34 +00:00
|
|
|
runs-on: ubuntu-latest
|
2021-09-02 18:50:58 +00:00
|
|
|
env:
|
|
|
|
HUSKY_SKIP_INSTALL: 1
|
2021-08-20 06:28:34 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- uses: actions/setup-node@v2
|
|
|
|
with:
|
2021-10-01 21:06:26 +00:00
|
|
|
node-version: 16
|
2021-08-27 16:48:24 +00:00
|
|
|
- run: npm ci
|
2022-05-14 10:22:06 +00:00
|
|
|
- run: npx tsc
|
2021-08-20 06:28:34 +00:00
|
|
|
|
2022-05-14 10:22:06 +00:00
|
|
|
deploy:
|
2021-08-20 06:28:34 +00:00
|
|
|
if: github.ref == 'refs/heads/master'
|
2022-05-14 10:22:06 +00:00
|
|
|
needs: [lint, e2e, typecheck]
|
|
|
|
name: Deploy to Fly.io
|
2021-08-20 00:33:28 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
2021-08-27 14:32:34 +00:00
|
|
|
- uses: superfly/flyctl-actions@master
|
2021-08-20 00:33:28 +00:00
|
|
|
env:
|
2021-08-27 14:32:34 +00:00
|
|
|
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}
|
|
|
|
with:
|
2022-05-14 10:22:06 +00:00
|
|
|
args: "deploy --strategy rolling"
|