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

POC: Switch to pnpm workspaces #3523

Draft
wants to merge 18 commits into
base: integration
Choose a base branch
from
Draft
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
15 changes: 10 additions & 5 deletions .github/workflows/automated_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
api_unit_tests:
name: API Unit Tests
runs-on: ubuntu-20.04
container: node:18.16.1
container: node:20.18
services:
postgres:
image: postgres:13
Expand All @@ -37,13 +37,18 @@ jobs:
steps:
# Checkout the current code in the repository
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
# Install pnpm
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 9
# Install all the dependencies
- name: Install dependencies
run: cd packages/api && npm ci && cd ../shared && npm ci
run: pnpm i
# Run migrations on the database
- name: Setup database
run: cd packages/api && npm run migrate:pipeline:db
run: pnpm -F '*api' migrate:pipeline:db
# Run all the CI tests
- name: Run tests
run: cd packages/api && npm run test-ci
run: pnpm -F '*api' test-ci
12 changes: 9 additions & 3 deletions .github/workflows/chromatic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,19 @@ jobs:
working-directory: packages/webapp
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup pnpm
uses: pnpm/action-setup@v2
uses: pnpm/action-setup@v4
with:
version: latest
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Publish to Chromatic
Expand Down
25 changes: 13 additions & 12 deletions .github/workflows/cypress_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
- postgres-data:/var/lib/postgresql/data
strategy:
matrix:
node-version: [18.16.1]
node-version: [20.18]
env:
JWT_SECRET: This_will_(really)_work
JWT_INVITE_SECRET: Any_arbitrary_string_will_do
Expand All @@ -48,30 +48,31 @@ jobs:
NODE_ENV: development

steps:
- uses: actions/checkout@v2

- uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run API in background
working-directory: packages/api
run: |
npm ci && cd ../shared && npm ci
cd ../api && npm run migrate:dev:db
npm run start &
pnpm run migrate:dev:db
pnpm start &
env:
PORT: 5000
DEV_DATABASE_HOST: localhost
DEV_DATABASE: pg-litefarm
DEV_DATABASE_USER: postgres
DEV_DATABASE_PASSWORD: postgres
NODE_ENV: development

- uses: pnpm/action-setup@v2
with:
version: latest
- name: Run Webapp
working-directory: packages/webapp
run: |
Expand Down
34 changes: 24 additions & 10 deletions .github/workflows/lint_translation_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,25 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up pnpm
uses: pnpm/action-setup@v2.0.1
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 6.26.1
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.18
cache: "pnpm"

- name: Install pnpm dependencies
run: pnpm install

- name: Run linters
run: npx eslint './public/locales/**/*.json'
run: pnpm exec eslint './public/locales/**/*.json'

run-linters-in-api:
name: Run linters in api
Expand All @@ -39,15 +46,22 @@ jobs:

steps:
- name: Check out Git repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Node.js
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
run_install: false

- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20.18
cache: "pnpm"

- name: Install dependencies for Node.js server
run: npm install
run: pnpm install

- name: Run linters
run: npx eslint './src/jobs/locales/**/*.json' './src/templates/locales/**/*.json'
run: pnpm exec eslint './src/jobs/locales/**/*.json' './src/templates/locales/**/*.json'
12 changes: 9 additions & 3 deletions .github/workflows/webapp_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,17 @@ jobs:
working-directory: packages/webapp
steps:
- name: Check out repository code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v2.0.1
uses: pnpm/action-setup@v4
with:
version: 6.26.1
version: 9
run_install: false
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 20.18
cache: "pnpm"
- name: Install dependencies
run: pnpm install
- name: Run unit tests
Expand Down
6 changes: 1 addition & 5 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

# For packages/api and packages/webapp
npx lerna run --concurrency 1 --stream precommit --since HEAD --exclude-dependents

# For root directory, which is not managed by lerna
npx lint-staged
pnpm exec lint-staged
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
engine-strict=true
include-workspace-root=true
Loading