blob: 9f486ef3a42e3336b9274adc6bcc32a2b0bf3183 (
plain)
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
|
# https://taskfile.dev
#This taskfile must be called from the CI taskfile, as it is part of the CI
#project and it's pipleine. This file will also be copied to the container image
#and used to build the native libraries for the project.
version: "3"
vars:
INCLUDE_FILES: "Dockerfile, docker-compose.yaml"
CERT_KEY_PARAMS: "ec -pkeyopt ec_paramgen_curve:secp384r1"
includes:
install:
taskfile: ../install.taskfile.yaml
optional: true #not needed for inside container build
tasks:
#called from inside the container to build native libraries
build-libs:
vars:
OUT_DIR: "{{.USER_WORKING_DIR}}/out"
SSL_DIR: "{{.USER_WORKING_DIR}}/ssl"
#build stage generates the following libraries
generates:
- "{{.USER_WORKING_DIR}}/out/libargon2.so"
- "{{.USER_WORKING_DIR}}/out/libvn_rpmalloc.so"
- "{{.USER_WORKING_DIR}}/out/libvn_compress.so"
cmds:
#build argon2 native library
- cd lib/argon2/ && task && cp build/libargon2.so {{.OUT_DIR}}/libargon2.so
#build rpmalloc library
- cd lib/vnlib_rpmalloc/ && task && cp build/libvn_rpmalloc.so {{.OUT_DIR}}/libvn_rpmalloc.so
#install zlib and brotli native libraries from the source repos (they dont have active releases anymore :()
- cd lib/vnlib_compress/ && task && cp build/libvn_compress.so {{.OUT_DIR}}/libvn_compress.so
#build native compression lib and put in lib dir
- cd lib/vnlib_compress && cmake -B./build && cmake --build build/ --config Release && cp build/libvn_compress.so {{.OUT_DIR}}/libvn_compress.so
#create a fresh self-signed cert for the container during build
- openssl req -new -x509 -days 365 -keyout {{.SSL_DIR}}/key.pem -out {{.SSL_DIR}}/cert.pem -newkey {{.CERT_KEY_PARAMS}} --nodes
- echo "WARNING Self signed certificate created during build stage, DO NOT COPY THIS IMAGE"
#called from ci pipline to build the package
build:
cmds:
# clean up the run.sh script to remove windows line endings in my wsl default instance
- cmd: wsl dos2unix ./run.sh
platforms: [ windows/amd64 ]
#init build image
- task: setup-container-image
#remove the default config file as it's not needed in the container
- powershell -Command "rm -Force -Recurse build/app/config/"
- task: prune-sql-runtimes
postbuild_success:
cmds:
#tar up the build directory and move it to the output bin directory
- cmd: cd build/ && tar -czf ../../bin/{{.PACKAGE_FILE_NAME}} .
#clean up all the build files after build succeeds
- task: clean
clean:
ignore_error: true
cmds:
- cmd: powershell -Command "rm -Recurse -Force ./build"
setup-container-image:
internal: true
cmds:
#make build directory
- powershell -Command "mkdir build, build/app, build/app/config-templates/, build/app/static/ -Force"
#copy the existing linux-x64 build to the build folder, this will be the container base
- powershell -Command "cp -Recurse -Force ../build/linux-x86_64/* build/app/"
#copy local scripts and config data into the build folder
- powershell -Command "cp -Force run.sh, Taskfile.yaml build/app/"
- powershell -Command "cp -Force Dockerfile, docker-compose.yaml build/"
- powershell -Command "cp -Force static/* build/app/static/"
- powershell -Command "cp -Force config-templates/* build/app/config-templates/"
prune-sql-runtimes:
internal: true
vars:
SQLITE_RUNTIMES: 'build/app/plugins/assets/VNLib.Plugins.Extensions.Loading.Sql.SQLite/runtimes'
cmds:
#move the linux-musl-x64 directory out of assets before removing the rest of the runtimes and then move it back
- powershell -Command "mv {{.SQLITE_RUNTIMES}}/linux-musl-x64 build/linux-musl-x64"
- powershell -Command "rm -Recurse -Force {{.SQLITE_RUNTIMES}}" && powershell -Command "mkdir {{.SQLITE_RUNTIMES}}"
- powershell -Command "mv build/linux-musl-x64 {{.SQLITE_RUNTIMES}}/linux-musl-x64 "
|