workflow: rules: - if: '$CI_PIPELINE_SOURCE == "push"' when: always - when: never default: image: name: nixpkgs/nix-flakes:nixos-21.05 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 - docker:build node dependencies: stage: frontend:build script: - nix -L build -o result .#uniworxNodeDependencies - nix-store --export $(nix-store -qR result) > node-dependencies.nar before_script: &nix-before - install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf - .gitlab-ci/write-minio-creds.sh - .gitlab-ci/make-minio-bucket.sh - nix-env -f .gitlab-ci/patched-nix.nix -iE 'f: f {}' - 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 artifacts: paths: - node-dependencies.nar name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true well known: stage: frontend:build script: - nix-store --import well-known.nar before_script: *nix-before needs: - job: node dependencies artifacts: true artifacts: paths: - well-known.nar name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true frontend: stage: frontend:build script: - nix-store --import frontend.nar before_script: *nix-before needs: - job: node dependencies artifacts: true - job: well known artifacts: true artifacts: paths: - frontend.nar name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}" expire_in: "1 day" retry: 2 interruptible: true backend: stage: backend:build script: - nix-store --import