Skip to content
Closed
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
119 changes: 119 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@
name: CI

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

on:
push:
branches: ['main']
paths-ignore:
- .gitignore
- LICENSE
- README.md
pull_request:
branches: ['*']
paths-ignore:
- .gitignore
- LICENSE
- README.md

jobs:
format:
name: Format
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Format
run: pnpm format

lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Lint
run: pnpm lint

check:
name: Check
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Bootstrap
run: pnpm bootstrap

- name: Check
run: pnpm -r check

test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup PNPM
uses: pnpm/action-setup@v4
with:
version: 10

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: pnpm

- name: Install dependencies
run: pnpm install

- name: Test
run: pnpm -r test
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ brew install pnpm
pnpm install
```

3. Bootstrap the project:
3. Sets up the project:

```sh
./bootstrap.sh
./setup.sh
```

4. Start local services:
Expand All @@ -44,6 +44,7 @@ All commands are run from the root of the project, from a terminal:
| :------------------- | :-------------------------------- |
| `pnpm learner:dev` | Starts the `learner` dev server |
| `pnpm learner:build` | Builds the `learner` application |
| `pnpm auth:build` | Builds the `@onward/auth` library |
| `pnpm auth:build` | Builds the `@onward/auth` package |
| `pnpm bootstrap` | Builds all internal dependencies |
| `pnpm format` | Format the entrie codebase |
| `pnpm lint` | Lint the entire codebase |
2 changes: 1 addition & 1 deletion apps/learner/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ COPY . .
RUN pnpm install --offline

# Build internal dependencies.
RUN pnpm --filter="@onward/auth" build
RUN pnpm bootstrap

# Build learner app.
RUN pnpm --filter="learner" build
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"learner:dev": "pnpm --filter=\"learner\" dev",
"learner:build": "pnpm --filter=\"learner\" build",
"auth:build": "pnpm --filter=\"auth\" build",
"bootstrap": "pnpm --filter=\"./packages/*\" build",
"format": "prettier --check \"**/*.{svelte,js,ts,md,html,css,json}\"",
"lint": "eslint \"**/*.{svelte,js,ts}\"",
"prepare": "husky"
Expand Down
4 changes: 2 additions & 2 deletions bootstrap.sh → setup.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/sh

# Bootstraps the project by:
# Sets up the project by:
# 1. Copies the `.env.example` file to `.env` if it doesn't already exist.
# 2. Creates symlinks to `.env` in the apps that require it.
# 3. Builds all packages for apps to use.
Expand All @@ -9,4 +9,4 @@ cp -n .env.example .env

ln -sf "$(pwd)/.env" ./apps/learner/.env

pnpm --filter="./packages/*" build
pnpm bootstrap