mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-03-17 04:02:30 +00:00
refactor: speed up the pipeline by directly deploying the review app from the build step
This commit is contained in:
@@ -15,12 +15,23 @@ include:
|
|||||||
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
- if: $CI_PIPELINE_SOURCE == "merge_request_event"
|
||||||
when: never
|
when: never
|
||||||
|
|
||||||
|
variables:
|
||||||
|
TURBO_CACHE_BYPASS:
|
||||||
|
value: ''
|
||||||
|
options:
|
||||||
|
- '--force'
|
||||||
|
- '--no-cache'
|
||||||
|
- ''
|
||||||
|
description: Bypass turbo cache
|
||||||
|
|
||||||
default:
|
default:
|
||||||
image: registry.gitlab.com/openstapps/projectmanagement/builder:v18
|
image: registry.gitlab.com/openstapps/projectmanagement/builder:v18
|
||||||
tags:
|
tags:
|
||||||
- performance
|
- performance
|
||||||
interruptible: true
|
interruptible: true
|
||||||
before_script:
|
before_script:
|
||||||
|
- corepack enable
|
||||||
|
- corepack prepare pnpm@latest-8 --activate
|
||||||
- echo TURBO_API=$TURBO_API >> .env.local
|
- echo TURBO_API=$TURBO_API >> .env.local
|
||||||
- echo TURBO_TOKEN=$TURBO_TOKEN >> .env.local
|
- echo TURBO_TOKEN=$TURBO_TOKEN >> .env.local
|
||||||
- echo TURBO_TEAM=$TURBO_TEAM >> .env.local
|
- echo TURBO_TEAM=$TURBO_TEAM >> .env.local
|
||||||
@@ -37,34 +48,59 @@ stages:
|
|||||||
- version
|
- version
|
||||||
- build
|
- build
|
||||||
- test
|
- test
|
||||||
- review
|
|
||||||
- publish
|
- publish
|
||||||
|
|
||||||
build:
|
build:
|
||||||
stage: build
|
stage: build
|
||||||
script:
|
script:
|
||||||
- pnpm config set recursive-install false
|
# - pnpm config set recursive-install false
|
||||||
- pnpm i --prefer-offline
|
# - pnpm i --prefer-offline
|
||||||
- pnpm build:full:skip || pnpm i -r --prefer-offline
|
# - pnpm build:full:skip || pnpm i -r --prefer-offline
|
||||||
- pnpm build:full
|
- pnpm install
|
||||||
- mv frontend/app/www www
|
- pnpm build:full $TURBO_CACHE_BYPASS
|
||||||
artifacts:
|
# pretty sure this is deprecated?
|
||||||
paths:
|
# TODO: - .gitlab/ci/enableGitlabReviewToolbar.sh www/index.html "$CI_PROJECT_ID" "$CI_OPEN_MERGE_REQUESTS"
|
||||||
- www
|
- cp frontend/app/www/index.html frontend/app/www/200.html
|
||||||
|
- pnpm dlx surge -p frontend/app/www -d https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
|
||||||
cache:
|
cache:
|
||||||
<<: *pnpm_cache
|
<<: *pnpm_cache
|
||||||
policy: pull-push
|
policy: pull-push
|
||||||
rules:
|
environment:
|
||||||
- when: on_success
|
name: review/$DEPLOY_ID
|
||||||
|
url: https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
|
||||||
|
on_stop: stop review
|
||||||
|
rules: &deploy-rules
|
||||||
|
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
||||||
|
variables:
|
||||||
|
DEPLOY_ID: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'main'
|
||||||
|
variables:
|
||||||
|
DEPLOY_ID: production
|
||||||
|
- if: $CI_COMMIT_BRANCH == 'develop'
|
||||||
|
variables:
|
||||||
|
DEPLOY_ID: staging
|
||||||
|
|
||||||
|
stop review:
|
||||||
|
stage: build
|
||||||
|
needs: ['build']
|
||||||
|
script:
|
||||||
|
- pnpm dlx surge teardown $CI_PROJECT_NAME-$DEPLOY_ID.surge.sh
|
||||||
|
environment:
|
||||||
|
name: review/$DEPLOY_ID
|
||||||
|
action: stop
|
||||||
|
when: manual
|
||||||
|
rules: *deploy-rules
|
||||||
|
|
||||||
unit:
|
unit:
|
||||||
stage: test
|
stage: test
|
||||||
needs: ['build']
|
needs: ['build']
|
||||||
script:
|
script:
|
||||||
- pnpm config set recursive-install false
|
# - pnpm config set recursive-install false
|
||||||
- pnpm i --prefer-offline
|
# - pnpm i --prefer-offline
|
||||||
- pnpm test:skip || pnpm i -r --prefer-offline
|
# - pnpm test:skip || pnpm i -r --prefer-offline
|
||||||
- pnpm test
|
- pnpm install
|
||||||
|
- pnpm rb --filter=@openstapps/app
|
||||||
|
- pnpm test $TURBO_CACHE_BYPASS
|
||||||
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
|
coverage: '/Statements[^:]*\:[^:]*\s+([\d\.]+)%/'
|
||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
|
|||||||
2
.npmrc
2
.npmrc
@@ -1,2 +1,2 @@
|
|||||||
auto-install-peers=true
|
auto-install-peers=true
|
||||||
recursive-install=false
|
package-import-method=hardlink
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ integration:
|
|||||||
- name: registry.gitlab.com/openstapps/database:latest
|
- name: registry.gitlab.com/openstapps/database:latest
|
||||||
alias: elasticsearch
|
alias: elasticsearch
|
||||||
script:
|
script:
|
||||||
- pnpm --filter=@openstapps/backend install --prefer-offline
|
- pnpm --filter=@openstapps/backend install
|
||||||
- pnpm test:integration:backend
|
- pnpm test:integration:backend
|
||||||
artifacts:
|
artifacts:
|
||||||
when: always
|
when: always
|
||||||
|
|||||||
1
frontend/app/.gitignore
vendored
1
frontend/app/.gitignore
vendored
@@ -43,3 +43,4 @@ Thumbs.db
|
|||||||
UserInterfaceState.xcuserstate
|
UserInterfaceState.xcuserstate
|
||||||
|
|
||||||
docs
|
docs
|
||||||
|
bundle-info.html
|
||||||
|
|||||||
@@ -1,12 +1,8 @@
|
|||||||
e2e:
|
e2e:
|
||||||
image: cypress/browsers:latest # https://hub.docker.com/r/cypress/browsers/tags/
|
image: cypress/browsers:latest # https://hub.docker.com/r/cypress/browsers/tags/
|
||||||
stage: test
|
stage: test
|
||||||
before_script:
|
|
||||||
- corepack enable
|
|
||||||
- corepack prepare pnpm@latest-8 --activate
|
|
||||||
- !reference [default, before_script]
|
|
||||||
script:
|
script:
|
||||||
- pnpm --filter=@openstapps/app install --prefer-offline
|
- pnpm --filter=@openstapps/app install
|
||||||
- pnpm --filter=@openstapps/app exec cypress install
|
- pnpm --filter=@openstapps/app exec cypress install
|
||||||
- pnpm test:integration:app
|
- pnpm test:integration:app
|
||||||
artifacts:
|
artifacts:
|
||||||
@@ -24,37 +20,3 @@ e2e:
|
|||||||
- BROWSER: firefox
|
- BROWSER: firefox
|
||||||
rules:
|
rules:
|
||||||
- when: on_success
|
- when: on_success
|
||||||
|
|
||||||
review:
|
|
||||||
stage: review
|
|
||||||
needs: ['build']
|
|
||||||
script:
|
|
||||||
# pretty sure this is deprecated?
|
|
||||||
# TODO: - .gitlab/ci/enableGitlabReviewToolbar.sh www/index.html "$CI_PROJECT_ID" "$CI_OPEN_MERGE_REQUESTS"
|
|
||||||
- cp www/index.html www/200.html
|
|
||||||
- pnpm dlx surge -p ./www -d https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
|
|
||||||
environment:
|
|
||||||
name: review/$DEPLOY_ID
|
|
||||||
url: https://$CI_PROJECT_NAME-$DEPLOY_ID.surge.sh/
|
|
||||||
on_stop: stop review
|
|
||||||
rules: &deploy-rules
|
|
||||||
- if: $CI_PIPELINE_SOURCE == 'merge_request_event'
|
|
||||||
variables:
|
|
||||||
DEPLOY_ID: $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME
|
|
||||||
- if: $CI_COMMIT_BRANCH == 'main'
|
|
||||||
variables:
|
|
||||||
DEPLOY_ID: production
|
|
||||||
- if: $CI_COMMIT_BRANCH == 'develop'
|
|
||||||
variables:
|
|
||||||
DEPLOY_ID: staging
|
|
||||||
|
|
||||||
stop review:
|
|
||||||
stage: review
|
|
||||||
needs: ['review']
|
|
||||||
script:
|
|
||||||
- pnpm dlx surge teardown $CI_PROJECT_NAME-$DEPLOY_ID.surge.sh
|
|
||||||
environment:
|
|
||||||
name: review/$DEPLOY_ID
|
|
||||||
action: stop
|
|
||||||
when: manual
|
|
||||||
rules: *deploy-rules
|
|
||||||
|
|||||||
@@ -1 +0,0 @@
|
|||||||
engine-strict=true
|
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
{
|
{
|
||||||
"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
|
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
|
||||||
"version": 1,
|
"version": 1,
|
||||||
"defaultProject": "app",
|
"defaultProject": "app",
|
||||||
"newProjectRoot": "projects",
|
"newProjectRoot": "projects",
|
||||||
@@ -19,6 +19,8 @@
|
|||||||
"main": "src/main.ts",
|
"main": "src/main.ts",
|
||||||
"polyfills": "src/polyfills.ts",
|
"polyfills": "src/polyfills.ts",
|
||||||
"tsConfig": "tsconfig.app.json",
|
"tsConfig": "tsconfig.app.json",
|
||||||
|
"aot": true,
|
||||||
|
"allowedCommonJsDependencies": ["moment", "opening_hours"],
|
||||||
"assets": [
|
"assets": [
|
||||||
{
|
{
|
||||||
"glob": "**/*",
|
"glob": "**/*",
|
||||||
@@ -203,6 +205,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cli": {
|
"cli": {
|
||||||
|
"packageManager": "pnpm",
|
||||||
"defaultCollection": "@ionic/angular-toolkit",
|
"defaultCollection": "@ionic/angular-toolkit",
|
||||||
"analytics": false
|
"analytics": false
|
||||||
},
|
},
|
||||||
|
|||||||
11
frontend/app/ngcc-postinstall.mjs
Normal file
11
frontend/app/ngcc-postinstall.mjs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import {process} from '@angular/compiler-cli/ngcc';
|
||||||
|
import path from 'path';
|
||||||
|
|
||||||
|
const legacyViewEngineLibraries = [
|
||||||
|
['@awesome-cordova-plugins', 'calendar'],
|
||||||
|
['@ionic-native', 'core'],
|
||||||
|
];
|
||||||
|
|
||||||
|
for (const basePath of legacyViewEngineLibraries) {
|
||||||
|
process({basePath: path.resolve(path.join('node_modules', ...basePath))});
|
||||||
|
}
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"analyze": "webpack-bundle-analyzer www/stats.json",
|
"analyze": "webpack-bundle-analyzer www/stats.json",
|
||||||
"build": "ng build",
|
"build": "ng build --configuration=production --stats-json && webpack-bundle-analyzer www/stats.json --mode static --report www/bundle-info.html",
|
||||||
"build:analyze": "npm run build:stats && npm run analyze",
|
"build:analyze": "npm run build:stats && npm run analyze",
|
||||||
"build:android": "ionic capacitor build android --no-open && cd android && ./gradlew clean assembleDebug && cd ..",
|
"build:android": "ionic capacitor build android --no-open && cd android && ./gradlew clean assembleDebug && cd ..",
|
||||||
"build:prod": "ng build --configuration=production",
|
"build:prod": "ng build --configuration=production",
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts,.html src/",
|
"lint:fix": "eslint --fix -c .eslintrc.json --ignore-path .eslintignore --ext .ts,.html src/",
|
||||||
"minify-icons": "ts-node scripts/minify-icon-font.ts",
|
"minify-icons": "ts-node scripts/minify-icon-font.ts",
|
||||||
"ng": "ng",
|
"ng": "ng",
|
||||||
"postinstall": "jetify || echo \"skipping jetify in production mode\"",
|
"postinstall": "(jetify && node ngcc-postinstall.mjs) || echo \"skipping jetify in production mode\"",
|
||||||
"preview": "http-server www --p 8101 -o",
|
"preview": "http-server www --p 8101 -o",
|
||||||
"push": "git push && git push origin \"v$npm_package_version\"",
|
"push": "git push && git push origin \"v$npm_package_version\"",
|
||||||
"resources:android": "cordova-res android --skip-config --copy",
|
"resources:android": "cordova-res android --skip-config --copy",
|
||||||
@@ -50,13 +50,13 @@
|
|||||||
"test:integration": "sh integration-test.sh"
|
"test:integration": "sh integration-test.sh"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@angular/animations": "13.3.11",
|
"@angular/animations": "13.4.0",
|
||||||
"@angular/cdk": "13.3.9",
|
"@angular/cdk": "13.3.9",
|
||||||
"@angular/common": "13.3.11",
|
"@angular/common": "13.4.0",
|
||||||
"@angular/core": "13.3.11",
|
"@angular/core": "13.4.0",
|
||||||
"@angular/forms": "13.3.11",
|
"@angular/forms": "13.4.0",
|
||||||
"@angular/platform-browser": "13.3.11",
|
"@angular/platform-browser": "13.4.0",
|
||||||
"@angular/router": "13.3.11",
|
"@angular/router": "13.4.0",
|
||||||
"@asymmetrik/ngx-leaflet": "13.0.2",
|
"@asymmetrik/ngx-leaflet": "13.0.2",
|
||||||
"@asymmetrik/ngx-leaflet-markercluster": "13.0.1",
|
"@asymmetrik/ngx-leaflet-markercluster": "13.0.1",
|
||||||
"@awesome-cordova-plugins/calendar": "5.45.0",
|
"@awesome-cordova-plugins/calendar": "5.45.0",
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
"leaflet.markercluster": "1.5.3",
|
"leaflet.markercluster": "1.5.3",
|
||||||
"material-symbols": "0.4.1",
|
"material-symbols": "0.4.1",
|
||||||
"moment": "2.29.4",
|
"moment": "2.29.4",
|
||||||
"ngx-logger": "4.3.3",
|
"ngx-logger": "5.0.12",
|
||||||
"ngx-markdown": "13.1.0",
|
"ngx-markdown": "13.1.0",
|
||||||
"ngx-moment": "6.0.2",
|
"ngx-moment": "6.0.2",
|
||||||
"opening_hours": "3.8.0",
|
"opening_hours": "3.8.0",
|
||||||
@@ -107,19 +107,19 @@
|
|||||||
"zone.js": "0.12.0"
|
"zone.js": "0.12.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@angular-devkit/architect": "0.1303.9",
|
"@angular-devkit/architect": "0.1303.11",
|
||||||
"@angular-devkit/build-angular": "13.3.9",
|
"@angular-devkit/build-angular": "13.3.11",
|
||||||
"@angular-devkit/core": "13.3.9",
|
"@angular-devkit/core": "13.3.11",
|
||||||
"@angular-devkit/schematics": "13.3.9",
|
"@angular-devkit/schematics": "13.3.11",
|
||||||
"@angular-eslint/builder": "13.5.0",
|
"@angular-eslint/builder": "13.5.0",
|
||||||
"@angular-eslint/eslint-plugin": "13.5.0",
|
"@angular-eslint/eslint-plugin": "13.5.0",
|
||||||
"@angular-eslint/eslint-plugin-template": "13.5.0",
|
"@angular-eslint/eslint-plugin-template": "13.5.0",
|
||||||
"@angular-eslint/schematics": "13.5.0",
|
"@angular-eslint/schematics": "13.5.0",
|
||||||
"@angular-eslint/template-parser": "13.5.0",
|
"@angular-eslint/template-parser": "13.5.0",
|
||||||
"@angular/cli": "13.3.9",
|
"@angular/cli": "13.3.11",
|
||||||
"@angular/compiler": "13.3.11",
|
"@angular/compiler": "13.4.0",
|
||||||
"@angular/compiler-cli": "13.3.11",
|
"@angular/compiler-cli": "13.4.0",
|
||||||
"@angular/language-service": "13.3.11",
|
"@angular/language-service": "13.4.0",
|
||||||
"@capacitor/android": "4.6.1",
|
"@capacitor/android": "4.6.1",
|
||||||
"@capacitor/cli": "4.6.1",
|
"@capacitor/cli": "4.6.1",
|
||||||
"@capacitor/ios": "4.6.1",
|
"@capacitor/ios": "4.6.1",
|
||||||
|
|||||||
@@ -24,6 +24,6 @@ div {
|
|||||||
height: fit-content;
|
height: fit-content;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
justify-content: end;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ ion-note {
|
|||||||
list-style: none;
|
list-style: none;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row-reverse;
|
flex-direction: row-reverse;
|
||||||
justify-content: start;
|
justify-content: flex-start;
|
||||||
}
|
}
|
||||||
|
|
||||||
abbr {
|
abbr {
|
||||||
|
|||||||
@@ -31,6 +31,6 @@ ion-label + ion-label.distance::before {
|
|||||||
.in-place {
|
.in-place {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
justify-content: end;
|
justify-content: flex-end;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
"outDir": "./dist/out-tsc",
|
"outDir": "./dist/out-tsc",
|
||||||
"declaration": false,
|
"declaration": false,
|
||||||
"emitDecoratorMetadata": true,
|
"emitDecoratorMetadata": true,
|
||||||
|
"skipLibCheck": false,
|
||||||
"strictPropertyInitialization": false,
|
"strictPropertyInitialization": false,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"downlevelIteration": true,
|
"downlevelIteration": true,
|
||||||
|
|||||||
13
frontend/app/turbo.json
Normal file
13
frontend/app/turbo.json
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
{
|
||||||
|
"extends": ["//"],
|
||||||
|
"pipeline": {
|
||||||
|
"build": {
|
||||||
|
"outputs": ["www/**", ".angular/**"]
|
||||||
|
},
|
||||||
|
"test:integration": {
|
||||||
|
"env": ["BROWSER"],
|
||||||
|
"dependsOn": ["^build"],
|
||||||
|
"outputs": ["cypress/videos", "cypress/screenshots", "coverage/integration-report-junit.xml"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
441
pnpm-lock.yaml
generated
441
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
17
turbo.json
17
turbo.json
@@ -1,16 +1,17 @@
|
|||||||
{
|
{
|
||||||
|
"globalDependencies": [".gitlab-ci.yml", ".npmrc", ".c8rc.json", ".mocharc.json"],
|
||||||
"pipeline": {
|
"pipeline": {
|
||||||
"build": {
|
"build": {
|
||||||
"dependsOn": ["^build"],
|
"dependsOn": ["^build"],
|
||||||
"outputs": ["lib/**", "www/**", ".angular/**"],
|
"outputs": ["lib/**"],
|
||||||
"cache": true
|
"cache": true
|
||||||
},
|
},
|
||||||
"deploy": {
|
"deploy": {
|
||||||
"dependsOn": ["build", "^deploy"],
|
"dependsOn": ["build"],
|
||||||
"cache": false
|
"cache": false
|
||||||
},
|
},
|
||||||
"docs": {
|
"docs": {
|
||||||
"dependsOn": ["build", "^docs"],
|
"dependsOn": ["^build"],
|
||||||
"outputs": ["docs/**"]
|
"outputs": ["docs/**"]
|
||||||
},
|
},
|
||||||
"format": {},
|
"format": {},
|
||||||
@@ -18,14 +19,14 @@
|
|||||||
"cache": false
|
"cache": false
|
||||||
},
|
},
|
||||||
"lint": {
|
"lint": {
|
||||||
"dependsOn": ["build"]
|
"dependsOn": ["^build"]
|
||||||
},
|
},
|
||||||
"lint:fix": {
|
"lint:fix": {
|
||||||
"dependsOn": ["build", "^lint:fix"],
|
"dependsOn": ["^build", "^lint:fix"],
|
||||||
"cache": false
|
"cache": false
|
||||||
},
|
},
|
||||||
"test": {
|
"test": {
|
||||||
"dependsOn": ["build"],
|
"dependsOn": ["^build"],
|
||||||
"outputs": ["coverage/cobertura-coverage.xml", "coverage/report-junit.xml"]
|
"outputs": ["coverage/cobertura-coverage.xml", "coverage/report-junit.xml"]
|
||||||
},
|
},
|
||||||
"test:integration": {
|
"test:integration": {
|
||||||
@@ -38,10 +39,6 @@
|
|||||||
},
|
},
|
||||||
"//#syncpack": {
|
"//#syncpack": {
|
||||||
"dependsOn": []
|
"dependsOn": []
|
||||||
},
|
|
||||||
"//#build:docker-workspace": {
|
|
||||||
"dependsOn": ["^build"],
|
|
||||||
"cache": false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user