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

chore: add basic github workflow #208

Merged
merged 6 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 69 additions & 0 deletions .github/workflows/ci.yml
Copy link
Member Author

Choose a reason for hiding this comment

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

there's probably a way to de-duplicate some of the setup steps that are shared by these jobs but can look into it as a follow-up

note to self: look into composite actions

Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: CI

on:
push:
branches: [main]
pull_request:
# By default, a workflow only runs when a pull_request's activity type is
# opened, synchronize, or reopened. Adding ready_for_review here ensures
# that CI runs when a PR is marked as not a draft, since we skip CI when a
# PR is draft
types: [opened, synchronize, reopened, ready_for_review]

jobs:
all:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install deps
run: npm ci
- name: Check formatting
run: npm run lint:prettier

backend:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
defaults:
run:
working-directory: './src/backend'
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install deps
run: |
npm ci --ignore-scripts
npm run postinstall
- name: Check types
run: npm run lint:types

frontend:
runs-on: ubuntu-latest
timeout-minutes: 10
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version-file: '.nvmrc'
- name: Install deps
run: npm ci
- name: Build translations
run: npm run build:translations
- name: Build Intl polyfills
run: npm run build:intl-polyfills
- name: Run unit tests
run: npm test
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"test": "jest",
"lint:prettier": "prettier \"src/**/*.{js,ts,jsx,tsx}\" --check",
"lint:eslint": "eslint . --ext .js,.jsx,.ts,.tsx --cache --ignore-path .gitignore",
"lint": "npm run lint:prettier && npm run lint:eslint",
"lint:types": "tsc --noEmit",
"lint": "npm run lint:prettier && npm run lint:eslint && npm run lint:types",
"postinstall": "patch-package",
"prepare": "husky install",
"format": "prettier \"src/**/*.{js,ts,jsx,tsx}\" --write",
Expand Down
2 changes: 1 addition & 1 deletion src/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"main": "index.js",
"scripts": {
"build": "node ./scripts/bundle-backend.mjs --entry=index.js --output=index.bundle.js",
"lint": "tsc",
"lint:types": "tsc --noEmit",
"postinstall": "patch-package"
},
"author": "Digital Democracy",
Expand Down
1 change: 0 additions & 1 deletion src/backend/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
"./node_modules/@digidem/types/vendor/*/index.d.ts"
]
},
"resolveJsonModule": true,
"allowJs": true,
"checkJs": true,
"noEmit": true,
Expand Down
Loading