This is a mirror of the GitLab repo!
https://gitlab.com/Lynnesbian/fif
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
223 lines
5.4 KiB
223 lines
5.4 KiB
# SPDX-FileCopyrightText: 2021-2022 Lynnesbian |
|
# SPDX-License-Identifier: CC0-1.0 |
|
|
|
image: "rust:latest" |
|
|
|
variables: |
|
CARGO_HOME: $CI_PROJECT_DIR/.cargo |
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/fif" |
|
RUSTFLAGS: "-C debuginfo=0" |
|
|
|
cache: |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
default: |
|
before_script: |
|
- rustc --version |
|
- cargo version |
|
|
|
stages: |
|
- lint # KNEE-DEEP IN THE DEBUG |
|
- cache-cleanup # THE CACHES OF HELL |
|
- build-base # INFERNAL build times |
|
- build # THY CREDITS CONSUMED |
|
- test # SIGKILL |
|
# - release |
|
|
|
# TEMPLATES |
|
|
|
# this step uses cargo-sweep to clean up unneeded cruft that accumulates over time in the target dir. cargo clean is |
|
# not used because it simply rm -rf's the entire target directory (and thus prevents build caching). i would really like |
|
# to either replace this with a bash script, or to install cargo-sweep as a binary instead of building it from source |
|
# like this. i'd also like to add a step that checks to see whether the target dir exists, and exits early if not. |
|
.cargo-cleanup: |
|
stage: cache-cleanup |
|
allow_failure: true |
|
script: |
|
- cargo install cargo-sweep |
|
- cargo sweep -i |
|
- git -C $CI_PROJECT_DIR/.cargo/registry/index/github.com-1ecc6299db9ec823/ gc --aggressive || true |
|
|
|
# this builds a "base" version of fif with default features enabled. this is done separately from the main build step |
|
# for the purposes of caching - by building once *before* executing the parallel cargo-build step, we ensure that |
|
# cargo-build can reuse some cached stuff, rather than building from scratch every time. |
|
.cargo-build-base: |
|
stage: build-base |
|
script: |
|
cargo build --locked |
|
|
|
# build with various features on and off. |
|
.cargo-build: |
|
extends: .cargo-build-base |
|
stage: build |
|
parallel: |
|
matrix: |
|
- FEATURES: |
|
- xdg-mime-backend |
|
- infer-backend |
|
- multi-threaded xdg-mime-backend |
|
- multi-threaded infer-backend |
|
|
|
script: |
|
cargo run --no-default-features --locked --features="json $FEATURES" -- --version |
|
|
|
# test with various features on and off. |
|
.cargo-test: |
|
extends: .cargo-build |
|
stage: test |
|
script: |
|
cargo test --no-default-features --locked --verbose --features="json $FEATURES" |
|
|
|
# LINT |
|
|
|
# run the included clippy.sh with "ci" mode on - clippy will exit with code 1 if anything at all is amiss. this is just |
|
# here to make sure i remember to run clippy.sh locally myself and fix/ignore all the warnings before committing, as i |
|
# should be. |
|
clippy: |
|
stage: lint |
|
script: |
|
- rustup component add clippy |
|
- cargo clippy --version |
|
- ./clippy.sh ci |
|
|
|
# CACHE CLEANUP |
|
cleanup-stable: |
|
extends: .cargo-cleanup |
|
|
|
# there's no point running cargo sweep on MSRV, since it's always at the same version (and therefore cargo sweep will |
|
# never delete anything) |
|
|
|
cleanup-nightly: |
|
extends: cleanup-stable |
|
image: "rustlang/rust:nightly" |
|
cache: |
|
key: nightly |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
# BUILD BASE |
|
build-base-stable: |
|
extends: .cargo-build-base |
|
needs: ["cleanup-stable"] |
|
|
|
build-base-msrv: |
|
extends: build-base-stable |
|
image: "rust:1.54.0" |
|
cache: |
|
key: msrv |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
build-base-nightly: |
|
extends: build-base-stable |
|
needs: ["cleanup-nightly"] |
|
image: "rustlang/rust:nightly" |
|
cache: |
|
key: nightly |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
# BUILD |
|
|
|
build-stable: |
|
extends: .cargo-build |
|
needs: ["build-base-stable"] |
|
|
|
build-msrv: |
|
extends: build-stable |
|
needs: ["build-base-msrv"] |
|
image: "rust:1.54.0" |
|
cache: |
|
key: msrv |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
build-nightly: |
|
extends: build-stable |
|
needs: ["build-base-nightly"] |
|
image: "rustlang/rust:nightly" |
|
cache: |
|
key: nightly |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
# TEST |
|
|
|
test-stable: |
|
extends: .cargo-test |
|
needs: ["build-stable"] |
|
|
|
test-msrv: |
|
extends: test-stable |
|
image: "rust:1.54.0" |
|
needs: ["build-msrv"] |
|
cache: |
|
key: msrv |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
test-nightly: |
|
extends: test-stable |
|
image: "rustlang/rust:nightly" |
|
needs: ["build-nightly"] |
|
cache: |
|
key: nightly |
|
paths: |
|
- target |
|
- .cargo |
|
|
|
# RELEASE |
|
# this is currently all disabled because |
|
# a) it's gross |
|
# b) it probably won't work and i really don't want to partake in CI tomfoolery right now, or ever |
|
|
|
#build-release: |
|
# stage: release |
|
# cache: { } |
|
# rules: |
|
# - if: $CI_COMMIT_TAG |
|
# needs: ["test-stable"] |
|
# script: |
|
# - ./package.sh |
|
# artifacts: |
|
# paths: |
|
# - out/ |
|
|
|
#upload-release: |
|
# stage: release |
|
# cache: { } |
|
# rules: |
|
# - if: $CI_COMMIT_TAG |
|
# image: curlimages/curl:latest |
|
# script: |
|
# - git describe --tags --abbrev=0 | cut -c 2- > tmp |
|
# - | |
|
# cd out |
|
# for _bin in *.{zip,xz} do; curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file "$_bin" "${PACKAGE_REGISTRY_URL}/$(cat ../tmp)/${_bin}"; done |
|
# - rm ../tmp |
|
|
|
#create-release: |
|
# stage: release |
|
# cache: {} |
|
# image: registry.gitlab.com/gitlab-org/release-cli:latest |
|
# rules: |
|
# - if: $CI_COMMIT_TAG |
|
# script: |
|
# - | |
|
# cd out |
|
# echo -n "release-cli create --name \"Release $CI_COMMIT_TAG\" --tag-name=\"$CI_COMMIT_TAG\" " > tmp.sh |
|
# git describe --tags --abbrev=0 | cut -c 2- > tmp |
|
# for _bin in *.{zip,xz}; do echo -n --assets-link \"\{\"name\":\"${_bin}\",\"url\":\"${PACKAGE_REGISTRY_URL}/$(cat tmp)/${_bin}\"\}\" >> tmp.sh; echo -n " " >> tmp.sh; done |
|
# - cat tmp.sh |
|
# - bash tmp.sh |
|
# - | |
|
# rm tmp.sh |
|
# rm tmp
|
|
|