generated from MatrixAI/TypeScript-Demo-Lib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
.gitlab-ci.yml
163 lines (151 loc) · 3.81 KB
/
.gitlab-ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
default:
interruptible: true
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages:
- check
- build
- quality
- release
lint:
stage: check
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run lint;
'
test:
stage: check
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages nodejs --run '
npm install;
npm run test;
'
nix-dry:
stage: check
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
script:
- nix-build -v -v --dry-run ./release.nix --attr application
- nix-build -v -v --dry-run ./release.nix --attr docker
- nix-build -v -v --dry-run ./release.nix --attr package.linux.x64.elf
- nix-build -v -v --dry-run ./release.nix --attr package.windows.x64.exe
- nix-build -v -v --dry-run ./release.nix --attr package.macos.x64.macho
nix:
stage: build
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
script:
- mkdir -p ./builds
# nix-specific application target
- >
build_application="$(nix-build \
--max-jobs "$(nproc)" --cores "$(nproc)" \
./release.nix \
--attr application \
)"
- >
nix-store --export $( \
nix-store --query --requisites "$build_application" \
) | gzip > ./builds/typescript-demo-lib.closure.gz
# non-nix targets
- >
builds="$(nix-build \
--max-jobs "$(nproc)" --cores "$(nproc)" \
./release.nix \
--attr docker \
--attr package.linux.x64.elf \
--attr package.windows.x64.exe \
--attr package.macos.x64.macho)"
- cp -r $builds ./builds/
only:
- master
artifacts:
paths:
- ./builds/
application run:
stage: quality
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
dependencies:
- nix
script:
- >
build_application="$( \
gunzip -c ./builds/typescript-demo-lib.closure.gz | \
nix-store --import | \
tail -1 \
)"
- $build_application/bin/typescript-demo-lib
only:
- master
docker run:
stage: quality
image: docker:20.10.11
dependencies:
- nix
services:
- docker:20.10.11-dind
variables:
DOCKER_TLS_CERTDIR: "/certs"
before_script:
- docker info
script:
- image="$(docker load --input ./builds/*docker* | cut -d' ' -f3)"
- docker run "$image"
only:
- master
linux run:
stage: quality
image: ubuntu:latest
dependencies:
- nix
script:
- for f in ./builds/*-linux-*; do "$f"; done
only:
- master
windows run:
stage: quality
dependencies:
- nix
script:
- Get-ChildItem -File ./builds/*-win32-* | ForEach {& $_.FullName}
tags:
- windows
only:
- master
# macos is disabled until this repo has access
# macos run:
# stage: quality
# image: macos-11-xcode-12
# dependencies:
# - nix
# script:
# - for f in ./builds/*-macos-*; do "$f"; done
# only:
# - master
# tags:
# - shared-macos-amd64
packages:
stage: release
image: registry.gitlab.com/matrixai/engineering/maintenance/gitlab-runner
dependencies:
- nix
script:
- >
nix-shell -I nixpkgs=./pkgs.nix --packages git gitAndTools.gh --run '
commit="$(git rev-parse --short HEAD)";
gh release \
create "$commit" \
builds/*.closure.gz \
builds/*-linux-* \
builds/*-win32-* \
builds/*-macos-* \
--title "Build-$(date -u +"%Y-%m-%dT%H:%M:%SZ")" \
--prerelease \
--notes "" \
--repo MatrixAI/TypeScript-Demo-Lib;
'
only:
- master