Skip to content

Commit

Permalink
Adding QA jobs and expanding test jobs for CI/CD.
Browse files Browse the repository at this point in the history
  • Loading branch information
tegefaulkes committed Nov 18, 2021
1 parent 475266f commit 0f1f871
Show file tree
Hide file tree
Showing 10 changed files with 379 additions and 37 deletions.
285 changes: 277 additions & 8 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ variables:
stages:
- check
- build
- quality
- release

image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner

lint:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
Expand All @@ -18,17 +18,184 @@ lint:
npm run lint;
'
test:
test 1/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test;
npm run test -- tests/client;
'
test 2/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/agent;
'
test 3/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/bin;
'
test 4/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/bootstrap;
'
test 5/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/network;
'
test 6/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/vaults;
'
test 7/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/workers;
'
test 8/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/grpc;
'
test 9/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/http;
'
test 10/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/GenericIdTypes.test.ts tests/index.test.ts tests/PolykeyAgent.test.ts tests/utils.test.ts;
'
test 11/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/claims;
'
test 12/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/gestalts;
'
test 13/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/nodes;
'
test 14/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/git;
'
test 15/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/keys;
'
test 16/16:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test -- tests/acl tests/discovery tests/lockfile tests/notifications tests/session tests/sigchain tests/identities;
'
nix-dry:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: check
interruptible: true
script:
Expand All @@ -39,18 +206,120 @@ nix-dry:
- nix-build -v -v --dry-run ./release.nix --attr package.macos.x64.macho

nix:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: build
interruptible: true
script:
- >
nix-build ./release.nix
--max-jobs $(nproc)
--attr application
--attr docker
BUILDOUT=`nix-build ./release.nix\
--attr application\
--attr docker\
--attr package.linux.x64.elf\
--attr package.windows.x64.exe\
--attr package.macos.x64.macho`;
mkdir builds;
cp -r $BUILDOUT builds/;
chmod -R a+rw builds;
only:
- master
artifacts:
paths:
- builds

runs in node:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: quality
only:
- master
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
echo password > testPassword;
npm run polykey -- agent start --test -np ./nodePath --password-file ./testPassword;
'
running application build:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: quality
only:
- master
needs:
- job: nix
artifacts: true
interruptible: true
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
echo password > testPassword;
node builds/*/lib/node_modules/@matrixai/polykey/dist/bin/polykey.js agent start -np ./nodePath --password-file ./testPassword --test;
'
running docker build:
image: docker:19.03.12
variables:
DOCKER_TLS_CERTDIR: "/certs"
services:
- docker:19.03.12-dind
before_script:
- docker info
stage: quality
only:
- master
needs:
- job: nix
artifacts: true
interruptible: true
script:
- ./scripts/runDocker.sh

running linux build:
stage: quality
only:
- master
tags:
- linux
needs:
- job: nix
artifacts: true
interruptible: true
script:
- "echo password > testPassword"
- "./builds/*linux* agent start -np ./nodePath --password-file ./testPassword --test"

running windows build:
stage: quality
only:
- master
tags:
- windows
needs:
- job: nix
artifacts: true
interruptible: true
script:
- "echo password > testPassword"
- "./builds/*win32* agent start -np ./nodePath --password-file ./testPassword --test"

running macos build:
tags: [ shared-macos-amd64 ]
image: macos-11-xcode-12
stage: quality
only:
- master
needs:
- job: nix
artifacts: true
interruptible: true
script:
- "echo password > testPassword"
- "./builds/*macos* agent start -np ./nodePath --password-file ./testPassword --test"


packages:
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
stage: release
interruptible: true
script:
Expand Down
6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,15 @@
"assets": [
"node_modules/jose/**/*",
"node_modules/utp-native/**/*",
"node_modules/leveldown/**/*"
"node_modules/leveldown/**/*",
"node_modules/fd-lock/**/*",
"dist/**/*.json"
],
"scripts": "dist/workers/polykeyWorker.js"
},
"scripts": {
"build": "tsc -p ./tsconfig.build.json",
"postbuild": "cp -fR src/proto dist",
"postbuild": "cp -fR src/proto dist; cp src/notifications/*.json dist/notifications/; cp src/claims/*.json dist/claims/",
"ts-node": "ts-node -r tsconfig-paths/register",
"test": "jest",
"lint": "eslint '{src,tests}/**/*.{js,ts}'",
Expand Down
4 changes: 4 additions & 0 deletions scripts/runDocker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh

NAME=`docker load -i builds/*docker* | awk '{ print $3}'`
docker run $NAME
Loading

0 comments on commit 0f1f871

Please sign in to comment.