.gitlab-ci.yml (3347B)
1 image: debian:unstable-slim 2 3 build: 4 artifacts: 5 paths: 6 - reform2-keyboard-fw/keyboard-2.hex 7 - reform2-keyboard-fw/keyboard-2-standalone.hex 8 - reform2-keyboard-fw/keyboard-2_US.hex 9 - reform2-keyboard-fw/keyboard-2_US-standalone.hex 10 - reform2-keyboard-fw/keyboard-3.hex 11 - reform2-keyboard-fw/keyboard-3-standalone.hex 12 - reform2-keyboard-fw/keyboard-3_US.hex 13 - reform2-keyboard-fw/keyboard-3_US-standalone.hex 14 - reform2-keyboard-fw/keyboard-3_NEO2.hex 15 - reform2-keyboard-fw/keyboard-3_NEO2-standalone.hex 16 - reform2-trackball-fw/Mouse.hex 17 - reform2-trackpad-fw/Mouse.hex 18 - reform2-trackball2-fw/build/reform2-trackball2-fw.uf2 19 - reform2-lpc-fw/firmware-20_R3.bin 20 - reform2-lpc-fw/firmware-25_R2.bin 21 script: | 22 set -x 23 apt update 24 apt-get --no-install-recommends -y install ca-certificates git build-essential avr-libc gcc-avr gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib libusb-1.0-0-dev cmake python3 25 # use the timestamp of the latest git commit to set reproducible S_D_E 26 if [ -z ${SOURCE_DATE_EPOCH:+x} ] && git -C . rev-parse 2>/dev/null; then 27 SOURCE_DATE_EPOCH=$(git log -1 --format=%ct) 28 fi 29 export SOURCE_DATE_EPOCH 30 # check if the current commit is tagged or otherwise use the git hash 31 if git describe >/dev/null 2>&1 && [ "$(git describe --abbrev=0)" = "$(git describe)" ]; then 32 VERSION="$(git describe --abbrev=0 | tr -d -)" 33 else 34 VERSION="g$(git rev-parse --short=7 HEAD)" 35 fi 36 for variant in 2 2_US 3 3_US; do 37 make -C reform2-keyboard-fw REFORM_KBD_OPTIONS="-DKBD_VARIANT_$variant -DKBD_FW_VERSION=\\\"$VERSION\\\"" 38 mv reform2-keyboard-fw/keyboard.hex reform2-keyboard-fw/keyboard-$variant.hex 39 make -C reform2-keyboard-fw clean 40 make -C reform2-keyboard-fw REFORM_KBD_OPTIONS="-DKBD_VARIANT_$variant -DKBD_MODE_STANDALONE -DKBD_FW_VERSION=\\\"$VERSION\\\"" 41 mv reform2-keyboard-fw/keyboard.hex reform2-keyboard-fw/keyboard-$variant-standalone.hex 42 make -C reform2-keyboard-fw clean 43 done 44 make -C reform2-trackball-fw 45 make -C reform2-trackpad-fw 46 cd reform2-trackball2-fw 47 ./build.sh 48 cd .. 49 make -C reform2-lpc-fw lpcrc 50 for rev in 20_R3 25_R2; do 51 make -C reform2-lpc-fw REFORM_LPC_OPTIONS="-DREFORM_MOTHERBOARD_REV=REFORM_MBREV_$rev -DFW_STRING3=\\\"$VERSION\\\"" 52 mv reform2-lpc-fw/bin/firmware.bin reform2-lpc-fw/firmware-$rev.bin 53 make -C reform2-lpc-fw clean 54 done 55 md5sum reform2-keyboard-fw/keyboard-*.hex reform2-lpc-fw/firmware-*.bin 56 # assure that the latest git tag is reflected in the code 57 if git describe >/dev/null 2>&1; then 58 grep --quiet "# define KBD_FW_VERSION \"$(git describe --always --tags --abbrev=0 | tr -d -)\"" reform2-keyboard-fw/constants.h 59 grep --quiet "# define FW_STRING3 \"$(git describe --always --tags --abbrev=0 | tr -d -)\"" reform2-lpc-fw/src/boards/reform2/board_reform2.c 60 fi 61 # assure that the latest git tag is reflected in top CHANGELOG.md 62 if git describe >/dev/null 2>&1; then 63 head -1 reform2-keyboard-fw/CHANGELOG.md | grep --quiet "^### $(git describe --always --tags --abbrev=0)" 64 head -1 reform2-lpc-fw/CHANGELOG.md | grep --quiet "^### $(git describe --always --tags --abbrev=0)" 65 fi