Skip to content

Commit

Permalink
Script entrypoints for CI and run in project root
Browse files Browse the repository at this point in the history
  • Loading branch information
jonkafton committed Apr 26, 2024
1 parent 85ba9fb commit 9fdc0f9
Show file tree
Hide file tree
Showing 4 changed files with 221 additions and 184 deletions.
35 changes: 12 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,13 @@ jobs:

javascript-tests:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontends
steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
node-version: "^20"
cache: yarn
cache-dependency-path: frontends/yarn.lock
cache-dependency-path: yarn.lock

- name: Setup environment
run: sudo apt-get install libelf1
Expand Down Expand Up @@ -153,18 +150,15 @@ jobs:

build-storybook:
runs-on: ubuntu-latest
defaults:
run:
working-directory: frontends
steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
node-version: "^20"
cache: yarn
cache-dependency-path: frontends/yarn.lock
cache-dependency-path: yarn.lock

- run: yarn install

Expand Down Expand Up @@ -194,12 +188,11 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
node-version: "^20"
cache: yarn
cache-dependency-path: frontends/yarn.lock
cache-dependency-path: yarn.lock

- name: Install dependencies
working-directory: frontends
run: yarn install --immutable

- name: Generate Fresh API Client
Expand All @@ -215,7 +208,7 @@ jobs:
- name: Format freshly generated client
working-directory: frontends
run: npx prettier ../$GENERATOR_OUTPUT_DIR_CI/**/*.ts --no-semi --write
run: npx prettier $GENERATOR_OUTPUT_DIR_CI/**/*.ts --no-semi --write

- name: Check VC client is up-to-date
run: |
Expand All @@ -235,12 +228,11 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
node-version: "^20"
cache: yarn
cache-dependency-path: frontends/yarn.lock
cache-dependency-path: yarn.lock

- name: Install dependencies
working-directory: frontends
run: yarn install --immutable

- name: Generate Fresh API Client
Expand All @@ -255,8 +247,7 @@ jobs:
-c scripts/openapi-configs/typescript-axios-v1.yaml
- name: Format freshly generated client
working-directory: frontends
run: npx prettier ../$GENERATOR_OUTPUT_DIR_CI/**/*.ts --no-semi --write
run: npx prettier $GENERATOR_OUTPUT_DIR_CI/**/*.ts --no-semi --write

- name: Check VC client is up-to-date
run: |
Expand All @@ -273,16 +264,14 @@ jobs:

- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
node-version: "^20"
cache: yarn
cache-dependency-path: e2e_testing/yarn.lock

- name: Install frontend dependencies
working-directory: frontends
run: yarn install --immutable

- name: Build frontend
working-directory: frontends
run: NODE_ENV=production yarn build

- name: Build services
Expand Down Expand Up @@ -330,7 +319,7 @@ jobs:

needs:
- build-storybook
- e2e-tests
# - e2e-tests

steps:
- name: Download artifacts
Expand Down
10 changes: 5 additions & 5 deletions frontends/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"fmt-fix": "prettier --write .",
"test": "yarn global:test",
"test-watch": "yarn global:test-watch",
"style-lint": "yarn foreach global:style-lint",
"style-lint-fix": "yarn foreach global:style-lint-fix",
"typecheck": "yarn workspaces foreach -A --exclude . run global:typecheck",
"style-lint": "yarn in-workspaces run global:style-lint",
"style-lint-fix": "yarn in-workspaces run global:style-lint-fix",
"typecheck": "yarn in-workspaces run global:typecheck",
"global:style-lint": "cd $INIT_CWD && stylelint '**/*.{css,scss,ts,tsx}' --allow-empty-input",
"global:style-lint-fix": "cd $INIT_CWD && stylelint '**/*.{css,scss,ts,tsx}' --allow-empty-input --fix",
"global:test": "cd $INIT_CWD && NODE_ENV=test jest",
Expand All @@ -36,7 +36,8 @@
"create-package": "yarn workspace ol-template plop package",
"build-github-pages": "yarn workspace github-pages build",
"storybook": "yarn workspace mit-open storybook",
"build-storybook": "yarn workspace mit-open build-storybook"
"build-storybook": "yarn workspace mit-open build-storybook",
"in-workspaces": "yarn workspaces foreach -A --exclude . --exclude frontends"
},
"version": "0.0.0",
"devDependencies": {
Expand Down Expand Up @@ -72,7 +73,6 @@
"prettier-plugin-django-alpine": "^1.2.6",
"stylelint": "^15.2.0",
"stylelint-config-standard-scss": "^7.0.1",
"syncpack": "^11.2.1",
"ts-node": "^10.9.2",
"type-fest": "^4.14.0",
"typescript": "^5.4.3"
Expand Down
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,15 @@
"frontends"
],
"scripts": {
"build": "yarn workspace mit-open run build"
"build": "yarn workspace mit-open run build",
"style-lint": "yarn workspace frontends run style-lint",
"test": "yarn workspace frontends global:test",
"lint-check": "yarn workspace frontends run lint-check",
"typecheck": "yarn workspace frontends run typecheck",
"build-storybook": "yarn workspace frontends run build-storybook"
},
"packageManager": "[email protected]"
"packageManager": "[email protected]",
"devDependencies": {
"syncpack": "^12.3.2"
}
}
Loading

0 comments on commit 9fdc0f9

Please sign in to comment.