Skip to content
Snippets Groups Projects
Verified Commit 86c85cf9 authored by Eduardo Trujillo's avatar Eduardo Trujillo
Browse files

chore: Add initial .gitlab-ci.yml

parent 2ba715aa
No related branches found
No related tags found
No related merge requests found
Pipeline #213 failed
stages:
- format
- build
- lint
- test
- release
variables:
# Package version can only contain numbers (0-9), and dots (.).
# Must be in the format of X.Y.Z, i.e. should match /\A\d+\.\d+\.\d+\z/ regular expresion.
# See https://docs.gitlab.com/ee/user/packages/generic_packages/#publish-a-package-file
PACKAGE_VERSION: "${CI_COMMIT_TAG}"
LINUX_AMD64_BINARY: "nm-reactor-linux-amd64-${PACKAGE_VERSION}"
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/nm-reactor/${PACKAGE_VERSION}"
.rust_template: &rust_template
before_script:
- export CARGO_HOME="$CI_PROJECT_DIR/cargo"
- rustup --version
- rustc --version
- cargo --version
rust-nightly:
stage: build
image: rustlang/rust:nightly
needs: []
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
<<: *rust_template
script:
- cargo build --release --verbose
artifacts:
paths:
- target/release/nm-reactor
rust-nightly-test:
stage: test
image: rustlang/rust:nightly
needs:
- rust-nightly
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
policy: pull
<<: *rust_template
script:
- cargo test --verbose -j 1
rust-nightly-fmt:
stage: format
image: rustlang/rust:nightly
needs: []
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
policy: pull
<<: *rust_template
script:
- cargo fmt --all --verbose -- --check
rust-nightly-clippy:
stage: lint
image: rustlang/rust:nightly
needs:
- rust-nightly
cache:
key: "$CI_COMMIT_REF_SLUG"
paths:
- cargo/
- target/
<<: *rust_template
script:
- cargo clippy --all --verbose -- -D warnings
upload:
stage: release
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
needs:
- job: rust-nightly
artifacts: true
image: curlimages/curl:latest
script:
- |
curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file target/release/nm-reactor ${PACKAGE_REGISTRY_URL}/${LINUX_AMD64_BINARY}
release:
stage: release
rules:
- if: '$CI_COMMIT_TAG =~ /^\d+\.\d+\.\d+$/'
needs:
- upload
image: registry.gitlab.com/gitlab-org/release-cli:latest
script:
- echo 'Running release_job'
release:
name: 'v$CI_COMMIT_TAG'
description: 'Created using the release-cli'
tag_name: '$CI_COMMIT_TAG'
assets:
links:
- name: 'Linux (amd64)'
url: "${PACKAGE_REGISTRY_URL}/${DARWIN_AMD64_BINARY}"
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment