mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-31 05:47:40 +03:00
ci: refactor pipeline
This commit is contained in:
parent
253f46e846
commit
28c8a3e77a
28
rust-bindings/rust/.ci/generate-test-jobs.sh
Executable file
28
rust-bindings/rust/.ci/generate-test-jobs.sh
Executable file
@ -0,0 +1,28 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
get_features() {
|
||||
cargo read-manifest \
|
||||
| jq -jr '.features
|
||||
| keys
|
||||
| map(select(. != "dox"))
|
||||
| map(. + " ")
|
||||
| .[]'
|
||||
}
|
||||
|
||||
cat <<EOF
|
||||
include: /.ci/gitlab-ci-base.yml
|
||||
EOF
|
||||
|
||||
features=$(get_features)
|
||||
|
||||
for feature in $features; do
|
||||
|
||||
cat <<EOF
|
||||
test_feature_${feature}:
|
||||
extends: .fedora-ostree-devel
|
||||
script:
|
||||
- cargo test --verbose --workspace --features ${feature}
|
||||
EOF
|
||||
|
||||
done
|
29
rust-bindings/rust/.ci/gitlab-ci-base.yml
Normal file
29
rust-bindings/rust/.ci/gitlab-ci-base.yml
Normal file
@ -0,0 +1,29 @@
|
||||
.sccache:
|
||||
variables:
|
||||
SCCACHE_URL: https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
|
||||
CARGO_TARGET_DIR: ${CI_PROJECT_DIR}/target
|
||||
CARGO_HOME: ${CI_PROJECT_DIR}/cargo
|
||||
SCCACHE_DIR: ${CI_PROJECT_DIR}/sccache
|
||||
RUSTC_WRAPPER: sccache
|
||||
cache:
|
||||
paths:
|
||||
- cargo/
|
||||
- sccache/
|
||||
before_script:
|
||||
- curl -L "${SCCACHE_URL}" | tar -C /usr/bin/ -xz --wildcards --strip-components=1 '*/sccache'
|
||||
|
||||
.fedora-ostree-devel:
|
||||
image: fedora:rawhide
|
||||
extends: .sccache
|
||||
before_script:
|
||||
- dnf install -y cargo rust ostree-devel
|
||||
- curl -L "${SCCACHE_URL}" | tar -C /usr/bin/ -xz --wildcards --strip-components=1 '*/sccache'
|
||||
|
||||
.rust-ostree-devel:
|
||||
image: rust
|
||||
extends: .sccache
|
||||
before_script:
|
||||
- apt-get update
|
||||
- apt-get install -y libostree-dev
|
||||
- curl -L "${SCCACHE_URL}" | tar -C /usr/bin/ -xz --wildcards --strip-components=1 '*/sccache'
|
||||
|
@ -1,29 +1,27 @@
|
||||
image: fedora:rawhide
|
||||
|
||||
variables:
|
||||
SCCACHE_URL: https://github.com/mozilla/sccache/releases/download/0.2.13/sccache-0.2.13-x86_64-unknown-linux-musl.tar.gz
|
||||
CARGO_TARGET_DIR: ${CI_PROJECT_DIR}/target
|
||||
CARGO_HOME: ${CI_PROJECT_DIR}/cargo
|
||||
SCCACHE_DIR: ${CI_PROJECT_DIR}/sccache
|
||||
RUSTC_WRAPPER: sccache
|
||||
|
||||
before_script:
|
||||
- dnf install -y cargo rust ostree-devel
|
||||
- curl -L "${SCCACHE_URL}" | tar -C /usr/bin/ -xz --wildcards --strip-components=1 '*/sccache'
|
||||
|
||||
cache:
|
||||
paths:
|
||||
- cargo/
|
||||
- sccache/
|
||||
include: /.ci/gitlab-ci-base.yml
|
||||
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
- publish
|
||||
|
||||
check:
|
||||
stage: build
|
||||
# generate feature test jobs
|
||||
generate-test-jobs:
|
||||
stage: .pre
|
||||
image: rust
|
||||
script:
|
||||
- dnf install -y make git clippy rustfmt
|
||||
- mkdir -p target
|
||||
- apt-get update && apt-get install -y jq
|
||||
- .ci/generate-test-jobs.sh > target/test-jobs.yaml
|
||||
artifacts:
|
||||
paths:
|
||||
- target/test-jobs.yaml
|
||||
|
||||
# test
|
||||
check:
|
||||
stage: test
|
||||
extends: .rust-ostree-devel
|
||||
script:
|
||||
- rustup component add clippy rustfmt
|
||||
# fmt
|
||||
- cargo fmt --package ostree -- --check
|
||||
# check generated code
|
||||
@ -34,123 +32,30 @@ check:
|
||||
# clippy
|
||||
- cargo clippy --workspace --all-features
|
||||
|
||||
build_default-features:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace
|
||||
|
||||
# all feature levels
|
||||
build_v2014_9:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2014_9
|
||||
build_v2015_7:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2015_7
|
||||
build_v2016_14:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2016_14
|
||||
build_v2016_4:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2016_4
|
||||
build_v2016_5:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2016_5
|
||||
build_v2016_6:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2016_6
|
||||
build_v2016_7:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2016_7
|
||||
build_v2016_8:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2016_8
|
||||
build_v2017_1:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_1
|
||||
build_v2017_10:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_10
|
||||
build_v2017_11:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_11
|
||||
build_v2017_12:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_12
|
||||
build_v2017_13:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_13
|
||||
build_v2017_15:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_15
|
||||
build_v2017_2:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_2
|
||||
build_v2017_3:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_3
|
||||
build_v2017_4:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_4
|
||||
build_v2017_6:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_6
|
||||
build_v2017_7:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_7
|
||||
build_v2017_8:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_8
|
||||
build_v2017_9:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2017_9
|
||||
build_v2018_2:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2018_2
|
||||
build_v2018_3:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2018_3
|
||||
build_v2018_5:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2018_5
|
||||
build_v2018_6:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2018_6
|
||||
build_v2018_7:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2018_7
|
||||
build_v2018_9:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2018_9
|
||||
build_v2019_2:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2019_2
|
||||
build_v2019_3:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2019_3
|
||||
build_v2019_4:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2019_4
|
||||
build_v2019_6:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2019_6
|
||||
build_v2020_1:
|
||||
stage: build
|
||||
script: cargo test --verbose --workspace --features v2020_1
|
||||
# all feature levels
|
||||
|
||||
# non-x86 build
|
||||
build_aarch64:
|
||||
stage: build
|
||||
image: rust:buster
|
||||
before_script:
|
||||
- apt-get update && apt-get install -y libostree-dev
|
||||
- rustup target add aarch64-unknown-linux-gnu
|
||||
- curl -L "${SCCACHE_URL}" | tar -C /usr/bin/ -xz --wildcards --strip-components=1 '*/sccache'
|
||||
test_default-features:
|
||||
extends: .fedora-ostree-devel
|
||||
script:
|
||||
- cargo test --verbose --workspace
|
||||
|
||||
test_all_features:
|
||||
stage: test
|
||||
trigger:
|
||||
include:
|
||||
- artifact: target/test-jobs.yaml
|
||||
job: generate-test-jobs
|
||||
strategy: depend
|
||||
|
||||
build_aarch64:
|
||||
stage: test
|
||||
extends: .rust-ostree-devel
|
||||
script:
|
||||
- rustup target add aarch64-unknown-linux-gnu
|
||||
- PKG_CONFIG_ALLOW_CROSS=1 cargo build --verbose --workspace --all-features --target aarch64-unknown-linux-gnu
|
||||
|
||||
# docs
|
||||
pages:
|
||||
stage: publish
|
||||
extends: .sccache
|
||||
image: rustlang/rust:nightly
|
||||
variables:
|
||||
RUSTDOCFLAGS: >-
|
||||
@ -160,8 +65,6 @@ pages:
|
||||
--extern-html-root-url gio_sys=https://gtk-rs.org/docs
|
||||
--extern-html-root-url glib=https://gtk-rs.org/docs
|
||||
--extern-html-root-url gio=https://gtk-rs.org/docs
|
||||
before_script:
|
||||
- curl -L "${SCCACHE_URL}" | tar -C /usr/bin/ -xz --wildcards --strip-components=1 '*/sccache'
|
||||
script:
|
||||
- make merge-lgpl-docs
|
||||
- cargo doc --verbose --workspace --features dox --no-deps
|
||||
@ -175,16 +78,16 @@ pages:
|
||||
# publish
|
||||
publish_ostree-sys:
|
||||
stage: publish
|
||||
extends: .rust-ostree-devel
|
||||
script:
|
||||
- cargo publish --verbose --manifest-path sys/Cargo.toml --token $CRATES_IO_TOKEN
|
||||
cache: {}
|
||||
only:
|
||||
- /^ostree-sys\/.+$/
|
||||
|
||||
publish_ostree:
|
||||
stage: publish
|
||||
extends: .rust-ostree-devel
|
||||
script:
|
||||
- cargo publish --verbose --token $CRATES_IO_TOKEN
|
||||
cache: {}
|
||||
only:
|
||||
- /^ostree\/.+$/
|
||||
|
Loading…
x
Reference in New Issue
Block a user