workflow: rules: - if: '$CI_PIPELINE_SOURCE == "push"' when: always - when: never default: image: name: registry.gitlab.com/fradrive/fradrive/nix-unstable:hcdba12p7ajl9xylgmw4kfn6p9c185xy variables: NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz" AWS_SHARED_CREDENTIALS_FILE: "/etc/aws/credentials" stages: - frontend:build - backend:build - test - docker:build - prepare release - upload - release node dependencies: stage: frontend:build script: - nix -L build -o result .#uniworxNodeDependencies - nix-store --export $(nix-store -qR result) | xz -T0 -2 > node-dependencies.nar.xz before_script: &nix-before - mkdir -p /etc/nix - install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf - .gitlab-ci/write-minio-creds.sh - .gitlab-ci/make-minio-bucket.sh - cp -pr --reflink=auto -L .gitlab-ci/upload-to-cache.sh /etc/nix/upload-to-cache.sh - install -m 0644 .gitlab-ci/nix.conf /etc/nix/nix.conf - git config --global init.defaultBranch master - install -v -m 0700 -d ~/.ssh - install -v -T -m 0644 "${SSH_KNOWN_HOSTS}" ~/.ssh/known_hosts - install -v -T -m 0400 "${SSH_DEPLOY_KEY}" ~/.ssh/deploy && echo "IdentityFile ~/.ssh/deploy" >> ~/.ssh/config; - install -v -T -m 0644 "${FONTAWESOME_NPM_AUTH_FILE}" /etc/fontawesome-token - | if [ -n "${REGISTRY_AUTHFILE}" ]; then mkdir -p ~/.docker install -v -T -m 0400 "${REGISTRY_AUTHFILE}" ~/.docker/config.json fi artifacts: paths: - node-dependencies.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true well known: stage: frontend:build script: - xzcat node-dependencies.nar.xz | nix-store --import - 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: - job: node dependencies artifacts: true artifacts: paths: - well-known.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true frontend: stage: frontend:build script: - xzcat node-dependencies.nar.xz | nix-store --import - xzcat well-known.nar.xz | nix-store --import - nix -L build -o result .#uniworxFrontend - nix-store --export $(nix-store -qR result) | xz -T0 -2 > frontend.nar.xz before_script: *nix-before needs: - job: node dependencies artifacts: true - job: well known artifacts: true artifacts: paths: - frontend.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true uniworx:lib:uniworx: stage: backend:build script: - xzcat frontend.nar.xz | nix-store --import - 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: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend artifacts: true artifacts: paths: - uniworx:lib:uniworx.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true uniworx:exe:uniworx: stage: backend:build script: - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - 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: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx artifacts: true artifacts: paths: - uniworx:exe:uniworx.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true uniworx:exe:uniworx-wflint: stage: backend:build script: - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - nix -L build -o result .#uniworx:exe:uniworx-wflint - nix-store --export $(nix-store -qR result) | xz -T0 -2 > uniworx:exe:uniworx-wflint.nar.xz before_script: *nix-before needs: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx artifacts: true artifacts: paths: - uniworx:exe:uniworx-wflint.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true uniworx:exe:uniworxdb: stage: backend:build script: - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - 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: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx artifacts: true artifacts: paths: - uniworx:exe:uniworxdb.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true uniworx:exe:uniworxload: stage: backend:build script: - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - 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: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx artifacts: true artifacts: paths: - uniworx:exe:uniworxload.nar.xz name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true check: stage: test script: - xzcat frontend.nar.xz | nix-store --import - xzcat uniworx:lib:uniworx.nar.xz | nix-store --import - nix -L flake check before_script: *nix-before needs: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend artifacts: true - job: uniworx:lib:uniworx artifacts: true retry: 2 interruptible: true demo docker: stage: docker:build script: - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - xzcat uniworx:exe:uniworxdb.nar.xz | nix-store --import - nix -L build -o result .#uniworxDemoDocker - nix-store --export $(nix-store -qR result) > uniworx-demo.nar # image is already compressed, no need for xz before_script: *nix-before needs: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx # transitive artifacts: false - job: uniworx:exe:uniworx artifacts: true - job: uniworx:exe:uniworxdb artifacts: true - job: check # sanity artifacts: false artifacts: paths: - uniworx-demo.nar name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true docker: stage: docker:build script: - xzcat uniworx:exe:uniworx.nar.xz | nix-store --import - nix -L build -o result .#uniworxDocker - nix-store --export $(nix-store -qR result) > uniworx.nar # image is already compressed, no need for xz before_script: *nix-before needs: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx # transitive artifacts: false - job: uniworx:exe:uniworx artifacts: true - job: check # sanity artifacts: false artifacts: paths: - uniworx.nar name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true parse changelog: stage: prepare release needs: - job: node dependencies artifacts: true rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ when: on_success before_script: *nix-before script: - xzcat node-dependencies.nar.xz | nix-store --import - nix -L run .#jqChangelogJson -- -r '.versions[0].version' > .current-version - nix -L run .#jqChangelogJson -- -r '.versions[0].body' > .current-changelog.md artifacts: paths: - .current-version - .current-changelog.md name: "changelog-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true upload docker: stage: upload script: - nix-store --import < uniworx.nar - nix -L run .#pushUniworxDocker before_script: *nix-before needs: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx # transitive artifacts: false - job: uniworx:exe:uniworx # transitive artifacts: false - job: check # transitive artifacts: false - job: docker artifacts: true rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ when: on_success upload demo docker: stage: upload script: - nix-store --import < uniworx-demo.nar - nix -L run .#pushUniworxDemoDocker before_script: *nix-before needs: - job: node dependencies # transitive artifacts: false - job: well known # transitive artifacts: false - job: frontend # tranitive artifacts: false - job: uniworx:lib:uniworx # transitive artifacts: false - job: uniworx:exe:uniworx # transitive artifacts: false - job: check # transitive artifacts: false - job: demo docker artifacts: true rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ when: on_success release: variables: GIT_STRATEGY: none stage: release image: registry.gitlab.com/gitlab-org/release-cli:latest rules: - if: $CI_COMMIT_REF_NAME =~ /^v[0-9].*/ when: on_success before_script: - export VERSION="$(cat .current-version)" script: - release-cli create --name "${VERSION}" --tag-name $CI_COMMIT_TAG --description .current-changelog.md needs: - job: check # sanity artifacts: false - job: parse changelog artifacts: true