app/.gitlab-ci.yml

95 lines
2.1 KiB
YAML
Raw Normal View History

stages:
- test
- ui
- build
- build-docker
- deploy
2022-02-09 02:28:00 +00:00
- release
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
- 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-10 14:27:53 +00:00
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
2022-02-09 03:31:35 +00:00
artifacts:
paths:
- dist/
build-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-10 14:27:53 +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
build-docker:
2022-02-09 03:31:35 +00:00
dependencies:
- build-bin
2022-02-09 04:58:06 +00:00
stage: build-docker
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
2022-02-10 05:57:54 +00:00
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
image: curlimages/curl:latest
stage: deploy
2022-02-10 05:57:54 +00:00
rules:
- if: $CI_COMMIT_TAG
script:
2022-02-10 05:57:54 +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/$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:
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'