From 88c6d47e3246c2e0ea680f8d5b3d662fce900430 Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Tue, 20 Jul 2021 23:01:57 -1000 Subject: [PATCH] ci: linux/mac/windows: skip steps if message begins with ; --- .github/workflows/linux.yml | 21 +++++++++++++++++++++ .github/workflows/mac.yml | 20 ++++++++++++++++++++ .github/workflows/windows.yml | 18 ++++++++++++++++++ 3 files changed, 59 insertions(+) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 8f755068d..0d968f791 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -116,6 +116,11 @@ jobs: && bin/commitlint $RANGE \ || ( echo "could not identify commits, checking last $NUM instead:"; bin/commitlint -$NUM ) + - name: Skip remaining CI steps if latest commit message begins with ; + run: | + git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} \ + | grep -qE '^ *;' || echo “::set-env name=CONTINUE::true” + # things to be cached/restored: - name: Cache stack global package db @@ -126,6 +131,7 @@ jobs: key: ${{ runner.os }}-stack-global-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-global-${{ matrix.plan.ghc }} + if: env.CONTINUE - name: Cache stack-installed programs in ~/.local/bin id: stack-programs @@ -135,6 +141,7 @@ jobs: key: ${{ runner.os }}-stack-programs-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-programs-${{ matrix.plan.ghc }} + if: env.CONTINUE - name: Cache .stack-work uses: actions/cache@v2 @@ -143,6 +150,7 @@ jobs: key: ${{ runner.os }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-work-${{ matrix.plan.ghc }} + if: env.CONTINUE - name: Cache hledger-lib/.stack-work uses: actions/cache@v2 @@ -151,6 +159,7 @@ jobs: key: ${{ runner.os }}-hledger-lib-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('hledger-lib/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-lib-stack-work-${{ matrix.plan.ghc }} + if: env.CONTINUE - name: Cache hledger/.stack-work uses: actions/cache@v2 @@ -159,6 +168,7 @@ jobs: key: ${{ runner.os }}-hledger-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('hledger/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-stack-work-${{ matrix.plan.ghc }} + if: env.CONTINUE - name: Cache hledger-ui/.stack-work uses: actions/cache@v2 @@ -167,6 +177,7 @@ jobs: key: ${{ runner.os }}-hledger-ui-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('hledger-ui/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-ui-stack-work-${{ matrix.plan.ghc }} + if: env.CONTINUE - name: Cache hledger-web/.stack-work uses: actions/cache@v2 @@ -175,6 +186,7 @@ jobs: key: ${{ runner.os }}-hledger-web-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('hledger-web/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-web-stack-work-${{ matrix.plan.ghc }} + if: env.CONTINUE # no longer needed I think # For now due to @@ -208,6 +220,7 @@ jobs: # curl -sL https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack if [[ ! -x ~/.local/bin/stack ]]; then curl -sL https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi stack --version + if: env.CONTINUE - name: Install GHC env: @@ -216,6 +229,7 @@ jobs: df -h $stack setup --install-ghc df -h + if: env.CONTINUE - name: Install haskell deps env: @@ -223,6 +237,7 @@ jobs: run: | $stack build --test --bench --only-dependencies # --no-terminal + if: env.CONTINUE - name: Build all hledger modules warning free, optimised and minimised, run unit/doc/bench tests env: @@ -232,6 +247,7 @@ jobs: # build quicker when tweaking ci: $stack install --ghc-options=-Werror --ghc-options=-split-sections --no-terminal # -split-sections shrinks binaries by 30% on average here # --pedantic --no-run-benchmarks + if: env.CONTINUE - name: Install shelltestrunner env: @@ -240,6 +256,7 @@ jobs: export PATH=~/.local/bin:$PATH if [[ ! -x ~/.local/bin/shelltest ]]; then $stack install shelltestrunner-1.9; fi shelltest --version + if: env.CONTINUE - name: Test functional tests (excluding addons) env: @@ -248,6 +265,7 @@ jobs: export PATH=~/.local/bin:$PATH COLUMNS=80 $stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons # XXX run the bin/ func tests corresponding to the GHC version enabled above, only + if: env.CONTINUE - name: Test haddock generation env: @@ -256,6 +274,7 @@ jobs: time $stack build --haddock --no-haddock-deps --no-haddock-hyperlink-source --haddock-arguments="--no-print-missing-docs" # --no-haddock-hyperlink-source is 25% faster # --no-print-missing-docs is 600% quieter + if: env.CONTINUE # artifacts: # XXX unreliable, and we don't need this for every PR; disable for now @@ -273,6 +292,7 @@ jobs: # example of setting a context variable, and an attempt to make a nice artifact version suffix. # But a constant name is easier in some ways. # echo "::set-output name=version::$(git branch --show-current | sed 's/-.*//')-$(git rev-parse --short HEAD)" + if: env.CONTINUE # XXX intermittent upload failures - name: Upload executables artifact @@ -281,6 +301,7 @@ jobs: # name: hledger-ubuntu-${{ steps.exes.outputs.version }} name: hledger-ubuntu path: tmp/hledger + if: env.CONTINUE diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index e86009429..b0b7d61c5 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -73,6 +73,11 @@ jobs: && bin/commitlint $RANGE \ || ( echo "could not identify commits, checking last $NUM instead:"; bin/commitlint -$NUM ) + - name: Skip remaining CI steps if latest commit message begins with ; + run: | + git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} \ + | grep -qE '^ *;' || echo “::set-env name=CONTINUE::true” + # things to be cached/restored: - name: Cache stack global package db @@ -83,6 +88,7 @@ jobs: key: ${{ runner.os }}-stack-global-after20210110-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-global-after202110110 + if: env.CONTINUE - name: Cache stack-installed programs in ~/.local/bin id: stack-programs @@ -92,6 +98,7 @@ jobs: key: ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-programs + if: env.CONTINUE - name: Cache .stack-work uses: actions/cache@v2 @@ -100,6 +107,7 @@ jobs: key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-work + if: env.CONTINUE - name: Cache hledger-lib/.stack-work uses: actions/cache@v2 @@ -108,6 +116,7 @@ jobs: key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-lib-stack-work + if: env.CONTINUE - name: Cache hledger/.stack-work uses: actions/cache@v2 @@ -116,6 +125,7 @@ jobs: key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-stack-work + if: env.CONTINUE - name: Cache hledger-ui/.stack-work uses: actions/cache@v2 @@ -124,6 +134,7 @@ jobs: key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-ui-stack-work + if: env.CONTINUE - name: Cache hledger-web/.stack-work uses: actions/cache@v2 @@ -132,6 +143,7 @@ jobs: key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-web-stack-work + if: env.CONTINUE # actions: @@ -145,18 +157,21 @@ jobs: # brew install gnu-tar; curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack if [[ ! -x ~/.local/bin/stack ]]; then brew install gnu-tar; curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi stack --version + if: env.CONTINUE - name: Install GHC env: stack: ${{ matrix.plan.stack }} run: | $stack setup --install-ghc + if: env.CONTINUE - name: Install haskell deps env: stack: ${{ matrix.plan.stack }} run: | $stack build --test --only-dependencies + if: env.CONTINUE - name: Build hledger and test unit tests, doc tests env: @@ -165,6 +180,7 @@ jobs: $stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror # --ghc-options=-split-sections doesn't work on mac # --pedantic + if: env.CONTINUE - name: Install shelltestrunner env: @@ -173,6 +189,7 @@ jobs: export PATH=~/.local/bin:$PATH if [[ ! -x ~/.local/bin/shelltest ]]; then $stack install shelltestrunner-1.9; fi shelltest --version + if: env.CONTINUE - name: Test functional tests (excluding addons) env: @@ -180,6 +197,7 @@ jobs: run: | export PATH=~/.local/bin:$PATH COLUMNS=80 $stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons # bin + if: env.CONTINUE # artifacts: @@ -192,6 +210,7 @@ jobs: cp ~/.local/bin/hledger . cp ~/.local/bin/hledger-ui . cp ~/.local/bin/hledger-web . + if: env.CONTINUE # XXX intermittent upload failures - name: Upload executables artifact @@ -199,3 +218,4 @@ jobs: with: name: hledger-macos path: tmp/hledger + if: env.CONTINUE diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index c7d387b33..2c13ce3db 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -63,6 +63,11 @@ jobs: && bin/commitlint $RANGE \ || ( echo "could not identify commits, checking last $NUM instead:"; bin/commitlint -$NUM ) + - name: Skip remaining CI steps if latest commit message begins with ; + run: | + git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} \ + | grep -qE '^ *;' || echo “::set-env name=CONTINUE::true” + # things to be cached/restored: - name: Cache stack global package db @@ -73,6 +78,7 @@ jobs: key: ${{ runner.os }}-appdata-roaming-stack-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-appdata-roaming-stack + if: env.CONTINUE - name: Cache stack programs dir # ghc, ghc-included packages and their haddocks, mingw, msys2 id: stack-programs-dir @@ -84,6 +90,7 @@ jobs: key: ${{ runner.os }}-appdata-local-programs-stack-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-appdata-local-programs-stack + if: env.CONTINUE - name: Cache .stack-work uses: actions/cache@v2 @@ -92,6 +99,7 @@ jobs: key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} restore-keys: | ${{ runner.os }}-stack-work + if: env.CONTINUE - name: Cache hledger-lib/.stack-work uses: actions/cache@v2 @@ -100,6 +108,7 @@ jobs: key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-lib-stack-work + if: env.CONTINUE - name: Cache hledger/.stack-work uses: actions/cache@v2 @@ -108,6 +117,7 @@ jobs: key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-stack-work + if: env.CONTINUE - name: Cache hledger-ui/.stack-work uses: actions/cache@v2 @@ -116,6 +126,7 @@ jobs: key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-ui-stack-work + if: env.CONTINUE - name: Cache hledger-web/.stack-work uses: actions/cache@v2 @@ -124,6 +135,7 @@ jobs: key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }} restore-keys: | ${{ runner.os }}-hledger-web-stack-work + if: env.CONTINUE # - name: showStuff # shell: bash @@ -156,12 +168,14 @@ jobs: stack --version which ./stack ./stack --version + if: env.CONTINUE - name: Install GHC # if: steps.stack-programs-dir.outputs.cache-hit != 'true' # set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH% run: | ./stack --no-terminal setup --install-ghc + if: env.CONTINUE # - name: Install shelltestrunner ## - export PATH=~/.local/bin:$PATH @@ -171,6 +185,7 @@ jobs: - name: Install haskell deps run: | ./stack --no-terminal build --only-dependencies + if: env.CONTINUE # use whichever GHC is in default stack.yaml @@ -179,6 +194,7 @@ jobs: ./stack --no-terminal install --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror # --ghc-options=-split-sections doesn't work on windows, "too many sections" # --pedantic + if: env.CONTINUE # run hledger-lib/hledger functional tests, skipping the ones for addons ## - export PATH=~/.local/bin:$PATH @@ -194,6 +210,7 @@ jobs: cd hledger copy C:\Users\runneradmin\AppData\Roaming\local\bin\hledger.exe . copy C:\Users\runneradmin\AppData\Roaming\local\bin\hledger-web.exe . + if: env.CONTINUE # XXX intermittent upload failures - name: Create executables artifact @@ -201,4 +218,5 @@ jobs: with: name: hledger-windows path: tmp/hledger + if: env.CONTINUE