From 045466a3fe6e073df101965566475911e6cc141a Mon Sep 17 00:00:00 2001 From: "Alejandro R. Mosteo" Date: Sun, 21 Jan 2024 17:06:24 +0100 Subject: [PATCH] Use git commit id as build part in alr version --- .github/workflows/ci-toolchain.yml | 10 +++++----- .github/workflows/ci-windows.yml | 14 +++++++++----- scripts/ci-github.sh | 6 ++++++ src/alire/alire-version.ads | 2 +- 4 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci-toolchain.yml b/.github/workflows/ci-toolchain.yml index 0f4cecc6d..a44d72827 100644 --- a/.github/workflows/ci-toolchain.yml +++ b/.github/workflows/ci-toolchain.yml @@ -37,6 +37,11 @@ jobs: with: submodules: true + - name: Install Python 3.x # required by testsuite and scripts + uses: actions/setup-python@v2 + with: + python-version: '3.x' + # Use a stock alr to make the latest toolchain available - name: Install FSF toolchain @@ -72,11 +77,6 @@ jobs: # Run the testsuite with the just build alr. The testsuite picks the proper # alr in the ./bin/alr location. - - name: Install Python 3.x # required by testsuite - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Install e3 run: pip install --upgrade -r testsuite/requirements.txt diff --git a/.github/workflows/ci-windows.yml b/.github/workflows/ci-windows.yml index e6adc0598..492f2ae36 100644 --- a/.github/workflows/ci-windows.yml +++ b/.github/workflows/ci-windows.yml @@ -27,11 +27,20 @@ jobs: with: submodules: true + + - name: Install Python 3.x (required for the testsuite) + uses: actions/setup-python@v2 + with: + python-version: '3.x' + - name: Install FSF toolchain uses: alire-project/alr-install@v1 with: crates: gnat_native gprbuild + - name: Fingerprint build + run: python3 scripts/version-patcher.py + - name: Build alr run: gprbuild -j0 -p -P alr_env @@ -41,11 +50,6 @@ jobs: - name: install tar from msys2 (Git tar in Actions VM does not seem to work) run: C:\Users\runneradmin\AppData\Local\alire\msys64\usr\bin\pacman --noconfirm -S tar - - name: Install Python 3.x (required for the testsuite) - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - name: Run test script run: scripts/ci-github.sh shell: bash diff --git a/scripts/ci-github.sh b/scripts/ci-github.sh index 1318c169d..60f72aaf4 100755 --- a/scripts/ci-github.sh +++ b/scripts/ci-github.sh @@ -1,5 +1,7 @@ #!/usr/bin/env bash +# To be run from the repository root + trap 'echo "ERROR at line ${LINENO} (code: $?)" >&2' ERR trap 'echo "Interrupted" >&2 ; exit 1' INT @@ -13,6 +15,10 @@ pushd $( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) . ../dev/functions.sh popd +# Fingerprint the build. The commit ID will appear as the version build part. +echo "Building from commit: $(git rev-parse HEAD)" +python3 scripts/version-patcher.py + # Build alr export ALIRE_OS=$(get_OS) gprbuild -j0 -p -P alr_env diff --git a/src/alire/alire-version.ads b/src/alire/alire-version.ads index 3da1158a9..180e6fccf 100644 --- a/src/alire/alire-version.ads +++ b/src/alire/alire-version.ads @@ -6,7 +6,7 @@ package Alire.Version with Preelaborate is -- be replaced by `alr build` with the current commit, and appended with -- "_or_later" after build. - Current : constant String := "2.0-beta2+92896bd3_or_later"; + Current : constant String := "2.0-beta2+277e6a52_dirty"; -- 2.0.0-b1: first public release on the 2.0 branch -- 1.2.1: build switches fix and other minor assorted fixes -- 1.2.0: rpm speed-up, silence propagation warning, early switch parse