chore(gitlab-ci): use flake.nix instead of manually constructing flake url

This commit is contained in:
Sarah Vaupel 2023-07-15 16:24:19 +00:00
parent c8a3625e31
commit 1e74770ea2
2 changed files with 14 additions and 38 deletions

View File

@ -34,8 +34,7 @@ stages:
node dependencies:
stage: frontend:build
script:
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworxNodeDependencies"
- nix -L build -o result ".#uniworxNodeDependencies"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > node-dependencies.nar.xz
before_script: &nix-before
- git config --global init.defaultBranch master
@ -56,8 +55,7 @@ well known:
stage: frontend:build
script:
- xzcat node-dependencies.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworxWellKnown"
- nix -L build -o result ".#uniworxWellKnown"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > well-known.nar.xz
before_script: *nix-before
needs:
@ -76,8 +74,7 @@ frontend:
script:
- xzcat node-dependencies.nar.xz | nix-store --import
- xzcat well-known.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworxFrontend"
- nix -L build -o result ".#uniworxFrontend"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > frontend.nar.xz
before_script: *nix-before
needs:
@ -97,8 +94,7 @@ uniworx:lib:uniworx:
stage: backend:build
script:
- xzcat frontend.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworx:lib:uniworx"
- nix -L build -o result ".#uniworx:lib:uniworx"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:lib:uniworx.nar.xz
before_script: *nix-before
needs:
@ -120,8 +116,7 @@ uniworx:exe:uniworx:
stage: backend:build
script:
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworx:exe:uniworx"
- nix -L build -o result ".#uniworx:exe:uniworx"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworx.nar.xz
before_script: *nix-before
needs:
@ -145,8 +140,7 @@ uniworx:exe:uniworxdb:
stage: backend:build
script:
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworx:exe:uniworxdb"
- nix -L build -o result ".#uniworx:exe:uniworxdb"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxdb.nar.xz
before_script: *nix-before
needs:
@ -170,8 +164,7 @@ uniworx:exe:uniworxload:
stage: backend:build
script:
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L build -o result "${FLAKE}#uniworx:exe:uniworxload"
- nix -L build -o result ".#uniworx:exe:uniworxload"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxload.nar.xz
before_script: *nix-before
needs:
@ -196,8 +189,7 @@ check:
script:
- xzcat frontend.nar.xz | nix-store --import
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L flake check ${FLAKE}
- nix -L flake check .
before_script: *nix-before
needs:
- job: node dependencies # transitive
@ -215,8 +207,7 @@ container:
stage: container:build
script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- cp -pr --reflink=auto -L $(nix build --print-out-paths "${FLAKE}#uniworxDocker") uniworx.tar.gz
- cp -pr --reflink=auto -L $(nix build --print-out-paths ".#uniworxDocker") uniworx.tar.gz
before_script: *nix-before
needs:
- job: node dependencies # transitive
@ -244,8 +235,7 @@ test container:
stage: container:build
script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- cp -pr --reflink=auto -L $(nix build --print-out-paths "${FLAKE}#uniworxTestDocker") uniworx.tar.gz
- cp -pr --reflink=auto -L $(nix build --print-out-paths ".#uniworxTestDocker") uniworx.tar.gz
before_script: *nix-before
needs:
- job: node dependencies # transitive
@ -279,9 +269,8 @@ parse changelog:
before_script: *nix-before
script:
- xzcat node-dependencies.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].version' > .current-version
- nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md
- nix -L run ".#jqChangelogJson" -- -r '.versions[0].version' > .current-version
- nix -L run ".#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md
- echo "VERSION=$(cat .current-version)" >> build.env
artifacts:
reports:
@ -302,9 +291,8 @@ parse test changelog:
before_script: *nix-before
script:
- xzcat node-dependencies.nar.xz | nix-store --import
- source .gitlab-ci/construct-flake-url.sh
- nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].version' > .current-version
- nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md
- nix -L run ".#jqChangelogJson" -- -r '.versions[0].version' > .current-version
- nix -L run ".#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md
- echo "VERSION=$(cat .current-version)" >> build.env
artifacts:
reports:

View File

@ -1,12 +0,0 @@
#!/usr/bin/env bash
# SPDX-FileCopyrightText: 2022 Gregor Kleen <gregor.kleen@ifi.lmu.de>
#
# SPDX-License-Identifier: AGPL-3.0-or-later
if [ -n "${CI_COMMIT_TAG}" ]; then
ref="refs/tags/${CI_COMMIT_TAG}"
else
ref="refs/heads/${CI_COMMIT_BRANCH}"
fi
export FLAKE="git+${CI_REPOSITORY_URL}?rev=${CI_COMMIT_SHA}&ref=${ref}"