Skip to content
50 changes: 50 additions & 0 deletions .github/workflows/lint-and-format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Lint and Format
on:
pull_request_target:
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually safer to use when dealing with forked repos apparently https://dev.to/suzukishunsuke/secure-github-actions-by-pullrequesttarget-641

branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: latest
cache: "npm"
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Lint
run: npm run lint
typecheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: latest
cache: "npm"
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Typecheck
run: npm run typecheck
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: latest
cache: "npm"
- name: Install dependencies
run: npm ci --ignore-scripts
- name: Format
run: npm run format
49 changes: 49 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests / Backend
on:
pull_request_target:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
postgres-container:
runs-on: ubuntu-latest
env:
PGUSER: postgres
PGPASSWORD: password
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wasn't sure how secrets worked with forked repos but we can probably figure this out and move this to a secret

PGHOST: db
PGDATABASE: safeskiesdb
PGPORT: 5432
HUSKY: 0
container: node:22.14-bookworm-slim

services:
db:
image: postgres
ports:
- 5432:5432
env:
POSTGRES_PASSWORD: password
POSTGRES_DB: safeskiesdb
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5

steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22.14.0
cache: "npm"
- name: Install dependencies
run: npm ci
- name: Run migrations
run: npm run migrate:up
- name: Run tests
run: npm run test
Loading