chore(gitlab-ci): ...

This commit is contained in:
Gregor Kleen 2021-09-23 09:10:39 +02:00
parent 01bdbd1b25
commit 5f7b5cb380

View File

@ -11,6 +11,7 @@ default:
variables: variables:
NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz" NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz"
AWS_SHARED_CREDENTIALS_FILE: "/etc/aws/credentials" AWS_SHARED_CREDENTIALS_FILE: "/etc/aws/credentials"
FLAKE: "${CI_REPOSITORY_URL}?ref=${CI_COMMIT_SHA}"
stages: stages:
- frontend:build - frontend:build
@ -23,8 +24,7 @@ stages:
node dependencies: node dependencies:
stage: frontend:build stage: frontend:build
script: script:
- git status --short --porcelain # debug - 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 - nix-store --export $(nix-store -qR result) | xz -T0 -2 > node-dependencies.nar.xz
before_script: &nix-before before_script: &nix-before
- mkdir -p /etc/nix - mkdir -p /etc/nix
@ -55,7 +55,7 @@ well known:
stage: frontend:build stage: frontend:build
script: script:
- xzcat node-dependencies.nar.xz | nix-store --import - xzcat node-dependencies.nar.xz | nix-store --import
- nix -L build -o result .#uniworxWellKnown - nix -L build -o result "${FLAKE}#uniworxWellKnown"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > well-known.nar.xz - nix-store --export $(nix-store -qR result) | xz -T0 -2 > well-known.nar.xz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -74,7 +74,7 @@ frontend:
script: script:
- xzcat node-dependencies.nar.xz | nix-store --import - xzcat node-dependencies.nar.xz | nix-store --import
- xzcat well-known.nar.xz | nix-store --import - xzcat well-known.nar.xz | nix-store --import
- nix -L build -o result .#uniworxFrontend - nix -L build -o result "${FLAKE}#uniworxFrontend"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > frontend.nar.xz - nix-store --export $(nix-store -qR result) | xz -T0 -2 > frontend.nar.xz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -94,7 +94,7 @@ uniworx:lib:uniworx:
stage: backend:build stage: backend:build
script: script:
- xzcat frontend.nar.xz | nix-store --import - xzcat frontend.nar.xz | nix-store --import
- nix -L build -o result .#uniworx:lib:uniworx - nix -L build -o result "${FLAKE}#uniworx:lib:uniworx"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:lib:uniworx.nar.xz - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:lib:uniworx.nar.xz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -116,7 +116,7 @@ uniworx:exe:uniworx:
stage: backend:build stage: backend:build
script: script:
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- nix -L build -o result .#uniworx:exe:uniworx - nix -L build -o result "${FLAKE}#uniworx:exe:uniworx"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworx.nar.xz - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworx.nar.xz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -140,7 +140,7 @@ uniworx:exe:uniworx-wflint:
stage: backend:build stage: backend:build
script: script:
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- nix -L build -o result .#uniworx:exe:uniworx-wflint - nix -L build -o result "${FLAKE}#uniworx:exe:uniworx-wflint"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworx-wflint.nar.xz - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworx-wflint.nar.xz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -164,7 +164,7 @@ uniworx:exe:uniworxdb:
stage: backend:build stage: backend:build
script: script:
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- nix -L build -o result .#uniworx:exe:uniworxdb - nix -L build -o result "${FLAKE}#uniworx:exe:uniworxdb"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxdb.nar.xz - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxdb.nar.xz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -188,7 +188,7 @@ uniworx:exe:uniworxload:
stage: backend:build stage: backend:build
script: script:
- xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import
- nix -L build -o result .#uniworx:exe:uniworxload - nix -L build -o result "${FLAKE}#uniworx:exe:uniworxload"
- nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxload.nar.xz - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworxload.nar.xz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -232,7 +232,7 @@ demo docker:
script: script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import - xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import
- nix -L build -o result .#uniworxDemoDocker - nix -L build -o result "${FLAKE}#uniworxDemoDocker"
- cp -pr --reflink=auto -L result uniworx-demo.tar.gz - cp -pr --reflink=auto -L result uniworx-demo.tar.gz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -266,7 +266,7 @@ docker:
stage: docker stage: docker
script: script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- nix -L build -o result .#uniworxDocker - nix -L build -o result "${FLAKE}#uniworxDocker"
- cp -pr --reflink=auto -L result uniworx.tar.gz - cp -pr --reflink=auto -L result uniworx.tar.gz
before_script: *nix-before before_script: *nix-before
needs: needs:
@ -305,9 +305,12 @@ parse changelog:
before_script: *nix-before before_script: *nix-before
script: script:
- xzcat node-dependencies.nar.xz | nix-store --import - xzcat node-dependencies.nar.xz | nix-store --import
- nix -L run .#jqChangelogJson -- -r '.versions[0].version' > .current-version - nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].version' > .current-version
- nix -L run .#jqChangelogJson -- -r '.versions[0].body' > .current-changelog.md - nix -L run "${FLAKE}#jqChangelogJson" -- -r '.versions[0].body' > .current-changelog.md
- echo "VERSION=$(cat .current-version)" >> build.env
artifacts: artifacts:
reports:
dotenv: build.env
paths: paths:
- .current-version - .current-version
- .current-changelog.md - .current-changelog.md
@ -320,7 +323,7 @@ upload docker:
stage: docker stage: docker
script: script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- nix -L run .#pushUniworxDocker - nix -L run "${FLAKE}#pushUniworxDocker"
before_script: *nix-before before_script: *nix-before
needs: needs:
- job: node dependencies # transitive - job: node dependencies # transitive
@ -344,7 +347,7 @@ upload demo docker:
script: script:
- xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import
- xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import - xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import
- nix -L run .#pushUniworxDemoDocker - nix -L run "${FLAKE}#pushUniworxDemoDocker"
before_script: *nix-before before_script: *nix-before
needs: needs:
- job: node dependencies # transitive - job: node dependencies # transitive
@ -373,8 +376,6 @@ release:
rules: rules:
- if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/
when: on_success when: on_success
before_script:
- export VERSION="$(cat .current-version)"
script: script:
- release-cli create --name "${VERSION}" --tag-name $CI_COMMIT_TAG --description .current-changelog.md - release-cli create --name "${VERSION}" --tag-name $CI_COMMIT_TAG --description .current-changelog.md
needs: needs: