diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 2b16e2676b0fc7561770dc1443fae6ebb56c7aa0..e65454fc8c2c98cd37cbc8009fcbdd9a429356f5 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,47 +1,22 @@ stages: -# - github-sync - - build - - publish + - build + - alt_build + - publish -#push_to_github: -# stage: github-sync -# variables: -# GIT_STRATEGY: none -# tags: -# - github -# script: -# - rm -rf ./* -# - rm -rf .git -# - git clone --mirror $CI_REPOSITORY_URL . -# - git remote add github $GITHUB_URL_AND_KEY -# - git config --global user.email "contact@duniter.org" -# - git config --global user.name "Duniter" -# # Job would fail if we don't remove refs about pull requests -# - bash -c "cat packed-refs | grep -v 'refs/pull' > packed-refs-new; echo 'Removed pull refs.'" -# - mv packed-refs-new packed-refs -# - bash -c "git push --force --mirror github 2>&1 | grep -v duniter-gitlab; echo $?" - -#.enforce_readme: -# stage: github-sync -# variables: -# GIT_STRATEGY: none -# tags: -# - github -# script: -# - rm -rf ./* -# - rm -rf .git -# - git clone $GITHUB_URL_AND_KEY . -# - git config --global user.email "contact@duniter.org" -# - git config --global user.name "Duniter" -# - git checkout master -# - cat .github/github_disclaimer.md > README.md.new -# - cat README.md >> README.md.new -# - mv README.md.new README.md -# - git commit -am "Enforce github readme" -# - git push origin master - -build: +fast-build: stage: build + image: $CI_REGISTRY_IMAGE + script: + - node ./node_modules/gulp/bin/gulp build:web + artifacts: + paths: + - public + expire_in: 60 minutes + only: + - master + +failsafe-build: + stage: alt_build image: node:5 script: - npm install @@ -56,13 +31,34 @@ build: only: - master +docker-for-fast-build: + stage: alt_build + when: on_failure + allow_failure: true + tags: + - doppler-docker + image: docker:latest + services: + - docker:dind + script: + - echo 'FROM node:5' > Dockerfile + - echo 'COPY * ./' >> Dockerfile + - echo 'COPY .bowerrc ./' >> Dockerfile + - echo 'COPY .gitmodules ./' >> Dockerfile + - echo 'RUN npm install' >> Dockerfile + - echo 'RUN npm run postinstall' >> Dockerfile + - docker login -u "gitlab-ci-token" -p "$CI_BUILD_TOKEN" $CI_REGISTRY + - docker build --pull -t "$CI_REGISTRY_IMAGE" . + - docker push "$CI_REGISTRY_IMAGE" + + pages: stage: publish image: node:latest variables: GIT_STRATEGY: none script: - - ls -la public + - ls -la public || true - mv platforms/web/www public artifacts: untracked: true @@ -77,7 +73,7 @@ release-web: variables: GIT_STRATEGY: none script: - - ls -la www + - ls -la www || true - mv platforms/web/www www artifacts: untracked: true