1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-20 00:08:02 +01:00

chore: avoid building frontend when possible (#3278)

## About the changes
This is based on @nunogois suggestion to split the build in two, so we
don't build the frontend every time we run `yarn`

e2e frontend tests were forced to run by modifying frontend/README.md

### Important files
Some github actions had to be updated to also build the frontend. The
Dockerfile building our docker image was also looked into but it should
work as is


## Discussion points
This is a potentially risky operation as we might overlook something
that requires building the frontend which might lead to invalid builds.
We need to make sure when we do this we don't have any release planned.
This commit is contained in:
Gastón Fournier 2023-03-15 13:17:32 +01:00 committed by GitHub
parent c2d51e4549
commit 8cdd68914e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 9 additions and 3 deletions

View File

@ -38,6 +38,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn
# - run: yarn build:frontend # not needed
- run: yarn lint
- run: yarn run test
env:

View File

@ -39,6 +39,7 @@ jobs:
node-version: ${{ matrix.node-version }}
cache: 'yarn'
- run: yarn
- run: yarn build:frontend
- run: yarn run test:coverage
env:
CI: true

View File

@ -20,3 +20,4 @@ jobs:
- run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn lint
- run: yarn build
#- run: yarn build:frontend # not needed

View File

@ -22,6 +22,7 @@ jobs:
cache: 'yarn'
- run: |
yarn install --frozen-lockfile
yarn --cwd ./frontend install --frozen-lockfile
- run: |
LATEST=$(npm show unleash-server version)
TAG=$(node scripts/npm-tag.js $LATEST)

View File

@ -8,7 +8,7 @@ First, start the unleash-api backend on port 4242.
Then, start the frontend dev server:
```
cd ~/frontend
cd ./frontend
yarn install
yarn run start
```
@ -18,7 +18,7 @@ yarn run start
Alternatively, instead of running unleash-api on localhost, you can use a remote instance:
```
cd ~/frontend
cd ./frontend
yarn install
yarn run start:sandbox
```

View File

@ -38,13 +38,15 @@
"build:watch": "tsc -w --strictNullChecks false",
"prebuild": "yarn run clean",
"build": "yarn run copy-templates && tsc --pretty --strictNullChecks false",
"prepare": "node scripts/husky-install && cd frontend && yarn && cd .. && yarn run build",
"build:frontend": "yarn --cwd ./frontend",
"prepare": "node scripts/husky-install && yarn run build",
"test": "NODE_ENV=test PORT=4243 jest",
"test:unit": "NODE_ENV=test PORT=4243 jest --testPathIgnorePatterns=src/test/e2e --testPathIgnorePatterns=dist",
"test:docker": "./scripts/docker-postgres.sh",
"test:docker:cleanup": "docker rm -f unleash-postgres",
"test:watch": "yarn test --watch",
"test:coverage": "NODE_ENV=test PORT=4243 jest --coverage --testLocationInResults --outputFile=\"coverage/report.json\" --forceExit --testTimeout=10000",
"pretest:coverage:jest": "yarn build:frontend",
"test:coverage:jest": "NODE_ENV=test PORT=4243 jest --silent --ci --json --coverage --testLocationInResults --outputFile=\"report.json\" --forceExit --testTimeout=10000",
"seed:setup": "ts-node src/test/e2e/seed/segment.seed.ts",
"seed:serve": "UNLEASH_DATABASE_NAME=unleash_test UNLEASH_DATABASE_SCHEMA=seed yarn run start:dev",