hledger/.github/workflows/push.yml

215 lines
7.4 KiB
YAML
Raw Normal View History

# Runs on (after) notable pushes to master.
# Failure does not block the push.
# Builds incrementally and runs functional tests on linux,
# using the latest supported GHC version.
name: push CI
on:
push:
branches: [ master ]
paths:
2020-03-08 01:35:58 +03:00
- '.github/workflows/push.yml'
2020-03-12 18:15:32 +03:00
- 'stack*.yaml'
- 'hledger-lib/**'
- 'hledger/**'
- 'hledger-ui/**'
- 'hledger-web/**'
- 'bin/*.hs'
- 'examples/**'
2021-07-28 12:07:30 +03:00
# ignore certain boring paths completely (even if the commit message didn't begin with ;).
# XXX it would still be nice to check the commit messages.
#
# ignore changes to (most?) example files, though some func tests depend on them
- '!**.journal'
- '!**.j'
- '!**.ledger'
- '!**.csv'
# ignore changes to doc source files
- '!**.m4'
- '!**.md'
- '!**.1'
- '!**.5'
- '!**.info'
- '!**.txt'
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
plan:
2020-07-11 19:17:43 +03:00
# - { ghc: "86" , stack: "stack --stack-yaml=stack8.6.yaml" }
# - { ghc: "88" , stack: "stack --stack-yaml=stack8.8.yaml" }
- { ghc: "810" , stack: "stack --stack-yaml=stack8.10.yaml" }
# - { ghc: "90" , stack: "stack --stack-yaml=stack.yaml" }
steps:
- name: Check out
uses: actions/checkout@v2
# have to fetch everything for git describe for --version
2021-06-04 11:49:39 +03:00
with:
fetch-depth: 0
2021-06-04 11:51:17 +03:00
# - name: Print debug output
# env:
# GITHUB_CONTEXT: ${{ toJson(github) }}
# run: |
# echo
# echo "$GITHUB_SHA"
# echo "$GITHUB_REF"
# echo "$GITHUB_HEAD_REF"
# echo "$GITHUB_BASE_REF"
# git log "$GITHUB_BASE_REF"..
# tools/commitlint "$GITHUB_BASE_REF"..
# keep synced in all workflows which do this
- name: Check commit messages
# For a PR, the range will be: master..origin/$GITHUB_HEAD_REF
# For a push it will be: $BEFORE..
# For a force push, BEFORE is the previous HEAD, and on github (though not locally) this is an "invalid revision range".
# In this and any case where the range is invalid, we'll just skip the check, to avoid false positives
# related: https://stackoverflow.com/questions/64708371/how-to-run-github-workflow-on-every-commit-of-a-push
env:
BEFORE: ${{ github.event.before }}
NUM: 5
shell: bash
run: |
RANGE=${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
git rev-list --quiet $RANGE \
&& tools/commitlint $RANGE \
|| ( echo "could not identify commits, not checking them" )
# || ( echo "could not identify commits, checking last $NUM instead:"; tools/commitlint -$NUM )
2021-07-21 11:57:55 +03:00
- name: Skip remaining CI steps if latest commit message begins with ;
shell: bash
run: |
echo "git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} >> $$.gitlog"
2021-08-19 10:47:01 +03:00
(git log -1 --pretty='%s' ${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF} >> $$.gitlog \
&& (grep -qE '^ *;' $$.gitlog || echo "CONTINUE=true" >> $GITHUB_ENV)) \
2021-08-19 21:55:44 +03:00
|| ( echo "could not identify commit range, continuing CI steps"; echo "CONTINUE=true" >> $GITHUB_ENV )
2020-06-06 23:49:58 +03:00
# things to be cached/restored:
- name: Cache stack global package db
id: stack-global
uses: actions/cache@v2
with:
path: ~/.stack
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
uses: actions/cache@v2
with:
path: ~/.local/bin
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
with:
path: .stack-work
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
with:
path: hledger-lib/.stack-work
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
with:
path: hledger/.stack-work
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
with:
path: hledger-ui/.stack-work
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
with:
path: hledger-web/.stack-work
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
2020-06-06 23:49:58 +03:00
# actions:
- name: Install stack
run: |
2020-10-19 08:23:37 +03:00
mkdir -p ~/.local/bin
export PATH=~/.local/bin:$PATH
# 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:
2020-07-11 19:17:43 +03:00
stack: ${{ matrix.plan.stack }}
run: |
$stack setup --install-ghc
if: env.CONTINUE
- name: Install haskell deps
env:
2020-07-11 19:17:43 +03:00
stack: ${{ matrix.plan.stack }}
run: |
$stack build --only-dependencies
if: env.CONTINUE
- name: Build hledger fast
env:
2020-07-11 19:17:43 +03:00
stack: ${{ matrix.plan.stack }}
run: |
$stack build --fast --ghc-options=-Werror --force-dirty
2020-07-11 19:17:43 +03:00
# --ghc-options=-fforce-recomp # needed occasionally to clear out stale compiled modules
# --pedantic
if: env.CONTINUE
- name: Install shelltestrunner
2020-07-11 19:17:43 +03:00
env:
stack: ${{ matrix.plan.stack }}
run: |
export PATH=~/.local/bin:$PATH
2020-07-11 19:17:43 +03:00
if [[ ! -x ~/.local/bin/shelltest ]]; then $stack install shelltestrunner-1.9; fi
shelltest --version
if: env.CONTINUE
- name: Test functional tests (excluding addons)
2020-07-11 19:17:43 +03:00
env:
stack: ${{ matrix.plan.stack }}
run: |
export PATH=~/.local/bin:$PATH
COLUMNS=80 $stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons # bin
# XXX func tests in bin are run only with GHC 8.2 for now
if: env.CONTINUE