From 2bc119e3537aff856575c6dcb190d3feacb9f2e3 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Thu, 13 Jun 2019 14:09:07 +0200 Subject: [PATCH 1/2] Restored review app for front-end --- .gitlab-ci.yml | 81 ++++++++------------------------------- front/src/router/index.js | 6 +++ front/vue.config.js | 2 +- 3 files changed, 22 insertions(+), 67 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8bab09fdb..f02a194a0 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -20,91 +20,40 @@ review_front: image: node:9 when: manual allow_failure: true + variables: + BASE_URL: /-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/ + VUE_APP_ROUTER_BASE_URL: /-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/ + VUE_APP_INSTANCE_URL: $REVIEW_INSTANCE_URL before_script: - curl -L -o /usr/local/bin/jq https://github.com/stedolan/jq/releases/download/jq-1.5/jq-linux64 - chmod +x /usr/local/bin/jq + - rm -rf front-review + - mkdir front-review - cd front script: - yarn install - yarn run i18n-compile # this is to ensure we don't have any errors in the output, # cf https://dev.funkwhale.audio/funkwhale/funkwhale/issues/169 - - VUE_APP_INSTANCE_URL=$REVIEW_INSTANCE_URL yarn run build | tee /dev/stderr | (! grep -i 'ERROR in') - - mkdir -p /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - - cp -r dist/* /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG + - yarn run build | tee /dev/stderr | (! grep -i 'ERROR in') + - cp -r dist/* ../front-review + artifacts: + expire_in: 2 weeks + paths: + - front-review cache: key: "funkwhale__front_dependencies" paths: - front/node_modules - front/yarn.lock - environment: - name: review/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - url: http://front-$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG.$REVIEW_DOMAIN - on_stop: stop_front_review only: - branches tags: - - funkwhale-review - -stop_front_review: - stage: review - script: - - rm -rf /static/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG/ - variables: - GIT_STRATEGY: none - when: manual - only: - - branches + - docker environment: - name: review/front/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - action: stop - tags: - - funkwhale-review + name: review/front/$CI_COMMIT_REF_NAME + url: http://$CI_PROJECT_NAMESPACE.pages.funkwhale.audio/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/index.html -review_docs: - stage: review - image: python:3.6 - when: manual - allow_failure: true - variables: - BUILD_PATH: "../public" - before_script: - - cd docs - - apt-get update - - apt-get install -y graphviz - - pip install sphinx - - cache: - key: "$CI_PROJECT_ID__sphinx" - paths: - - "$PIP_CACHE_DIR" - script: - - ./build_docs.sh - - mkdir -p /static/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - - cp -r $CI_PROJECT_DIR/public/* /static/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - environment: - name: review/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - url: http://docs-$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG.$REVIEW_DOMAIN - on_stop: stop_docs_review - only: - - branches - tags: - - funkwhale-review - -stop_docs_review: - stage: review - script: - - rm -rf /static/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG/ - variables: - GIT_STRATEGY: none - when: manual - only: - - branches - environment: - name: review/docs/$CI_PROJECT_PATH_SLUG-$CI_BUILD_REF_SLUG - action: stop - tags: - - funkwhale-review black: image: python:3.6 diff --git a/front/src/router/index.js b/front/src/router/index.js index 182cf61b0..6a9ba6112 100644 --- a/front/src/router/index.js +++ b/front/src/router/index.js @@ -3,9 +3,11 @@ import Router from 'vue-router' Vue.use(Router) +console.log('PROCESS', process.env) export default new Router({ mode: 'history', linkActiveClass: 'active', + base: process.env.VUE_APP_ROUTER_BASE_URL || '/', routes: [ { path: '/', @@ -552,6 +554,10 @@ export default new Router({ }, ] }, + { + path: '*/index.html', + redirect: '/' + }, { path: '*', component: () => diff --git a/front/vue.config.js b/front/vue.config.js index c397f824a..4b1d9f5d4 100644 --- a/front/vue.config.js +++ b/front/vue.config.js @@ -10,7 +10,7 @@ if (process.env.BUNDLE_ANALYZE === '1') { plugins.push(new BundleAnalyzerPlugin()) } module.exports = { - baseUrl: '/front/', + baseUrl: process.env.BASE_URL || '/front/', pages: { embed: { entry: 'src/embed.js', From a6f5dd026c6a0026c3ba430776bee49f3ed0e585 Mon Sep 17 00:00:00 2001 From: Eliot Berriot Date: Thu, 13 Jun 2019 14:50:31 +0200 Subject: [PATCH 2/2] Restored review app for docs --- .gitlab-ci.yml | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index f02a194a0..cc53bc652 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -55,6 +55,39 @@ review_front: url: http://$CI_PROJECT_NAMESPACE.pages.funkwhale.audio/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/front-review/index.html +review_docs: + stage: review + when: manual + allow_failure: true + image: python:3.6 + variables: + BUILD_PATH: "../docs-review" + before_script: + - rm -rf docs-review + - mkdir docs-review + - cd docs + - apt-get update + - apt-get install -y graphviz + - pip install sphinx + script: + - ./build_docs.sh + cache: + key: "$CI_PROJECT_ID__sphinx" + paths: + - "$PIP_CACHE_DIR" + artifacts: + expire_in: 2 weeks + paths: + - docs-review + only: + - branches + tags: + - docker + environment: + name: review/docs/$CI_COMMIT_REF_NAME + url: http://$CI_PROJECT_NAMESPACE.pages.funkwhale.audio/-/$CI_PROJECT_NAME/-/jobs/$CI_JOB_ID/artifacts/docs-review/index.html + + black: image: python:3.6 stage: lint