chore(gitlab-ci): ...

This commit is contained in:
Gregor Kleen 2021-09-15 10:57:26 +02:00
parent fcffa4808c
commit 72143a95f1
2 changed files with 144 additions and 4 deletions

View File

@ -12,12 +12,15 @@ variables:
NIX_PATH: "nixpkgs=http://nixos.org/channels/nixos-21.05/nixexprs.tar.xz"
stages:
- setup
- frontend:build
- backend:build
- docker:build
node dependencies:
stage: setup
stage: frontend:build
script:
- nix -L build -o node-dependencies .#uniworxNodeDependencies
- nix-store --export $(nix-store -qR node-dependencies) > node-dependencies.nar
before_script:
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
- nix-env -f '<nixpkgs>' -riA envsubst
@ -29,7 +32,140 @@ node dependencies:
- install -v -T -m 0644 "${FONTAWESOME_NPM_AUTH_FILE}" /etc/fontawesome-token
artifacts:
paths:
- node-dependencies
- 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 <node-dependencies.nar
- nix -L build -o well-known .#uniworxWellKnown
- nix-store --export $(nix-store -qR well-known) > well-known.nar
before_script:
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
- nix-env -f '<nixpkgs>' -riA envsubst
- envsubst -i .gitlab-ci/nix.conf -o /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
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 <node-dependencies.nar
- nix-store --import <well-known.nar
- nix -L build -o frontend .#uniworxFrontend
- nix-store --export $(nix-store -qR frontend) > frontend.nar
before_script:
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
- nix-env -f '<nixpkgs>' -riA envsubst
- envsubst -i .gitlab-ci/nix.conf -o /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
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 <frontend.nar
- nix -L build -o backend .#uniworxBackend
- cp -pr --reflink=auto result/bin .
before_script:
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
- nix-env -f '<nixpkgs>' -riA envsubst
- envsubst -i .gitlab-ci/nix.conf -o /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
needs:
- job: frontend
artifacts: true
artifacts:
paths:
- bin/
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day"
retry: 2
interruptible: true
demo docker:
stage: docker:build
script:
- nix-store --import <backend.nar
- nix -L build -o backend .#uniworxDemoDocker
- cp -pr --reflink=auto -L result uniworx-demo.tar.gz
before_script:
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
- nix-env -f '<nixpkgs>' -riA envsubst
- envsubst -i .gitlab-ci/nix.conf -o /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
needs:
- job: backend
artifacts: true
artifacts:
paths:
- uniworx-demo.tar.gz
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day"
retry: 2
interruptible: true
docker:
stage: docker:build
script:
- nix-store --import <backend.nar
- nix -L build -o backend .#uniworxDocker
- cp -pr --reflink=auto -L result uniworx.tar.gz
before_script:
- install -m 0644 .gitlab-ci/nix-bootstrap.conf /etc/nix/nix.conf
- nix-env -f '<nixpkgs>' -riA envsubst
- envsubst -i .gitlab-ci/nix.conf -o /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
needs:
- job: backend
artifacts: true
artifacts:
paths:
- uniworx.tar.gz
name: "${CI_JOB_NAME}-${CI_COMMIT_SHORT_SHA}"
expire_in: "1 day"
retry: 2

View File

@ -106,9 +106,13 @@
[[ -n "''${1}" ]] && shift
${pkgs.skopeo}/bin/skopeo ''${@} --insecure-policy copy docker-archive://${dockerImage} ''${target}
'';
uniworxBackend = pkgs.symlinkJoin {
name = "uniworx";
paths = with pkgs; [ "uniworx:exe:uniworx" "uniworx:exe:uniworxdb" "uniworx:exe:uniworxload" "uniworx:exe:uniworx-wflint" ];
};
in {
packages = haskellFlake.packages // {
inherit (pkgs) uniworxNodeDependencies uniworxWellKnown uniworxFrontend uniworxDemoDocker uniworxDocker;
inherit (pkgs) uniworxNodeDependencies uniworxWellKnown uniworxFrontend uniworxBackend uniworxDemoDocker uniworxDocker;
};
apps = haskellFlake.apps // {
pushUniworxDemoDocker = flake-utils.lib.mkApp { drv = mkPushUniworxDocker pkgs.uniworxDemoDocker; };