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

Self contained front end and fixes for building on Heroku #829

Merged
merged 109 commits into from
May 1, 2024
Merged
Show file tree
Hide file tree
Changes from 104 commits
Commits
Show all changes
109 commits
Select commit Hold shift + click to select a range
90abca5
Webpack HTML plugin and dev server config
jonkafton Feb 21, 2024
84f4a6a
adding v1 current user view and updated tests
shanbady Mar 21, 2024
0a5b00b
adding updated frontend api client and openapi spec
shanbady Mar 21, 2024
b08fb4b
removing v1 api for profiles
shanbady Mar 22, 2024
bafc9ce
updating api spec
shanbady Mar 22, 2024
f26f1cd
Move frontend package root into ./frontends
jonkafton Mar 26, 2024
5fb9070
Static assets
jonkafton Mar 27, 2024
1a18cd6
Merge branch 'shanbady/endpoint-to-retrieve-session-data' into jk/fro…
jonkafton Mar 27, 2024
0d6e7ad
Webpack configuration and container for build/watch mode and dev serv…
jonkafton Mar 28, 2024
48364ba
The web service no longer needs to wait for healthy watch service
jonkafton Mar 28, 2024
2b2b87c
Working directory for yarn commands
jonkafton Mar 28, 2024
af5769d
Move TS and Jest config into frontends
jonkafton Mar 28, 2024
75cba0f
Merge branch 'main' into jk/frontend-dev-server
jonkafton Mar 28, 2024
d21ea79
Fix eslint paths
jonkafton Mar 28, 2024
55f3fe6
GH Actions working directories
jonkafton Mar 28, 2024
4ae2c65
actions/setup-node working directory
jonkafton Mar 28, 2024
ad6d2eb
Add yarn releases to version control
jonkafton Mar 28, 2024
094f5af
Fix version mismatches
jonkafton Mar 28, 2024
0666f37
Fetch user session dynamically from new endpoint
jonkafton Apr 1, 2024
3af6e6c
Fetch user hook. Update RestrictRoute tests.
jonkafton Apr 1, 2024
cf699df
Update tests for asynchronous user fetch / react query hook. Mocks re…
jonkafton Apr 3, 2024
7b0f111
Yarn v4 needs --all to iterate workspaces. Update e2e_test job paths
jonkafton Apr 3, 2024
85e1e68
Run openapi steps in frontends
jonkafton Apr 4, 2024
cbf6955
Run openapi steps in root
jonkafton Apr 4, 2024
3f460f3
Add github-pages to workspaces
jonkafton Apr 4, 2024
c5a16d2
Fix syncpack mismatches
jonkafton Apr 4, 2024
fea634a
Upgrade dependencies for yarn 4
jonkafton Apr 4, 2024
9b87d2f
Static file paths for nginx. Working directory for e2e tests.
jonkafton Apr 4, 2024
6dd2e01
Image path for python test and e2e tests working directory
jonkafton Apr 4, 2024
fe90d24
Install step for e2e dependencies
jonkafton Apr 4, 2024
b1b609f
Merge main and update tests for async user fetch
jonkafton Apr 4, 2024
5e5c6c3
Put back Dockerfile
jonkafton Apr 4, 2024
fc7a4dd
README notes for frontend development modes
jonkafton Apr 5, 2024
72c11a7
Spelling
jonkafton Apr 5, 2024
4efc410
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 5, 2024
da66eca
Ignore .yarn files outside of releases
jonkafton Apr 8, 2024
d6b086e
Wait for user loaded before rendering route
jonkafton Apr 8, 2024
5a6e382
Merge branch 'jk/frontend-dev-server' of https://github.com/mitodl/mi…
jonkafton Apr 8, 2024
65e6b41
Fix eslint version (new v9 has several breaking changes). Merge branc…
jonkafton Apr 8, 2024
af7ebd3
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Apr 8, 2024
f922594
Sync eslint versions
jonkafton Apr 8, 2024
135d230
Merge branch 'jk/frontend-dev-server' of https://github.com/mitodl/mi…
jonkafton Apr 8, 2024
06f3a33
Update tests to not depend on first render or inject to query cache
jonkafton Apr 8, 2024
f7dd808
Route /_features to the web service
jonkafton Apr 10, 2024
f3269df
Readme pointer. Remove dev server to prod API package scripts
jonkafton Apr 10, 2024
4ec540e
Install immutable
jonkafton Apr 10, 2024
b98048a
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 11, 2024
a0c1475
Serve Webpack within the watch container for Hot Module Replacement
jonkafton Apr 11, 2024
b7f6743
Add Django REST framework static assets paths to correctly render API…
jonkafton Apr 17, 2024
49f33ba
Remove the trailing slash on nginx matcher for /admin
jonkafton Apr 17, 2024
026cb58
Webpack plugin to enable HMR for React. Serve local watch on 8062
jonkafton Apr 17, 2024
6b0253b
Load env vars from .env file in Webpack config
jonkafton Apr 17, 2024
89d59b1
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 17, 2024
29589d3
Webpack versions
jonkafton Apr 18, 2024
ab90dde
Update README notes
jonkafton Apr 18, 2024
f3708fd
README tweak
jonkafton Apr 18, 2024
5aa641c
Nginx config for Heroku
jonkafton Apr 22, 2024
dcd5135
Spelling on filename
jonkafton Apr 22, 2024
c34e1c8
Remove root lockfile
jonkafton Apr 22, 2024
94ca75f
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 22, 2024
a6a7593
Upload front end build artifact and pull during release
jonkafton Apr 22, 2024
faad067
Fix paths
jonkafton Apr 22, 2024
840d827
Upload step ignores job working directory
jonkafton Apr 22, 2024
36a70a4
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 24, 2024
3ba29fe
Build front end to make available on Heroku
jonkafton Apr 24, 2024
472b99c
Move hash.txt location to frontend build dir
jonkafton Apr 24, 2024
35b6cdc
Disable E2E test job
jonkafton Apr 24, 2024
1e0be74
Known path for hash file
jonkafton Apr 24, 2024
9a27013
Build dir for version hash file
jonkafton Apr 24, 2024
69a66fb
Webpack to not clear build files in production mode
jonkafton Apr 24, 2024
b6632d7
Package.json at root for Heroku NodeJS buildpack
jonkafton Apr 24, 2024
08f12fc
Remove frontend build from release jobs
jonkafton Apr 24, 2024
39ef7d6
Set engines to instruct Heroku to install yarn
jonkafton Apr 24, 2024
ef4c7b8
Remove package manager config
jonkafton Apr 24, 2024
45d65c3
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 25, 2024
6927848
fixing compose mount (#818)
shanbady Apr 24, 2024
05564a4
Root package workspace for Heroku install/build
jonkafton Apr 25, 2024
4ab78e9
Exclude frontends (previous root) workspace from typecheck
jonkafton Apr 25, 2024
1482f72
Temp workflow
jonkafton Apr 25, 2024
ab1f77e
Match yarn version
jonkafton Apr 25, 2024
6229e51
Regenerate lockfile
jonkafton Apr 25, 2024
18d0061
Fix branch ref
jonkafton Apr 25, 2024
d3e0fb9
Add yarnrc file
jonkafton Apr 25, 2024
59a7cdd
Yarn release file
jonkafton Apr 25, 2024
13ca934
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 25, 2024
69d749b
Move watch container build context for package root
jonkafton Apr 25, 2024
2efbc60
Revert "Move watch container build context for package root"
jonkafton Apr 25, 2024
f7bd11a
Upgrade to yarn 4.1.1
jonkafton Apr 25, 2024
5f219f9
Remove frontend yarn files
jonkafton Apr 26, 2024
85ba9fb
Docker compose config for root context
jonkafton Apr 26, 2024
9fdc0f9
Script entrypoints for CI and run in project root
jonkafton Apr 26, 2024
53ec3ee
Working directories
jonkafton Apr 26, 2024
36886b6
Fix typecheck error on CI. Stray line (cat)?
jonkafton Apr 26, 2024
492bb5e
Comments E2E test report mv step
jonkafton Apr 26, 2024
e1ba86d
Test set yarn version
jonkafton Apr 26, 2024
d3ba581
Tests are running in frontends root - remove global: scripts
jonkafton Apr 26, 2024
a1a39a6
Frontends working directory. Remove test RC deploy workflow
jonkafton Apr 26, 2024
5896d6c
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 26, 2024
4ef295f
Test entry for correct path resolution
jonkafton Apr 29, 2024
38acc3e
Merge branch 'main' into jk/frontend-dev-server
jonkafton Apr 29, 2024
364e789
Lock React and @testing-library dependencies (conflict on React 18.3.…
jonkafton Apr 29, 2024
a31c009
Sync @types/react version
jonkafton Apr 29, 2024
b35a0a3
Lint fix extraneous deps
jonkafton Apr 29, 2024
2c370ac
Run tests from root
jonkafton Apr 29, 2024
142ccbb
Move watch mount to root. Add the storybook server back in
jonkafton May 1, 2024
432dec6
Install node modules in container
jonkafton May 1, 2024
9c5af83
Copy static assets for Storybook
jonkafton May 1, 2024
fd061cb
Script at root to run watch
jonkafton May 1, 2024
a245435
Installs git and mounts repo for Jest in watch mode. Stylelint config…
jonkafton May 1, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 0 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ LOG_LEVEL=info
MITOPEN_BASE_URL=http://od.odl.local:8063
MITOPEN_COOKIE_NAME=discussions
MITOPEN_COOKIE_DOMAIN=odl.local
MITOPEN_HOSTNAME=od.odl.local
MITOPEN_JWT_SECRET=
MITOPEN_USE_S3=False
INDEXING_API_USERNAME=mitodl
Expand Down
58 changes: 41 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,9 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
cache: "yarn"
node-version: "^20"
cache: yarn
cache-dependency-path: yarn.lock

- name: Setup environment
run: sudo apt-get install libelf1
Expand Down Expand Up @@ -136,28 +137,36 @@ jobs:
CODECOV: true
NODE_ENV: test

- name: Upload frontend build
uses: actions/upload-artifact@v4
with:
name: frontend-build
path: frontends/mit-open/build

- name: Upload coverage to CodeCov
uses: codecov/codecov-action@84508663e988701840491b86de86b666e8a86bed # v4.3.0
with:
file: coverage/lcov.info

build-storybook:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

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

- run: yarn install

- run: PUBLIC_URL=/mit-open yarn build-github-pages
working-directory: frontends

- run: PUBLIC_URL=/mit-open yarn build-storybook --output-dir ../github-pages/build/storybook
working-directory: frontends

- name: Setup Pages
uses: actions/configure-pages@983d7736d9b0ae728b81ab479565c72886d7745b # v5
Expand All @@ -181,8 +190,9 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
cache: "yarn"
node-version: "^20"
cache: yarn
cache-dependency-path: yarn.lock

- name: Install dependencies
run: yarn install --immutable
Expand All @@ -197,8 +207,10 @@ jobs:
--output $GENERATOR_OUTPUT_DIR_CI \
--ignore-file-override $GENERATOR_IGNORE_FILE \
-c scripts/openapi-configs/typescript-axios-v0.yaml

- name: Format freshly generated client
run: npx prettier $GENERATOR_OUTPUT_DIR_CI/**/*.ts --no-semi --write

- name: Check VC client is up-to-date
run: |
diff $GENERATOR_OUTPUT_DIR_CI $GENERATOR_OUTPUT_DIR_VC \
Expand All @@ -217,8 +229,9 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4
with:
node-version: "18.18.2"
cache: "yarn"
node-version: "^20"
cache: yarn
cache-dependency-path: yarn.lock

- name: Install dependencies
run: yarn install --immutable
Expand All @@ -233,25 +246,30 @@ jobs:
--output $GENERATOR_OUTPUT_DIR_CI \
--ignore-file-override $GENERATOR_IGNORE_FILE \
-c scripts/openapi-configs/typescript-axios-v1.yaml

- name: Format freshly generated client
run: npx prettier $GENERATOR_OUTPUT_DIR_CI/**/*.ts --no-semi --write

- name: Check VC client is up-to-date
run: |
diff $GENERATOR_OUTPUT_DIR_CI $GENERATOR_OUTPUT_DIR_VC \
|| { echo "OpenAPI spec is out of date. Please regenerate via ./scripts/generate_openapi.sh"; exit 1; }

e2e-tests:
# Disabling the E2E tests for now
if: false
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4

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

- name: Install dependencies
- name: Install frontend dependencies
run: yarn install --immutable

- name: Build frontend
Expand All @@ -266,11 +284,17 @@ jobs:
- name: Apply test data
run: ./e2e_testing/scripts/apply-fixtures.sh

- name: Install E2E test dependencies
working-directory: e2e_testing
run: yarn install --immutable

- name: Install Playwright browsers
run: yarn workspace e2e_testing playwright install --with-deps chromium
working-directory: e2e_testing
run: yarn playwright install --with-deps chromium

- name: Run E2E tests
run: BASE_URL=http://localhost:8063 CI=true yarn workspace e2e_testing test
working-directory: e2e_testing
run: BASE_URL=http://localhost:8063 CI=true yarn test

- name: Setup Pages
if: always()
Expand All @@ -296,14 +320,14 @@ jobs:

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

steps:
- name: Download artifacts
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4

- name: Move E2E test report
run: mv playwright-report pages-site/
# - name: Move E2E test report
# run: mv playwright-report pages-site/

- name: Upload artifact
uses: actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa # v3
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/production.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
ref: release

- uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
- uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
with:
ref: release-candidate

- uses: akhileshns/heroku-deploy@581dd286c962b6972d427fcf8980f60755c15520
with:
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
Expand Down
9 changes: 5 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,11 @@ celerybeat-schedule
docs/_site

.pnp.*
frontends/.yarn
!frontends/.yarn/releases

.yarn/*
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions

# Typescript
tsconfig.tsbuildinfo
Expand All @@ -135,3 +134,5 @@ storybook-static/
/e2e_testing/blob-report/
/e2e_testing/playwright/.cache/
!/e2e_testing/.env

e2e_testing/.yarn/cache
3 changes: 3 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ repos:
exclude: ".hbs$"
- id: check-yaml
- id: check-added-large-files
exclude: "yarn.lock|.yarn/releases/*|frontends/.yarn/releases/*"
- id: check-merge-conflict
- id: check-toml
- id: debug-statements
Expand Down Expand Up @@ -84,6 +85,8 @@ repos:
args: []
exclude: "(node_modules/|.yarn/)"
require_serial: false
additional_dependencies:
- eslint@8
- id: style-lint
name: style-lint
description: "Lint CSS"
Expand Down
28 changes: 0 additions & 28 deletions .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

This file was deleted.

875 changes: 0 additions & 875 deletions .yarn/releases/yarn-3.8.1.cjs

This file was deleted.