diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 00000000..68f7f199 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -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 diff --git a/README.md b/README.md index f673ce1e..0443e428 100644 --- a/README.md +++ b/README.md @@ -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: @@ -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 | diff --git a/apps/learner/Dockerfile b/apps/learner/Dockerfile index 0c711c54..5b3fd302 100644 --- a/apps/learner/Dockerfile +++ b/apps/learner/Dockerfile @@ -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 diff --git a/package.json b/package.json index 86a5ce61..3869e3d3 100644 --- a/package.json +++ b/package.json @@ -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" diff --git a/bootstrap.sh b/setup.sh similarity index 80% rename from bootstrap.sh rename to setup.sh index 47799e86..a18db167 100755 --- a/bootstrap.sh +++ b/setup.sh @@ -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. @@ -9,4 +9,4 @@ cp -n .env.example .env ln -sf "$(pwd)/.env" ./apps/learner/.env -pnpm --filter="./packages/*" build +pnpm bootstrap