mirror of
https://gitlab.com/ahoneybun/nyxi-installer.git
synced 2025-05-12 11:04:02 -06:00
more testing
This commit is contained in:
parent
010858d4c5
commit
22eaee4866
1 changed files with 62 additions and 25 deletions
109
.gitlab-ci.yml
109
.gitlab-ci.yml
|
@ -1,45 +1,82 @@
|
||||||
stages:
|
stages:
|
||||||
|
- prepare
|
||||||
- test
|
- test
|
||||||
- build
|
- build
|
||||||
- release
|
- release
|
||||||
|
|
||||||
variables:
|
prepare-job:
|
||||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/nyxi-installer/${CI_COMMIT_TAG}"
|
stage: prepare
|
||||||
|
image: rust
|
||||||
test:
|
|
||||||
stage: test
|
|
||||||
image: rust:latest
|
|
||||||
before_script:
|
|
||||||
- apt update -m
|
|
||||||
- apt install -y libfdisk-dev libclang-19-dev
|
|
||||||
script:
|
|
||||||
- cargo test --verbose
|
|
||||||
|
|
||||||
build:
|
|
||||||
stage: build
|
|
||||||
image: rust:latest
|
|
||||||
before_script:
|
|
||||||
- apt update -m
|
|
||||||
- apt install -y libfdisk-dev libclang-19-dev
|
|
||||||
script:
|
|
||||||
- cargo build --release
|
|
||||||
- mkdir bin
|
|
||||||
- mv /builds/ahoneybun/nyxi-installer/target/release/nyxi-installer /bin/nyxi-installer
|
|
||||||
- chmod +x /bin/nyxi-installer
|
|
||||||
cache:
|
|
||||||
paths:
|
|
||||||
- target/release/
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- bin
|
|
||||||
|
|
||||||
release:
|
|
||||||
stage: release
|
|
||||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
|
||||||
rules:
|
rules:
|
||||||
- if: $CI_COMMIT_TAG
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: never # Do not run this job when a tag is created manually
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
|
||||||
script:
|
script:
|
||||||
- echo "running release_job"
|
- echo "======== PREPARE JOB ========"
|
||||||
|
- echo "PKG_VERSION=$(awk -F ' = ' '$1 ~ /version/ { gsub(/["]/, "", $2); printf("%s",$2) }' Cargo.toml)" >> variables.env
|
||||||
|
- echo "PKG_REGISTRY_URL=${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic" >> variables.env
|
||||||
|
- echo $PKG_VERSION
|
||||||
|
artifacts:
|
||||||
|
reports:
|
||||||
|
dotenv: variables.env
|
||||||
|
test-job:
|
||||||
|
stage: test
|
||||||
|
image: rust:latest
|
||||||
|
script:
|
||||||
|
- echo "======== TESTS JOB ========"
|
||||||
|
- apt update -m
|
||||||
|
- apt install -y libfdisk-dev libclang-19-dev
|
||||||
|
- cargo test --verbose
|
||||||
|
|
||||||
|
build-job:
|
||||||
|
stage: build
|
||||||
|
image: rust:latest
|
||||||
|
script:
|
||||||
|
- echo "======== BUILD JOB ========"
|
||||||
|
- apt update -m
|
||||||
|
- apt install -y libfdisk-dev libclang-19-dev
|
||||||
|
- cargo build --release
|
||||||
|
- mkdir bin
|
||||||
|
- mv /builds/ahoneybun/nyxi-installer/target/release/nyxi-installer bin/nyxi-installer-v${PKG_VERSION}
|
||||||
|
artifacts:
|
||||||
|
paths:
|
||||||
|
- bin/
|
||||||
|
|
||||||
|
release-job:
|
||||||
|
stage: release
|
||||||
|
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||||
|
needs:
|
||||||
|
- job: prepare-job
|
||||||
|
artifacts: true
|
||||||
|
- job: build-job
|
||||||
|
script:
|
||||||
|
- echo "======== RELEASE JOB ========"
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: never # Do not run this job when a tag is created manually
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
|
||||||
release:
|
release:
|
||||||
tag_name: '$CI_COMMIT_TAG'
|
tag_name: "v$PKG_VERSION"
|
||||||
description: '$CI_COMMIT_TAG'
|
description: "NixOS installer in Rust : v$PKG_VERSION"
|
||||||
|
ref: "$CI_COMMIT_SHA" # The tag is created from the pipeline SHA.
|
||||||
|
assets:
|
||||||
|
links:
|
||||||
|
- name: "v$PKG_VERSION"
|
||||||
|
url: "${PKG_REGISTRY_URL}/x86_64-unknown-linux-gnu/v${PKG_VERSION}/nyxi-installer"
|
||||||
|
|
||||||
|
upload-job:
|
||||||
|
stage: release
|
||||||
|
image: curlimages/curl:latest
|
||||||
|
needs:
|
||||||
|
- job: prepare-job
|
||||||
|
artifacts: true
|
||||||
|
- job: build-job
|
||||||
|
artifacts: true
|
||||||
|
rules:
|
||||||
|
- if: $CI_COMMIT_TAG
|
||||||
|
when: never # Do not run this job when a tag is created manually
|
||||||
|
- if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH # Run this job when commits are pushed or merged to the default branch
|
||||||
|
script:
|
||||||
|
- echo "======== UPLOAD JOB ========"
|
||||||
|
- ls -la bin/
|
||||||
|
- 'curl --header "JOB-TOKEN: ${CI_JOB_TOKEN}" --upload-file bin/nyxi-installer-v${PKG_VERSION} ${PKG_REGISTRY_URL}/x86_64-unknown-linux-gnu/v${PKG_VERSION}/nyxi-installer'
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue