app/.gitlab-ci.yml

156 lines
4.1 KiB
YAML
Raw Normal View History

stages:
2022-02-11 04:12:18 +00:00
# - test
- ui
- build
- deploy
2022-02-09 02:28:00 +00:00
- release
2022-02-11 04:12:18 +00:00
# test:
# image: "rust:slim-buster"
# stage: test
# script:
# - mkdir dist
# - touch dist/index.html
# - apt-get update
# - apt-get -y install pkg-config
# - cargo test
build-ui:
stage: ui
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
- npm run build
2022-02-11 03:50:27 +00:00
# rules:
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
2022-02-09 03:31:35 +00:00
artifacts:
paths:
- dist/
2022-02-11 03:52:03 +00:00
build-x64-bin:
2022-02-09 03:31:35 +00:00
dependencies:
2022-02-09 04:57:20 +00:00
- build-ui
image: "rust:slim-buster"
stage: build
tags:
- linux
2022-02-11 20:14:40 +00:00
# rules:
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
script:
- apt-get update
2022-02-10 14:27:53 +00:00
- apt-get -y install libssl-dev pkg-config
2022-02-10 05:59:41 +00:00
- cargo build --release
2022-02-10 02:33:28 +00:00
- cd target/release
2022-02-10 02:58:52 +00:00
- tar -czf ../../vade-linux-x64.tar.gz vade
2022-02-10 02:33:28 +00:00
- cd ../../
artifacts:
2022-02-09 02:25:05 +00:00
paths:
- target/release/vade
2022-02-10 02:15:36 +00:00
- vade-linux-x64.tar.gz
2022-02-11 03:50:27 +00:00
build-musl-bin:
dependencies:
- build-ui
stage: build
image: 'rust:latest'
script:
2022-02-11 20:14:40 +00:00
# rules:
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- 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
2022-02-11 03:50:27 +00:00
- cd target/x86_64-unknown-linux-musl/release/
- tar -czf ../../../vade-linux-musl.tar.gz vade
- cd ../../../
artifacts:
paths:
2022-02-11 06:29:00 +00:00
- vade-linux-musl.tar.gz
- target/x86_64-unknown-linux-musl/release/vade
2022-02-11 03:52:03 +00:00
build-arm-bin:
2022-02-11 03:50:27 +00:00
dependencies:
- build-ui
stage: build
image: 'rust:latest'
2022-02-11 20:14:40 +00:00
# rules:
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
2022-02-11 03:50:27 +00:00
script:
- rustup target add armv7-unknown-linux-gnueabihf
- apt update
2022-02-11 04:12:18 +00:00
- apt-get -y install gcc-arm-linux-gnueabihf
2022-02-11 04:18:53 +00:00
- cargo build --target armv7-unknown-linux-gnueabihf --release
2022-02-11 03:50:27 +00:00
- 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
2022-02-11 03:53:30 +00:00
build-win-bin:
2022-02-11 03:50:27 +00:00
dependencies:
- build-ui
stage: build
tags:
- windows
2022-02-11 20:14:40 +00:00
# rules:
# - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
2022-02-11 03:50:27 +00:00
script:
- cargo build --release
artifacts:
paths:
- target/release/vade.exe
2022-02-11 04:18:53 +00:00
deploy-dev-docker:
2022-02-09 03:31:35 +00:00
dependencies:
2022-02-11 03:50:27 +00:00
- build-musl-bin
2022-02-11 04:18:53 +00:00
stage: deploy
image: docker:latest
script:
2022-02-09 03:31:35 +00:00
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
2022-02-09 23:57:08 +00:00
- docker build -t $CI_REGISTRY/vade/vade-mecum .
- docker push $CI_REGISTRY/vade/vade-mecum
# 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:
2022-02-11 03:52:03 +00:00
- build-x64-bin
- build-musl-bin
- build-arm-bin
- build-win-bin
image: curlimages/curl:latest
stage: deploy
2022-02-11 20:14:40 +00:00
# rules:
# - if: $CI_COMMIT_TAG
script:
2022-02-11 20:14:40 +00:00
- '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/v0.1.0/vade-linux-x64-v0.1.0.tar.gz"'
2022-02-11 04:18:53 +00:00
2022-02-11 20:14:40 +00:00
- '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/v0.1.0/vade-linux-arm-v0.1.0.tar.gz"'
2022-02-11 04:18:53 +00:00
2022-02-11 20:14:40 +00:00
- '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/v0.1.0/vade-linux-musl-v0.1.0.tar.gz"'
2022-02-11 04:18:53 +00:00
2022-02-11 20:14:40 +00:00
- 'curl --header "JOB-TOKEN: $CI_JOB_TOKEN" --upload-file ./target/release/vade.exe "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/bin/v0.1.0/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:
name: 'Release v$CI_COMMIT_TAG'
description: 'Version $CI_COMMIT_TAG'
tag_name: '$CI_COMMIT_TAG'
ref: '$CI_COMMIT_TAG'
assets:
links:
2022-02-10 00:25:16 +00:00
- 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'