Added test, build, and deploy stages.
This commit is contained in:
Joe Bellus 2022-02-08 21:21:56 -05:00
parent 2156529b1c
commit 7d3155f34e
3 changed files with 77 additions and 7 deletions

73
.gitlab-ci.yml Normal file
View File

@ -0,0 +1,73 @@
stages:
- test
- build
- deploy
test:
image: "rust:slim-buster"
stage: test
script:
- cargo test
build:
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
- apt-get -y install nodejs npm
- 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
- npm install
- npm run build
- cargo build --release
- tar -czf ./vade-linux-x64.tar.gz -C target/release .
artifacts:
- target/release/vade
docker:
image: docker:19.03.12
services:
- docker:19.03.12-dind
stage: build
script:
- cd target/release
- docker build -t registry.5sigma.io/vade/vade .
- docker push registry.5sigma.io/vade/vade
binaries:
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'
url: '${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/linux-bin/$CI_COMMIT_TAG/visage-linux-x64-$CI_COMMIT_TAG.tar.gz'

3
Dockerfile Normal file
View File

@ -0,0 +1,3 @@
FROM alpine:latest
COPY vade /app/vade
CMD ["/app/vade"]

View File

@ -1,9 +1,3 @@
use std::process::Command;
fn main() {
Command::new("npm")
.args(&["run", "build-dev"])
.current_dir("./vade-ui")
.status()
.unwrap();
}
fn main() {}