2021-04-21 07:06:56 +00:00
|
|
|
image: "rust:latest"
|
|
|
|
|
2021-04-26 10:34:17 +00:00
|
|
|
variables:
|
|
|
|
CARGO_HOME: $CI_PROJECT_DIR/.cargo
|
2021-06-18 03:16:14 +00:00
|
|
|
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/fif"
|
2021-04-26 10:34:17 +00:00
|
|
|
|
|
|
|
cache:
|
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- .cargo
|
|
|
|
|
2021-04-21 07:06:56 +00:00
|
|
|
default:
|
|
|
|
before_script:
|
2021-04-28 06:09:11 +00:00
|
|
|
- rustc --version
|
|
|
|
- cargo version
|
2021-04-21 07:06:56 +00:00
|
|
|
|
2021-04-21 06:57:57 +00:00
|
|
|
stages:
|
2021-06-18 03:26:22 +00:00
|
|
|
- lint # KNEE-DEEP IN THE DEBUG
|
|
|
|
- cache-cleanup # THE CACHES OF HELL
|
|
|
|
- build-base # INFERNAL build times
|
|
|
|
- build # THY CREDITS CONSUMED
|
|
|
|
- test # SIGKILL
|
|
|
|
# - release
|
2021-04-21 06:57:57 +00:00
|
|
|
|
2021-05-06 16:49:17 +00:00
|
|
|
# TEMPLATES
|
|
|
|
|
2021-06-13 06:47:20 +00:00
|
|
|
# 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.
|
2021-05-06 16:49:17 +00:00
|
|
|
.cargo-cleanup:
|
|
|
|
stage: cache-cleanup
|
|
|
|
allow_failure: true
|
|
|
|
script:
|
|
|
|
- cargo install cargo-sweep
|
|
|
|
- cargo sweep -i
|
|
|
|
|
2021-06-13 06:47:20 +00:00
|
|
|
# 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.
|
2021-05-06 16:49:17 +00:00
|
|
|
.cargo-build-base:
|
|
|
|
stage: build-base
|
2021-04-28 10:14:52 +00:00
|
|
|
script:
|
2021-05-06 16:49:17 +00:00
|
|
|
cargo build --locked
|
|
|
|
|
2021-06-13 06:47:20 +00:00
|
|
|
# build with various features on and off.
|
2021-05-06 16:49:17 +00:00
|
|
|
.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
|
2021-04-28 10:14:52 +00:00
|
|
|
|
2021-05-06 16:25:44 +00:00
|
|
|
script:
|
2021-05-06 16:49:17 +00:00
|
|
|
cargo build --no-default-features --locked --features="json $FEATURES"
|
2021-05-06 16:25:44 +00:00
|
|
|
|
2021-06-13 06:47:20 +00:00
|
|
|
# test with various features on and off.
|
2021-04-28 10:14:52 +00:00
|
|
|
.cargo-test:
|
2021-04-28 13:52:42 +00:00
|
|
|
extends: .cargo-build
|
2021-04-28 10:14:52 +00:00
|
|
|
stage: test
|
|
|
|
script:
|
2021-05-05 22:57:42 +00:00
|
|
|
cargo test --no-default-features --locked --verbose --features="json $FEATURES"
|
2021-04-28 10:14:52 +00:00
|
|
|
|
2021-05-06 16:25:44 +00:00
|
|
|
# LINT
|
|
|
|
|
2021-06-13 06:47:20 +00:00
|
|
|
# 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.
|
2021-04-28 06:09:11 +00:00
|
|
|
clippy:
|
|
|
|
stage: lint
|
|
|
|
script:
|
|
|
|
- rustup component add clippy
|
|
|
|
- cargo clippy --version
|
|
|
|
- ./clippy.sh ci
|
|
|
|
|
2021-05-06 16:25:44 +00:00
|
|
|
# CACHE CLEANUP
|
|
|
|
cleanup-stable:
|
|
|
|
extends: .cargo-cleanup
|
|
|
|
|
|
|
|
cleanup-msrv:
|
|
|
|
extends: cleanup-stable
|
|
|
|
image: "rust:1.43.0"
|
|
|
|
cache:
|
|
|
|
key: msrv
|
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- .cargo
|
|
|
|
|
|
|
|
cleanup-nightly:
|
|
|
|
extends: cleanup-stable
|
|
|
|
image: "rustlang/rust:nightly"
|
|
|
|
cache:
|
|
|
|
key: nightly
|
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- .cargo
|
|
|
|
|
2021-05-06 16:49:17 +00:00
|
|
|
# BUILD BASE
|
|
|
|
build-base-stable:
|
|
|
|
extends: .cargo-build-base
|
|
|
|
needs: ["cleanup-stable"]
|
|
|
|
|
|
|
|
build-base-msrv:
|
|
|
|
extends: build-base-stable
|
|
|
|
needs: ["cleanup-msrv"]
|
|
|
|
image: "rust:1.43.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
|
|
|
|
|
2021-04-28 10:14:52 +00:00
|
|
|
# BUILD
|
2021-04-21 07:06:56 +00:00
|
|
|
|
2021-04-28 10:14:52 +00:00
|
|
|
build-stable:
|
|
|
|
extends: .cargo-build
|
2021-05-06 16:49:17 +00:00
|
|
|
needs: ["build-base-stable"]
|
2021-04-28 06:09:11 +00:00
|
|
|
|
2021-04-28 10:14:52 +00:00
|
|
|
build-msrv:
|
|
|
|
extends: build-stable
|
2021-05-06 16:49:17 +00:00
|
|
|
needs: ["build-base-msrv"]
|
2021-04-28 10:14:52 +00:00
|
|
|
image: "rust:1.43.0"
|
2021-04-28 13:56:05 +00:00
|
|
|
cache:
|
|
|
|
key: msrv
|
2021-04-28 14:27:43 +00:00
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- .cargo
|
2021-04-21 07:06:56 +00:00
|
|
|
|
2021-04-28 10:14:52 +00:00
|
|
|
build-nightly:
|
|
|
|
extends: build-stable
|
2021-05-06 16:49:17 +00:00
|
|
|
needs: ["build-base-nightly"]
|
2021-04-28 10:14:52 +00:00
|
|
|
image: "rustlang/rust:nightly"
|
2021-04-28 13:56:05 +00:00
|
|
|
cache:
|
|
|
|
key: nightly
|
2021-04-28 14:27:43 +00:00
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- .cargo
|
|
|
|
|
2021-04-28 10:14:52 +00:00
|
|
|
# TEST
|
|
|
|
|
|
|
|
test-stable:
|
|
|
|
extends: .cargo-test
|
2021-04-28 10:34:46 +00:00
|
|
|
needs: ["build-stable"]
|
2021-04-28 10:14:52 +00:00
|
|
|
|
|
|
|
test-msrv:
|
|
|
|
extends: test-stable
|
|
|
|
image: "rust:1.43.0"
|
2021-04-28 10:34:46 +00:00
|
|
|
needs: ["build-msrv"]
|
2021-04-28 13:56:05 +00:00
|
|
|
cache:
|
|
|
|
key: msrv
|
2021-04-28 14:27:43 +00:00
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- .cargo
|
2021-04-28 10:14:52 +00:00
|
|
|
|
|
|
|
test-nightly:
|
|
|
|
extends: test-stable
|
|
|
|
image: "rustlang/rust:nightly"
|
2021-04-28 10:34:46 +00:00
|
|
|
needs: ["build-nightly"]
|
2021-04-28 13:56:05 +00:00
|
|
|
cache:
|
|
|
|
key: nightly
|
2021-04-28 14:27:43 +00:00
|
|
|
paths:
|
|
|
|
- target
|
|
|
|
- .cargo
|
2021-06-18 03:16:14 +00:00
|
|
|
|
2021-06-18 03:26:22 +00:00
|
|
|
# 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
|
|
|
|
|
2021-06-19 17:49:26 +00:00
|
|
|
#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
|