2022-02-09 02:21:56 +00:00
|
|
|
stages:
|
|
|
|
- test
|
|
|
|
- build
|
|
|
|
- deploy
|
2022-02-09 02:28:00 +00:00
|
|
|
- release
|
2022-02-09 02:21:56 +00:00
|
|
|
|
|
|
|
|
|
|
|
test:
|
|
|
|
image: "rust:slim-buster"
|
|
|
|
stage: test
|
|
|
|
script:
|
2022-02-09 02:35:24 +00:00
|
|
|
- mkdir dist
|
|
|
|
- touch dist/index.html
|
|
|
|
- apt-get update
|
2022-02-09 02:41:40 +00:00
|
|
|
- apt-get -y install libssl-dev pkg-config
|
2022-02-09 02:21:56 +00:00
|
|
|
- cargo test
|
|
|
|
|
2022-02-09 03:31:35 +00:00
|
|
|
build:ui:
|
2022-02-09 03:37:43 +00:00
|
|
|
stage: build
|
2022-02-09 04:06:08 +00:00
|
|
|
image: node:16.13-slim
|
2022-02-09 03:31:35 +00:00
|
|
|
script:
|
2022-02-09 04:07:35 +00:00
|
|
|
- apt-get update
|
|
|
|
- apt-get -y install libssl-dev
|
2022-02-09 03:31:35 +00:00
|
|
|
- npm install
|
2022-02-09 03:46:02 +00:00
|
|
|
- npm run build
|
2022-02-09 03:31:35 +00:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- dist/
|
|
|
|
|
2022-02-09 02:28:00 +00:00
|
|
|
build:bin:
|
2022-02-09 03:31:35 +00:00
|
|
|
dependencies:
|
|
|
|
- build:ui
|
2022-02-09 02:21:56 +00:00
|
|
|
variables:
|
|
|
|
RUSTC_WRAPPER: /usr/local/bin/sccache
|
|
|
|
SCCACHE_BUCKET: $SCCACHE_BUCKET
|
|
|
|
AWS_ACCESS_KEY_ID: $AWS_ACCESS_KEY_ID
|
|
|
|
AWS_SECRET_ACCESS_KEY: $AWS_SECRET_ACCESS_KEY
|
|
|
|
|
|
|
|
image: "rust:slim-buster"
|
|
|
|
stage: build
|
|
|
|
tags:
|
|
|
|
- linux
|
|
|
|
script:
|
|
|
|
- apt-get update
|
2022-02-09 03:31:35 +00:00
|
|
|
- apt-get -y install libssl-dev pkg-config wget
|
2022-02-09 02:21:56 +00:00
|
|
|
- wget https://github.com/mozilla/sccache/releases/download/v0.2.15/sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz
|
|
|
|
- tar xzf sccache-v0.2.15-x86_64-unknown-linux-musl.tar.gz
|
|
|
|
- mv sccache-v0.2.15-x86_64-unknown-linux-musl/sccache /usr/local/bin/sccache
|
|
|
|
- chmod +x /usr/local/bin/sccache
|
|
|
|
- cargo build --release
|
|
|
|
- tar -czf ./vade-linux-x64.tar.gz -C target/release .
|
|
|
|
artifacts:
|
2022-02-09 02:25:05 +00:00
|
|
|
paths:
|
|
|
|
- target/release/vade
|
2022-02-09 02:21:56 +00:00
|
|
|
|
2022-02-09 02:28:00 +00:00
|
|
|
build:docker:
|
2022-02-09 03:31:35 +00:00
|
|
|
dependencies:
|
|
|
|
- build:bin
|
2022-02-09 02:21:56 +00:00
|
|
|
image: docker:19.03.12
|
|
|
|
services:
|
|
|
|
- docker:19.03.12-dind
|
|
|
|
stage: build
|
|
|
|
script:
|
|
|
|
- cd target/release
|
2022-02-09 03:31:35 +00:00
|
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
|
|
- docker build -t $CI_REGISTRY/vade/vade .
|
|
|
|
- docker push $CI_REGISTRY/vade/vade
|
|
|
|
# rules:
|
|
|
|
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
|
2022-02-09 02:28:00 +00:00
|
|
|
|
|
|
|
deploy:binaries:
|
2022-02-09 03:31:35 +00:00
|
|
|
dependencies:
|
|
|
|
- build:bin
|
2022-02-09 02:21:56 +00:00
|
|
|
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"'
|
|
|
|
|
|
|
|
|
|
|
|
release:
|
|
|
|
stage: release
|
|
|
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
|
|
rules:
|
|
|
|
- if: $CI_COMMIT_TAG
|
|
|
|
script:
|
|
|
|
- echo "running release_job"
|
|
|
|
release:
|
|
|
|
name: 'Release v$CI_COMMIT_TAG'
|
|
|
|
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-09 03:46:02 +00:00
|
|
|
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux-bin/$CI_COMMIT_TAG/vade-linux-x64-$CI_COMMIT_TAG.tar.gz'
|