From ba0d75d383c72d0704a54a1223db25113fabc4dc Mon Sep 17 00:00:00 2001 From: shockrah Date: Sun, 27 Mar 2022 00:45:07 -0700 Subject: [PATCH] + New jobs for building both admin and normal docker images + New jobs for building both admin and normal binary packages ! NOTE: This commit is likely broken so do not use it to checkout --- .gitlab-ci.yml | 69 +++++++++++++++++++++++++------------------------- 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a101d7a..c02e398 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -4,6 +4,10 @@ stages: - build-backend - deploy +include: + - local: 'ci/cargo.yml' + - local: 'ci/docker.yml' + pages: image: shockrah/website:latest stage: pages @@ -22,62 +26,57 @@ pages: paths: - public/ +# Webpack bundles everything anyway so both admin/non-admin builds have +# the same frontend code. build-frontend-js: image: codesignal/typescript:v9.6.0 stage: build-frontend - stage: pages only: refs: - master script: - cd ts/ - - npm run setup + - npm i - npm run build artifacts: paths: - api/static/ -# Literally both of these fail 99% of the time so I'm forgoing them completely -# for now until I find something doesn't suck -# Builds out the intended zip package -build-server-binaries: - image: rustlang/rust:nightly - stage: build-backend - stage: pages - only: - refs: - - master +build-server-no-admin: + extends: .cargo-builder script: - - mkdir -p build - - cp api/templates/ api/static/ build/ -r - cd api/ - cargo build --release - cd ../ - - cp api/target/release/clippable-server build/server - - cp ./scripts/ build/ -r - - cp readme.md build/ - - sh ./scripts/default-rocket-toml.sh - artifacts: - paths: - - build/ -# Upload built docker image to the local registry -deploy-docker-image: - stage: deploy - image: docker:stable - only: - refs: - - master - needs: - - build-server-binaries - dependencies: - - build-server-binaries - services: - - docker:dind +build-server-admin-enabled: + extends: .cargo-builder + script: + - cd api/ + - cargo build --release --features admin + - cd ../ + +deploy-no-admin-docker: + stage: deploy + extends: .docker-deploy + needs: + - build-server-no-admin + dependencies: + - build-server-no-admin script: - - echo "$CI_REGISTRY_PASSWORD" | docker login -u "$CI_REGISTRY_USER" --password-stdin "$CI_REGISTRY" - docker build -t registry.gitlab.com/shockrah/clippable . - docker push registry.gitlab.com/shockrah/clippable +deploy-admin-docker: + stage: deploy + extends: .docker-deploy + needs: + - build-server-admin-enabled + dependencies: + - build-server-admin-enabled + script: + - docker build -t registry.gitlab.com/shockrah/clippable:admin . + - docker push registry.gitlab.com/shockrah/clippable:admin +