build: switch from yarn to npm to manage js dependencies and move js contents to root
yarn v1 is being deprecated and starts to have some issues Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
@@ -13,7 +13,6 @@ stages:
|
||||
|
||||
variables:
|
||||
MIX_ENV: "test"
|
||||
YARN_CACHE_FOLDER: "js/.yarn"
|
||||
# DB Variables for Postgres / Postgis
|
||||
POSTGRES_DB: mobilizon_test
|
||||
POSTGRES_USER: postgres
|
||||
@@ -38,8 +37,8 @@ cache:
|
||||
paths:
|
||||
- deps/
|
||||
- _build/
|
||||
- js/node_modules
|
||||
- js/.yarn
|
||||
- node_modules
|
||||
- .npm
|
||||
|
||||
# Installed dependencies are cached across the pipeline
|
||||
# So there is no need to reinstall them all the time
|
||||
@@ -47,7 +46,7 @@ cache:
|
||||
install:
|
||||
stage: install
|
||||
script:
|
||||
- yarn --cwd "js" install --frozen-lockfile
|
||||
- npm ci
|
||||
- mix deps.get
|
||||
- mix compile
|
||||
|
||||
@@ -74,10 +73,10 @@ lint-front:
|
||||
stage: check
|
||||
before_script:
|
||||
- export EXITVALUE=0
|
||||
- yarn --cwd "js" install --frozen-lockfile
|
||||
- npm ci
|
||||
script:
|
||||
- yarn --cwd "js" run lint || export EXITVALUE=1
|
||||
- yarn --cwd "js" run prettier -c . || export EXITVALUE=1
|
||||
- npm run lint || export EXITVALUE=1
|
||||
- npm run prettier -c . || export EXITVALUE=1
|
||||
- exit $EXITVALUE
|
||||
|
||||
build-frontend:
|
||||
@@ -87,8 +86,8 @@ build-frontend:
|
||||
- apt update
|
||||
- apt install -y --no-install-recommends python build-essential webp imagemagick gifsicle jpegoptim optipng pngquant
|
||||
script:
|
||||
- yarn --cwd "js" install --frozen-lockfile
|
||||
- yarn --cwd "js" run build
|
||||
- npm install --frozen-lockfile
|
||||
- npm run build
|
||||
artifacts:
|
||||
expire_in: 5 days
|
||||
paths:
|
||||
@@ -118,7 +117,7 @@ deps:
|
||||
script:
|
||||
- export EXITVALUE=0
|
||||
- mix hex.outdated || export EXITVALUE=1
|
||||
- yarn --cwd "js" outdated || export EXITVALUE=1
|
||||
- npm outdated || export EXITVALUE=1
|
||||
- exit $EXITVALUE
|
||||
allow_failure: true
|
||||
needs:
|
||||
@@ -151,16 +150,16 @@ vitest:
|
||||
needs:
|
||||
- lint-front
|
||||
before_script:
|
||||
- yarn --cwd "js" install --frozen-lockfile
|
||||
- npm install --frozen-lockfile
|
||||
script:
|
||||
- yarn --cwd "js" run coverage --reporter=default --reporter=junit --outputFile.junit=./junit.xml
|
||||
- npm run coverage --reporter=default --reporter=junit --outputFile.junit=./junit.xml
|
||||
artifacts:
|
||||
when: always
|
||||
paths:
|
||||
- js/coverage
|
||||
- coverage
|
||||
reports:
|
||||
junit:
|
||||
- js/junit.xml
|
||||
- junit.xml
|
||||
expire_in: 30 days
|
||||
|
||||
e2e:
|
||||
@@ -175,11 +174,10 @@ e2e:
|
||||
- mix ecto.create
|
||||
- mix ecto.migrate
|
||||
- mix run priv/repo/e2e.seed.exs
|
||||
- cd js && yarn install && yarn run build && npx playwright install && cd ../
|
||||
- npm install && npm run build && npx playwright install
|
||||
- mix phx.digest
|
||||
script:
|
||||
- mix phx.server &
|
||||
- cd js
|
||||
- npx wait-on http://localhost:4000
|
||||
- npx playwright test --project $BROWSER
|
||||
parallel:
|
||||
@@ -188,8 +186,8 @@ e2e:
|
||||
artifacts:
|
||||
expire_in: 2 days
|
||||
paths:
|
||||
- js/playwright-report/
|
||||
- js/test-results/
|
||||
- playwright-report/
|
||||
- test-results/
|
||||
|
||||
pages:
|
||||
stage: deploy
|
||||
@@ -198,8 +196,8 @@ pages:
|
||||
- mix deps.get
|
||||
- mix docs
|
||||
- mv doc public/backend
|
||||
# #- yarn run --cwd "js" styleguide:build
|
||||
# #- mv js/styleguide public/frontend
|
||||
# #- npm run styleguide:build
|
||||
# #- mv styleguide public/frontend
|
||||
rules:
|
||||
- if: '$CI_COMMIT_BRANCH == "main"'
|
||||
artifacts:
|
||||
|
||||
Reference in New Issue
Block a user