more testing

This commit is contained in:
Aaron Honeycutt 2025-04-24 08:25:02 -06:00
parent 010858d4c5
commit 22eaee4866

View file

@ -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:
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
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 "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:
tag_name: '$CI_COMMIT_TAG'
description: '$CI_COMMIT_TAG'
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'