Skip to content
Snippets Groups Projects

Optimize CI and update deps

Merged Geoffrey Arthaud requested to merge xx-update-deps into main
Files
3
+ 40
28
@@ -13,27 +13,35 @@ variables:
@@ -13,27 +13,35 @@ variables:
default:
default:
cache:
cache:
key: rust-$CI_JOB_NAME
key: rust-deps
paths:
paths:
- .cargo
- .cargo
- target
policy: pull
policy: pull-push
stages:
stages:
- prepare
- deps_and_lint
- build_test
- build_test
- release
- release
- deploy
- deploy
- deploy_test
- deploy_test
include:
include:
- component: ${CI_SERVER_FQDN}/share/components/oci-copier/crane@~latest
- component: $CI_SERVER_FQDN/share/components/oci-builder/podman@~latest
inputs:
inputs:
as: copy-image-rust
as: build-rust-image
stage: prepare
stage: .pre
imageNameToCopy: rust
targetImageAppName: rust-tools
imageTagToCopy: $RUST_VERSION
targetImageAppTag: $RUST_VERSION
copiedImageDigest: "RUST"
targetImageRegistryDigestName: "RUST"
 
DockerfileContent: |-
 
FROM rust:$RUST_VERSION
 
RUN rustup component add rustfmt
 
RUN rustup component add clippy
 
RUN rustup target add x86_64-unknown-linux-musl
 
RUN rustup target add x86_64-pc-windows-gnu
 
RUN rustup target add aarch64-apple-darwin
 
RUN rustup target add x86_64-apple-darwin
 
- component: $CI_SERVER_FQDN/share/components/oci-builder/podman@~latest
- component: $CI_SERVER_FQDN/share/components/oci-builder/podman@~latest
inputs:
inputs:
as: release-gpd-image
as: release-gpd-image
@@ -45,7 +53,7 @@ include:
@@ -45,7 +53,7 @@ include:
forceBuild: true
forceBuild: true
Dockerfile: ${CI_PROJECT_DIR}/Dockerfile
Dockerfile: ${CI_PROJECT_DIR}/Dockerfile
copy-image-rust:
build-rust-image:
cache: [ ]
cache: [ ]
release-gpd-image:
release-gpd-image:
@@ -57,35 +65,35 @@ release-gpd-image:
@@ -57,35 +65,35 @@ release-gpd-image:
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG
check-format:
check-format:
stage: build_test
stage: deps_and_lint
image: ${REGISTRY_IMAGE_RUST}
image: ${REGISTRY_IMAGE_RUST}
script:
script:
- rustup component add rustfmt
- cargo fetch
- rustup component add clippy
- cargo fmt --all -- --check
- cargo fmt --all -- --check
- cargo clippy -- -D warnings
- cargo clippy -- -D warnings
 
cache:
 
key: rust-deps
 
paths:
 
- .cargo
 
policy: pull-push
test-rust-current:
test-rust-current:
stage: build_test
stage: build_test
image: rust:$RUST_VERSION
image: ${REGISTRY_IMAGE_RUST}
script:
script:
- cargo test --verbose
- cargo test --verbose
- cargo run -- $TEST_OPTIONS
- cargo run -- $TEST_OPTIONS
- cargo run -- $TEST_OPTIONS --token $TEST_GL_TOKEN
- cargo run -- $TEST_OPTIONS --token $TEST_GL_TOKEN
allow_failure: true
- cargo run -- $CLEAN_OPTIONS
 
- cargo run -- $CLEAN_OPTIONS --token $TEST_GL_TOKEN
test-rust-nightly:
test-rust-nightly:
extends: test-rust-current
extends: test-rust-current
image: rustlang/rust:nightly
image: rustlang/rust:nightly
allow_failure: true
allow_failure: true
test-clean-rust-current:
extends: test-rust-current
allow_failure: true
variables:
TEST_OPTIONS: $CLEAN_OPTIONS
.rust-release:
.rust-release:
 
image: ${REGISTRY_IMAGE_RUST}
stage: release
stage: release
variables:
variables:
APP_NAME: gitlab-project-doctor
APP_NAME: gitlab-project-doctor
@@ -107,12 +115,11 @@ test-clean-rust-current:
@@ -107,12 +115,11 @@ test-clean-rust-current:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG
needs:
needs:
- copy-image-rust
- build-rust-image
- test-rust-current
- test-rust-current
release-linux:
release-linux:
extends: .rust-release
extends: .rust-release
image: ${REGISTRY_IMAGE_RUST}
variables:
variables:
TARGET_ARCH: x86_64-unknown-linux-musl
TARGET_ARCH: x86_64-unknown-linux-musl
LDD_CMD: ldd
LDD_CMD: ldd
@@ -144,7 +151,6 @@ release-macos-x86:
@@ -144,7 +151,6 @@ release-macos-x86:
release-windows:
release-windows:
extends: .rust-release
extends: .rust-release
image: ${REGISTRY_IMAGE_RUST}
variables:
variables:
TARGET_ARCH: x86_64-pc-windows-gnu
TARGET_ARCH: x86_64-pc-windows-gnu
APP_NAME: gitlab-project-doctor.exe
APP_NAME: gitlab-project-doctor.exe
@@ -155,9 +161,12 @@ release-windows:
@@ -155,9 +161,12 @@ release-windows:
test-release-docker:
test-release-docker:
stage: deploy_test
stage: deploy_test
image: $CI_REGISTRY/pub/numeco/gitlab-project-doctor:$CI_COMMIT_SHA
image: $CI_REGISTRY/pub/numeco/gitlab-project-doctor:$VERSION
script:
script:
- gitlab-project-doctor --url $CI_PROJECT_URL -a
- gitlab-project-doctor $TEST_OPTIONS
 
- gitlab-project-doctor $TEST_OPTIONS --token $TEST_GL_TOKEN
 
- gitlab-project-doctor $CLEAN_OPTIONS
 
- gitlab-project-doctor $CLEAN_OPTIONS --token $TEST_GL_TOKEN
cache: [ ]
cache: [ ]
needs:
needs:
- release-gpd-image
- release-gpd-image
@@ -173,7 +182,10 @@ test-release-linux:
@@ -173,7 +182,10 @@ test-release-linux:
script:
script:
- 'curl -O --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/x86_64-unknown-linux-musl/latest/gitlab-project-doctor"'
- 'curl -O --header "JOB-TOKEN: $CI_JOB_TOKEN" "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/x86_64-unknown-linux-musl/latest/gitlab-project-doctor"'
- chmod +x gitlab-project-doctor
- chmod +x gitlab-project-doctor
- ./gitlab-project-doctor --url $CI_PROJECT_URL -a
- ./gitlab-project-doctor $TEST_OPTIONS
 
- ./gitlab-project-doctor $TEST_OPTIONS --token $TEST_GL_TOKEN
 
- ./gitlab-project-doctor $CLEAN_OPTIONS
 
- ./gitlab-project-doctor $CLEAN_OPTIONS --token $TEST_GL_TOKEN
rules:
rules:
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
- if: $CI_COMMIT_TAG
- if: $CI_COMMIT_TAG
Loading