From cc3f7b8d48c0b0b68f6b15a9b7da300a3fed2f84 Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Wed, 28 Aug 2019 20:36:29 +0200 Subject: [PATCH] ci: include version+githash into artefact filenames --- ci/build.yml | 19 ++++++++++++++----- legacy/bootloader/bootloader.h | 4 +--- legacy/bootloader/version.h | 3 +++ tools/version.sh | 7 +++++++ 4 files changed, 25 insertions(+), 8 deletions(-) create mode 100644 legacy/bootloader/version.h create mode 100755 tools/version.sh diff --git a/ci/build.yml b/ci/build.yml index c89127c59..119446fde 100644 --- a/ci/build.yml +++ b/ci/build.yml @@ -17,11 +17,13 @@ build core firmware: - pipenv run make build_prodtest - pipenv run make build_firmware - pipenv run make sizecheck + - cd .. + - export VERSION=$(./tools/version.sh core/embed/firmware/version.h) + - cp core/build/firmware/firmware.bin trezor-$VERSION-$CI_COMMIT_SHORT_SHA.bin artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" paths: - - core/build/firmware/firmware.bin - - core/build/bootloader/bootloader.bin + - trezor-*.*.*-$CI_COMMIT_SHORT_SHA.bin expire_in: 1 week build core firmware bitcoinonly: @@ -34,10 +36,12 @@ build core firmware bitcoinonly: - mv build/firmware/firmware.bin build/firmware/firmware-bitcoinonly.bin - cd .. - pipenv run ./tools/check-bitcoin-only core/build/firmware/firmware-bitcoinonly.bin + - export VERSION=$(./tools/version.sh core/embed/firmware/version.h) + - cp core/build/firmware/firmware-bitcoinonly.bin trezor-$VERSION-$CI_COMMIT_SHORT_SHA-bitcoinonly.bin artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" paths: - - core/build/firmware/firmware-bitcoinonly.bin + - trezor-*.*.*-$CI_COMMIT_SHORT_SHA-bitcoinonly.bin expire_in: 1 week build core unix: @@ -115,10 +119,13 @@ build legacy firmware: - pipenv run script/cibuild - pipenv run make -C bootloader - pipenv run make -C demo + - cd .. + - export VERSION=$(./tools/version.sh legacy/firmware/version.h) + - cp legacy/firmware/trezor.bin trezor-$VERSION-$CI_COMMIT_SHORT_SHA.bin artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" paths: - - legacy/firmware/trezor.bin + - trezor-*.*.*-$CI_COMMIT_SHORT_SHA.bin expire_in: 1 week build legacy firmware debug: @@ -141,10 +148,12 @@ build legacy firmware bitcoinonly: - mv firmware/trezor.bin firmware/trezor-bitcoinonly.bin - cd .. - pipenv run ./tools/check-bitcoin-only legacy/firmware/trezor-bitcoinonly.bin + - export VERSION=$(./tools/version.sh legacy/firmware/version.h) + - cp legacy/firmware/trezor-bitcoinonly.bin trezor-$VERSION-$CI_COMMIT_SHORT_SHA-bitcoinonly.bin artifacts: name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" paths: - - legacy/firmware/trezor-bitcoinonly.bin + - trezor-*.*.*-$CI_COMMIT_SHORT_SHA-bitcoinonly.bin expire_in: 1 week build legacy emu: diff --git a/legacy/bootloader/bootloader.h b/legacy/bootloader/bootloader.h index 60539a0dc..383235737 100644 --- a/legacy/bootloader/bootloader.h +++ b/legacy/bootloader/bootloader.h @@ -20,9 +20,7 @@ #ifndef __BOOTLOADER_H__ #define __BOOTLOADER_H__ -#define VERSION_MAJOR 1 -#define VERSION_MINOR 8 -#define VERSION_PATCH 1 +#include "version.h" #define STR(X) #X #define VERSTR(X) STR(X) diff --git a/legacy/bootloader/version.h b/legacy/bootloader/version.h new file mode 100644 index 000000000..ffec9eed4 --- /dev/null +++ b/legacy/bootloader/version.h @@ -0,0 +1,3 @@ +#define VERSION_MAJOR 1 +#define VERSION_MINOR 8 +#define VERSION_PATCH 1 diff --git a/tools/version.sh b/tools/version.sh new file mode 100755 index 000000000..925c2f62f --- /dev/null +++ b/tools/version.sh @@ -0,0 +1,7 @@ +#!/bin/sh +if [ -z "$1" ]; then + echo "Usage: version.sh path/to/version.h" + exit 1 +fi + +echo "VERSION_MAJOR.VERSION_MINOR.VERSION_PATCH" | cpp -include $1 -nostdinc -P | tr -d " "