Skip to content

Make validator deterministic & fix validations #57

Make validator deterministic & fix validations

Make validator deterministic & fix validations #57

name: Backend Code Style
on:
pull_request:
branches:
- '!main'
- '!master'
- '**'
paths:
- 'backend/**'
jobs:
build:
defaults:
run:
working-directory: ./backend
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create .env file
shell: bash
run: |
mv .env.ci .env
- name: Setup postgres
run: docker compose -f docker-compose.ci.yml up -d
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v3
name: Setup npm cache
id: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-npm-store-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-store-
- name: Install node modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install --no-lockfile --prefer-offline
- name: Build the project
run: npm run build
check-types:
defaults:
run:
working-directory: ./backend
name: Check Types
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v3
name: Setup npm cache
id: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-npm-store-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-store-
- name: Install node modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install --no-lockfile --prefer-offline
- name: Run type check
run: npm run typecheck
check-format:
defaults:
run:
working-directory: ./backend
name: Check format
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v3
name: Setup npm cache
id: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-npm-store-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-store-
- name: Install node modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install --no-lockfile --prefer-offline
- name: Run Prettier
run: npm run format:check
check-code-quality:
defaults:
run:
working-directory: ./backend
name: Check code quality
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v3
name: Setup npm cache
id: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-npm-store-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-store-
- name: Install node modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install --no-lockfile --prefer-offline
- name: Run ESLint
run: npm run lint
run-tests:
defaults:
run:
working-directory: ./backend
name: Run tests
needs: build
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Create .env file
shell: bash
run: |
mv .env.ci .env
- name: Setup postgres
run: docker compose -f docker-compose.ci.yml up -d
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 20
- uses: actions/cache@v3
name: Setup npm cache
id: cache-node-modules
with:
path: ./node_modules
key: ${{ runner.os }}-npm-store-${{ hashFiles('./package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-store-
- name: Install node modules
if: steps.cache-node-modules.outputs.cache-hit != 'true'
run: npm install --no-lockfile --prefer-offline
- name: Run tests
run: npm run test