2022-02-11 21:23:31 +00:00
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- ui
|
|
|
|
- build
|
|
|
|
- deploy
|
|
|
|
- release
|
|
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
image: "rust:slim-buster"
|
|
|
|
stage: test
|
|
|
|
script:
|
|
|
|
- mkdir dist
|
|
|
|
- touch dist/index.html
|
|
|
|
- cargo test
|
|
|
|
|
|
|
|
build-ui:
|
|
|
|
stage: ui
|
|
|
|
image: node:16.13-slim
|
|
|
|
script:
|
|
|
|
- apt-get update
|
|
|
|
- apt-get -y install libssl-dev
|
|
|
|
- npm install
|
|
|
|
- npm run build
|
2022-02-17 02:26:34 +00:00
|
|
|
# rules:
|
|
|
|
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG
|
2022-02-11 21:23:31 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- dist/
|
|
|
|
|
|
|
|
build-x64-bin:
|
|
|
|
dependencies:
|
|
|
|
- build-ui
|
|
|
|
image: "rust:slim-buster"
|
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- linux
|
|
|
|
rules:
|
2022-02-12 22:50:47 +00:00
|
|
|
- if: $CI_COMMIT_TAG
|
2022-02-11 21:23:31 +00:00
|
|
|
script:
|
|
|
|
- cargo build --release
|
|
|
|
- cd target/release
|
|
|
|
- tar -czf ../../vade-linux-x64.tar.gz vade
|
|
|
|
- cd ../../
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/release/vade
|
|
|
|
- vade-linux-x64.tar.gz
|
|
|
|
|
|
|
|
|
|
|
|
build-musl-bin:
|
|
|
|
dependencies:
|
|
|
|
- build-ui
|
|
|
|
stage: build
|
|
|
|
image: 'rust:latest'
|
2022-02-17 00:55:47 +00:00
|
|
|
# rules:
|
|
|
|
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG
|
2022-02-11 21:23:31 +00:00
|
|
|
script:
|
|
|
|
- rustup target add x86_64-unknown-linux-musl
|
|
|
|
- apt update && apt install -y musl-tools musl-dev
|
|
|
|
- update-ca-certificates
|
|
|
|
- cargo build --target x86_64-unknown-linux-musl --release
|
|
|
|
- cd target/x86_64-unknown-linux-musl/release/
|
|
|
|
- tar -czf ../../../vade-linux-musl.tar.gz vade
|
|
|
|
- cd ../../../
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- vade-linux-musl.tar.gz
|
|
|
|
- target/x86_64-unknown-linux-musl/release/vade
|
|
|
|
|
|
|
|
build-arm-bin:
|
|
|
|
dependencies:
|
|
|
|
- build-ui
|
|
|
|
stage: build
|
|
|
|
image: 'rust:latest'
|
|
|
|
rules:
|
2022-02-12 22:50:47 +00:00
|
|
|
- if: $CI_COMMIT_TAG
|
2022-02-11 21:23:31 +00:00
|
|
|
script:
|
|
|
|
- rustup target add armv7-unknown-linux-gnueabihf
|
|
|
|
- apt update
|
|
|
|
- apt-get -y install gcc-arm-linux-gnueabihf
|
|
|
|
- cargo build --target armv7-unknown-linux-gnueabihf --release
|
|
|
|
- cd target/armv7-unknown-linux-gnueabihf/release/
|
|
|
|
- tar -czf ../../../vade-linux-arm.tar.gz vade
|
|
|
|
- cd ../../../
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/armv7-unknown-linux-gnueabihf/release/vade
|
|
|
|
- vade-linux-arm.tar.gz
|
|
|
|
|
|
|
|
|
|
|
|
build-win-bin:
|
|
|
|
dependencies:
|
|
|
|
- build-ui
|
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- windows
|
|
|
|
rules:
|
2022-02-12 22:50:47 +00:00
|
|
|
- if: $CI_COMMIT_TAG
|
2022-02-11 21:23:31 +00:00
|
|
|
script:
|
|
|
|
- cargo build --release
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- target/release/vade.exe
|
|
|
|
|
|
|
|
deploy-dev-docker:
|
|
|
|
dependencies:
|
|
|
|
- build-musl-bin
|
|
|
|
stage: deploy
|
|
|
|
image: docker:latest
|
|
|
|
script:
|
|
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
|
|
- docker build -t $CI_REGISTRY/vade/vade-mecum .
|
|
|
|
- docker push $CI_REGISTRY/vade/vade-mecum
|
|
|
|
rules:
|
2022-02-12 22:50:47 +00:00
|
|
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_TAG
|
2022-02-11 21:23:31 +00:00
|
|
|
|
2022-02-17 00:55:47 +00:00
|
|
|
deploy-prod-docker:
|
|
|
|
dependencies:
|
|
|
|
- build-musl-bin
|
|
|
|
stage: deploy
|
|
|
|
image: docker:latest
|
|
|
|
script:
|
2022-02-18 00:54:34 +00:00
|
|
|
- docker info
|
2022-02-18 01:12:13 +00:00
|
|
|
- docker login -u $DOCKERHUB_USER -p $DOCKERHUB_PASS
|
|
|
|
- docker build -t fivesigma/vade .
|
|
|
|
- docker push fivesigma/vade
|
2022-02-17 00:55:47 +00:00
|
|
|
# rules:
|
|
|
|
# - if: $CI_COMMIT_TAG
|
|
|
|
|
2022-02-11 21:23:31 +00:00
|
|
|
deploy-binaries:
|
|
|
|
dependencies:
|
2022-02-17 01:05:51 +00:00
|
|
|
- build-x64-bin
|
2022-02-11 21:23:31 +00:00
|
|
|
- build-musl-bin
|
|
|
|
- build-arm-bin
|
|
|
|
- build-win-bin
|
|
|
|
image: curlimages/curl:latest
|
|
|
|
stage: deploy
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
script:
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./vade-linux-x64.tar.gz "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade-linux-x64-$CI_COMMIT_TAG.tar.gz"'
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./vade-linux-arm.tar.gz "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade-linux-arm-$CI_COMMIT_TAG.tar.gz"'
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./vade-linux-musl.tar.gz "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade-linux-musl-$CI_COMMIT_TAG.tar.gz"'
|
|
|
|
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./target/release/vade.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade.exe"'
|
|
|
|
|
|
|
|
release:
|
|
|
|
stage: release
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
script:
|
|
|
|
- echo "running release_job"
|
|
|
|
release:
|
2022-02-17 00:55:47 +00:00
|
|
|
name: 'Release $CI_COMMIT_TAG'
|
2022-02-11 21:23:31 +00:00
|
|
|
description: 'Version $CI_COMMIT_TAG'
|
|
|
|
tag_name: '$CI_COMMIT_TAG'
|
|
|
|
ref: '$CI_COMMIT_TAG'
|
|
|
|
assets:
|
|
|
|
links:
|
|
|
|
- name: 'vade-linux-x64-$CI_COMMIT_TAG.tar.gz'
|
2022-02-17 00:55:47 +00:00
|
|
|
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade-linux-x64-$CI_COMMIT_TAG.tar.gz'
|
|
|
|
links:
|
|
|
|
- name: 'vade-linux-arm-$CI_COMMIT_TAG.tar.gz'
|
|
|
|
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade-linux-arm-$CI_COMMIT_TAG.tar.gz'
|
|
|
|
links:
|
|
|
|
- name: 'vade-linux-musl-$CI_COMMIT_TAG.tar.gz'
|
|
|
|
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade-linux-musl-$CI_COMMIT_TAG.tar.gz'
|
|
|
|
links:
|
|
|
|
- name: 'vade.exe'
|
|
|
|
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/$CI_COMMIT_TAG/vade.exe'
|