2022-09-15 13:42:49 +02:00
|
|
|
variables:
|
2023-02-08 11:15:41 +01:00
|
|
|
- &vlang_image 'git.rustybever.be/chewing_bever/vlang:0.3.3-alpine3.17'
|
2022-09-15 13:42:49 +02:00
|
|
|
|
2022-01-15 15:28:58 +01:00
|
|
|
matrix:
|
|
|
|
PLATFORM:
|
2022-05-05 09:35:19 +02:00
|
|
|
- 'linux/amd64'
|
|
|
|
- 'linux/arm64'
|
2022-01-15 15:28:58 +01:00
|
|
|
|
2022-01-15 15:30:09 +01:00
|
|
|
platform: ${PLATFORM}
|
2022-01-13 15:29:43 +01:00
|
|
|
|
2022-01-13 13:40:33 +01:00
|
|
|
pipeline:
|
2022-06-15 17:47:12 +02:00
|
|
|
install-modules:
|
2022-09-15 13:42:49 +02:00
|
|
|
image: *vlang_image
|
2022-01-22 22:12:30 +01:00
|
|
|
pull: true
|
2022-01-13 13:40:33 +01:00
|
|
|
commands:
|
2022-06-15 17:47:12 +02:00
|
|
|
- export VMODULES=$PWD/.vmodules
|
|
|
|
- 'cd src && v install'
|
|
|
|
when:
|
2022-06-15 19:59:48 +02:00
|
|
|
event: [push, pull_request]
|
2022-06-15 17:47:12 +02:00
|
|
|
|
|
|
|
debug:
|
2022-09-15 13:42:49 +02:00
|
|
|
image: *vlang_image
|
2022-06-15 17:47:12 +02:00
|
|
|
commands:
|
|
|
|
- export VMODULES=$PWD/.vmodules
|
2022-04-15 11:38:06 +02:00
|
|
|
- make
|
2022-01-22 22:18:19 +01:00
|
|
|
when:
|
2022-05-05 23:30:54 +02:00
|
|
|
event: [pull_request]
|
2022-04-15 11:38:06 +02:00
|
|
|
branch:
|
2022-05-05 09:35:19 +02:00
|
|
|
exclude: [main]
|
2022-01-13 13:40:33 +01:00
|
|
|
|
|
|
|
prod:
|
2022-09-15 13:42:49 +02:00
|
|
|
image: *vlang_image
|
2022-01-14 18:32:00 +01:00
|
|
|
environment:
|
2022-05-01 22:47:00 +02:00
|
|
|
- LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -lsqlite3 -static
|
2022-01-13 13:40:33 +01:00
|
|
|
commands:
|
2022-06-15 17:47:12 +02:00
|
|
|
- export VMODULES=$PWD/.vmodules
|
2022-04-30 23:02:54 +02:00
|
|
|
# Apparently this -D is *very* important
|
|
|
|
- CFLAGS='-DGC_THREADS=1' make prod
|
2022-01-22 19:29:01 +01:00
|
|
|
# Make sure the binary is actually statically built
|
2022-01-14 20:43:11 +01:00
|
|
|
- readelf -d pvieter
|
2022-01-14 21:50:43 +01:00
|
|
|
- du -h pvieter
|
2022-01-14 20:43:11 +01:00
|
|
|
- '[ "$(readelf -d pvieter | grep NEEDED | wc -l)" = 0 ]'
|
2022-01-22 19:01:46 +01:00
|
|
|
# This removes so much, it's amazing
|
|
|
|
- strip -s pvieter
|
|
|
|
- du -h pvieter
|
2022-01-22 22:17:38 +01:00
|
|
|
when:
|
2022-05-05 09:35:19 +02:00
|
|
|
event: [push, pull_request]
|
2022-01-22 19:01:46 +01:00
|
|
|
|
|
|
|
upload:
|
2022-09-15 13:42:49 +02:00
|
|
|
image: *vlang_image
|
2022-01-22 19:01:46 +01:00
|
|
|
secrets: [ s3_username, s3_password ]
|
|
|
|
commands:
|
2022-01-22 19:22:19 +01:00
|
|
|
# https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f
|
|
|
|
- export URL=s3.rustybever.be
|
2022-01-22 19:30:46 +01:00
|
|
|
- export DATE="$(date -R --utc)"
|
2022-01-22 19:22:19 +01:00
|
|
|
- export CONTENT_TYPE='application/zstd'
|
2022-02-22 18:42:09 +01:00
|
|
|
|
|
|
|
- export OBJ_PATH="/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:g')"
|
2022-01-22 19:26:52 +01:00
|
|
|
- export SIG_STRING="PUT\n\n$CONTENT_TYPE\n$DATE\n$OBJ_PATH"
|
2023-01-18 18:10:47 +01:00
|
|
|
- export SIGNATURE="$(echo -en $SIG_STRING | openssl dgst -sha1 -hmac $S3_PASSWORD -binary | base64)"
|
2022-02-22 18:42:09 +01:00
|
|
|
- >
|
|
|
|
curl
|
|
|
|
--silent
|
2022-05-05 09:35:19 +02:00
|
|
|
--fail
|
2022-02-22 18:42:09 +01:00
|
|
|
-XPUT
|
|
|
|
-T pvieter
|
|
|
|
-H "Host: $URL"
|
|
|
|
-H "Date: $DATE"
|
|
|
|
-H "Content-Type: $CONTENT_TYPE"
|
|
|
|
-H "Authorization: AWS $S3_USERNAME:$SIGNATURE"
|
|
|
|
https://$URL$OBJ_PATH
|
2022-01-22 22:17:38 +01:00
|
|
|
when:
|
2022-05-05 09:35:19 +02:00
|
|
|
event: [push, pull_request]
|