Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GitHub checks #7

Merged
merged 12 commits into from
Jul 18, 2023
17 changes: 17 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: "Setup"
description: "Sets up environment"
runs:
using: "composite"
steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: "18.12.1"
cache: "npm"
registry-url: "https://npm.pkg.github.com"
- name: Install dependencies
run: |
npm install --immutable --immutable-cache --check-cache
shell: bash
62 changes: 62 additions & 0 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: CI/CD Checks
richardguerre marked this conversation as resolved.
Show resolved Hide resolved

on:
push:
branches: [main]
pull_request:

jobs:
format-check:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup environment (node, npm install)
uses: ./.github/actions/setup
richardguerre marked this conversation as resolved.
Show resolved Hide resolved
- name: Format check
run: npm run format:check

build-check:
runs-on: ubuntu-latest

steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup environment (node, npm install)
uses: ./.github/actions/setup
- name: Build check
run: npm run build

server-test:
services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: pg
richardguerre marked this conversation as resolved.
Show resolved Hide resolved
POSTGRES_DB: flow_test
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432

runs-on: ubuntu-latest
timeout-minutes: 5
env:
CI: true
NODE_ENV: test
DATABASE_URL: postgresql://postgres@localhost:5432/flow
richardguerre marked this conversation as resolved.
Show resolved Hide resolved
ORIGIN: http://localhost:4000

steps:
- name: Check out repository code
uses: actions/checkout@v3
- name: Setup environment (node, npm install)
uses: ./.github/actions/setup
- name: Run DB migrations
run: npm run db:dev
richardguerre marked this conversation as resolved.
Show resolved Hide resolved
- name: Test check
run: npm run test -w apps/server -- test/graphql/Item.test.ts