mirror of
https://gitlab.com/ahoneybun/nyxi-installer.git
synced 2025-05-12 02:54:03 -06:00
more testing
This commit is contained in:
parent
010858d4c5
commit
22eaee4866
1 changed files with 62 additions and 25 deletions
|
@ -1,45 +1,82 @@
|
|||
stages:
|
||||
- prepare
|
||||
- test
|
||||
- build
|
||||
- release
|
||||
|
||||
variables:
|
||||
PACKAGE_REGISTRY_URL: "${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/nyxi-installer/${CI_COMMIT_TAG}"
|
||||
|
||||
test:
|
||||
prepare-job:
|
||||
stage: prepare
|
||||
image: rust
|
||||
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 "======== 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
|
||||
before_script:
|
||||
script:
|
||||
- echo "======== TESTS JOB ========"
|
||||
- apt update -m
|
||||
- apt install -y libfdisk-dev libclang-19-dev
|
||||
script:
|
||||
- cargo test --verbose
|
||||
|
||||
build:
|
||||
build-job:
|
||||
stage: build
|
||||
image: rust:latest
|
||||
before_script:
|
||||
script:
|
||||
- echo "======== BUILD JOB ========"
|
||||
- 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/
|
||||
- mv /builds/ahoneybun/nyxi-installer/target/release/nyxi-installer bin/nyxi-installer-v${PKG_VERSION}
|
||||
artifacts:
|
||||
paths:
|
||||
- bin
|
||||
- bin/
|
||||
|
||||
release:
|
||||
stage: release
|
||||
image: registry.gitlab.com/gitlab-org/release-cli:latest
|
||||
rules:
|
||||
- if: $CI_COMMIT_TAG
|
||||
script:
|
||||
- echo "running release_job"
|
||||
release:
|
||||
tag_name: '$CI_COMMIT_TAG'
|
||||
description: '$CI_COMMIT_TAG'
|
||||
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:
|
||||
tag_name: "v$PKG_VERSION"
|
||||
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