Re: [PATCH 2/5] ci/lib: allow running in GitHub Actions
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Apr 4, 2020, 20:08 UTC
- Message-ID
- <nycvar.QRO.7.76.6.2004042207410.46@tvgsbejvaqbjf.bet>
- In-Reply-To
- <20200403084654.GK2224@szeder.dev>
Hi Gábor,
On Fri, 3 Apr 2020, SZEDER Gábor wrote:
Show 42 quoted lines
> On Tue, Mar 31, 2020 at 12:48:30PM +0000, Johannes Schindelin via GitGitGadget wrote:
> > From: Johannes Schindelin <johannes.schindelin@gmx.de>
> >
> > For each CI system we support, we need a specific arm in that if/else
> > construct in ci/lib.sh. Let's add one for GitHub Actions.
> >
> > Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> > ---
> > ci/lib.sh | 20 +++++++++++++++++++-
> > 1 file changed, 19 insertions(+), 1 deletion(-)
> >
> > diff --git a/ci/lib.sh b/ci/lib.sh
> > index 8d73551a12f..52e350496a3 100755
> > --- a/ci/lib.sh
> > +++ b/ci/lib.sh
> > @@ -34,7 +34,7 @@ save_good_tree () {
> > # successfully before (e.g. because the branch got rebased, changing only
> > # the commit messages).
> > skip_good_tree () {
> > - if test "$TRAVIS_DEBUG_MODE" = true
> > + if test "$TRAVIS_DEBUG_MODE" = true || test true = "$GITHUB_ACTIONS"
> > then
> > return
> > fi
> > @@ -136,6 +136,24 @@ then
> > MAKEFLAGS="$MAKEFLAGS --jobs=10"
> > test windows_nt != "$CI_OS_NAME" ||
> > GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
> > +elif test true = "$GITHUB_ACTIONS"
> > +then
> > + CI_TYPE=github-actions
> > + CI_BRANCH="$GITHUB_REF"
> > + CI_COMMIT="$GITHUB_SHA"
> > + CI_OS_NAME="$(echo "$RUNNER_OS" | tr A-Z a-z)"
> > + test macos != "$CI_OS_NAME" || CI_OS_NAME=osx
>
> Hmm, if "macos" isn't not equal to $CI_OS_NAME, then set
> CI_OS_NAME=osx. This is head-scratchingly backwards, and I think
>
> test "$CI_OS_NAME" = macos && CI_OS_NAME=osx
>
> would read better.I can understand where you come from, but your code is not `set -e` safe, which is the reason why I wrote the code this way (compare to the already existing code in the previous clause, which was copy-edited here).
Ciao, Dscho
Show 22 quoted lines
>
> > + CI_REPO_SLUG="$GITHUB_REPOSITORY"
> > + CI_JOB_ID="$GITHUB_RUN_ID"
> > + CC="${CC:-gcc}"
> > +
> > + cache_dir="$HOME/none"
> > +
> > + export GIT_PROVE_OPTS="--timer --jobs 10"
> > + export GIT_TEST_OPTS="--verbose-log -x"
> > + MAKEFLAGS="$MAKEFLAGS --jobs=10"
> > + test windows != "$CI_OS_NAME" ||
> > + GIT_TEST_OPTS="--no-chain-lint --no-bin-wrappers $GIT_TEST_OPTS"
>
> Likewise.
>
> > else
> > echo "Could not identify CI type" >&2
> > env >&2
> > --
> > gitgitgadget
> >
>