stages:
- dependency-update
- build
- test
- release
- publish
renovate:
stage: dependency-update
image: renovate/renovate:latest
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"
variables:
RENOVATE_PLATFORM: "gitlab"
RENOVATE_ENDPOINT: $CI_API_V4_URL
RENOVATE_CONFIG_FILE: "renovate.json"
script:
- renovate --autodiscover --config-migration
allow_failure: false
build_project:
stage: build
image: rust
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_BRANCH
script:
- echo "BUILD_CI_JOB_URL=$CI_JOB_URL" >> build.env
- cargo build --release
artifacts:
paths:
- target/release/treeflow
reports:
dotenv: build.env
cache:
key: $CI_COMMIT_REF_SLUG
paths:
- target/
test_project:
stage: test
image: rustlang/rust:nightly
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_BRANCH
before_script:
- apt-get update && apt-get install -y zsh
- '[ -f bin/cargo2junit ] && echo "cargo2junit already exists, skipping install" || cargo install --root . cargo2junit'
script:
- cargo test -- -Z unstable-options --format json --report-time | bin/cargo2junit > report.xml
artifacts:
when: always
reports:
junit: report.xml
cache:
- key: $CI_COMMIT_REF_SLUG
paths:
- target/
- key: tools
paths:
- bin/
test_nix_flake:
stage: test
image: nixos/nix
rules:
- if: $CI_COMMIT_BRANCH == "master" && $CI_PIPELINE_SOURCE == "schedule"
- if: $CI_COMMIT_TAG
- if: $CI_PIPELINE_SOURCE == "web" && $CI_COMMIT_BRANCH
script:
- nix build --extra-experimental-features nix-command --extra-experimental-features flakes
- nix develop --extra-experimental-features nix-command --extra-experimental-features flakes
release_project:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
rules:
- if: $CI_COMMIT_TAG
script:
- echo "running release_job"
release:
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
assets:
links:
- name: "linux amd64"
url: "$BUILD_CI_JOB_URL/artifacts/raw/target/release/treeflow"
publish_to_crates_io:
stage: publish
image: rust
rules:
- if: $CI_COMMIT_TAG
script:
- cargo publish
dependencies:
- release_project