vieter/.woodpecker/.build.yml

63 lines
1.7 KiB
YAML
Raw Normal View History

matrix:
PLATFORM:
- linux/amd64
2022-01-22 22:12:30 +01:00
- linux/arm64
- linux/arm/v7
2022-01-13 15:29:43 +01:00
# These checks already get performed on the feature branches
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-01-15 15:49:19 +01:00
# The default build isn't needed, as alpine switches to gcc for the compiler anyways
2022-01-13 13:40:33 +01:00
debug:
image: 'chewingbever/vlang:latest'
2022-01-22 22:12:30 +01:00
pull: true
2022-01-13 13:40:33 +01:00
group: 'build'
commands:
- make debug
2022-01-22 22:18:19 +01:00
when:
event: push
2022-01-13 13:40:33 +01:00
prod:
image: 'chewingbever/vlang:latest'
2022-01-22 22:12:30 +01:00
pull: true
2022-01-14 18:32:00 +01:00
environment:
2022-01-14 18:36:36 +01:00
- LDFLAGS=-lz -lbz2 -llzma -lexpat -lzstd -llz4 -static
2022-01-13 13:40:33 +01:00
group: 'build'
commands:
- 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:
event: push
2022-01-22 19:01:46 +01:00
upload:
2022-01-23 10:58:49 +01:00
image: 'chewingbever/vlang:latest'
2022-01-22 19:01:46 +01:00
secrets: [ s3_username, s3_password ]
commands:
# https://gist.github.com/JustinTimperio/7c7115f87b775618637d67ac911e595f
- export URL=s3.rustybever.be
2022-01-22 19:36:42 +01:00
- export OBJ_PATH="/vieter/commits/$CI_COMMIT_SHA/vieter-$(echo '${PLATFORM}' | sed 's:/:-:g')"
2022-01-22 19:30:46 +01:00
- export DATE="$(date -R --utc)"
- export CONTENT_TYPE='application/zstd'
2022-01-22 19:26:52 +01:00
- export SIG_STRING="PUT\n\n$CONTENT_TYPE\n$DATE\n$OBJ_PATH"
- export SIGNATURE=`echo -en $SIG_STRING | openssl sha1 -hmac $S3_PASSWORD -binary | base64`
- >
2022-01-22 19:26:52 +01:00
curl
--silent
-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:
event: push