From e3c7155fc12a7539ea759b4f28d0f03fdc99b97b Mon Sep 17 00:00:00 2001 From: Brice Goglin Date: Wed, 29 Nov 2023 11:36:17 +0100 Subject: [PATCH] reuse ci.inria.fr job-0-tarball.sh Signed-off-by: Brice Goglin --- .github/workflows/buildcheck.yaml | 21 ++------- .github/workflows/job-0-tarball.sh | 71 ++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 17 deletions(-) create mode 100755 .github/workflows/job-0-tarball.sh diff --git a/.github/workflows/buildcheck.yaml b/.github/workflows/buildcheck.yaml index 10cb863b9..ee5456a15 100644 --- a/.github/workflows/buildcheck.yaml +++ b/.github/workflows/buildcheck.yaml @@ -12,19 +12,8 @@ jobs: sudo apt-get update sudo apt-get install -y --no-install-recommends libltdl-dev libcairo2-dev libx11-dev libxml2-dev libxml2-utils libncurses5-dev libxnvctrl-dev libpciaccess-dev libudev-dev pkg-config ocl-icd-opencl-dev autoconf automake libtool doxygen-latex transfig w3m - uses: actions/checkout@v4 - - name: Autogen - run: ./autogen.sh - - name: Configure - run: ./configure --prefix=${PWD}/install - - name: Build - run: make -j - - name: Distcheck - run: make distcheck - - name: Check versions - run: | - contrib/windows/check-versions.sh - contrib/windows-cmake/check-versions.sh - contrib/android/check-versions.sh + - name: Build and distcheck + run: $GITHUB_WORKSPACE/.github/workflows/job-0-tarball.sh - name: Archive tarballs uses: actions/upload-artifact@v3 with: @@ -49,8 +38,7 @@ jobs: with: name: Tarball - name: Extract, build and check - run: | - $GITHUB_WORKSPACE/.github/workflows/job-1-check.sh hwloc-*.tar.gz + run: $GITHUB_WORKSPACE/.github/workflows/job-1-check.sh hwloc-*.tar.gz check-tarball-gh-ubuntu-latest: name: Check tarball on GH ubuntu-latest needs: build-tarball @@ -69,8 +57,7 @@ jobs: with: name: Tarball - name: Extract, build and check - run: | - $GITHUB_WORKSPACE/.github/workflows/job-1-check.sh hwloc-*.tar.gz + run: $GITHUB_WORKSPACE/.github/workflows/job-1-check.sh hwloc-*.tar.gz check-tarball-gh-macos-latest: name: Check tarball on GH macos-latest needs: build-tarball diff --git a/.github/workflows/job-0-tarball.sh b/.github/workflows/job-0-tarball.sh new file mode 100755 index 000000000..25e649941 --- /dev/null +++ b/.github/workflows/job-0-tarball.sh @@ -0,0 +1,71 @@ +#!/bin/sh +# +# Copyright © 2012-2023 Inria. All rights reserved. +# See COPYING in top-level directory. +# + +echo "############################" +echo "Running on:" +uname -a +echo "############################" + +set -e +set -x + +# environment variables +test -f $HOME/.ciprofile && . $HOME/.ciprofile + +branch=$(git branch --show-current) + +echo "Got GIT branch name $branch" + +# convert "refs/remotes/pull/XYZ/merge" into "PR-XYZ" +branch=$(echo $branch | sed -r -e 's@refs/remotes/pull/([0-9]+)/mergepr/@PR-\1@') + +# keep branch-name before the first '-' (e.g. v2.0-beta becomes v2.0) +# and look for the corresponding autotools. +# "PR-XYZ" will get "PR" which means they'll use master autotools (likely OK) +basebranch=$( echo $branch | sed -r -e 's@^.*/([^/]+)$@\1@' -e 's/-.*//' ) +if test -d $HOME/local/hwloc-$basebranch ; then + export PATH=$HOME/local/hwloc-${basebranch}/bin:$PATH + echo using specific $HOME/local/hwloc-$basebranch +else + export PATH=$HOME/local/hwloc-master/bin:$PATH + echo using generic $HOME/local/hwloc-master +fi + +# display autotools versions +automake --version | head -1 +libtool --version | head -1 +autoconf --version | head -1 + +# better version string +snapshot=$branch-`date --utc +%Y%m%d.%H%M`.git`git show --format=format:%h -s` +sed -e 's/^snapshot_version=.*/snapshot_version='$snapshot/ \ + -e 's/^snapshot=.*/snapshot=1/' \ + -i VERSION + +# let's go +./autogen.sh +./configure +make + +if test x$NO_CHECK = xtrue; then + distcheck=dist +else + distcheck=distcheck +fi +if ! make $distcheck; then + # make distcheck temporarily sets the source directory as R/O. + # a failure during that R/O step may cause git clean -fdx to fail during the next build + chmod u+w -R . + false +fi + +# Only check versions once in the main job. +# Some of these tests require bash and grep -P anyway. +contrib/windows/check-versions.sh +contrib/windows-cmake/check-versions.sh +contrib/android/check-versions.sh + +exit 0