hledger/.github/workflows/push.yml
2020-06-09 10:28:43 -07:00

141 lines
4.4 KiB
YAML

# Light CI tests: build and run functional tests with one GHC version,
# using less compute power and emitting less carbon.
#
# Runs: on notable (eg, not just doc files) push to master.
# Currently disabled in favour of linux.yml.
name: push CI
on:
push:
# branches: [ master ]
# disable this workflow:
branches-ignore:
- '**'
paths:
- '.github/workflows/push.yml'
- 'stack*.yaml'
- 'hledger-lib/**'
- 'hledger/**'
- 'hledger-ui/**'
- 'hledger-web/**'
- 'tests/**'
- '!**.md'
- '!**.1'
- '!**.5'
- '!**.info'
- '!**.txt'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out
uses: actions/checkout@v2
# deep clone so we can restore timestamps (see below)
with:
fetch-depth: 0
# Restore timestamps to help stack not rebuild unchanged files.
# https://stackoverflow.com/questions/60906336
# https://stackoverflow.com/a/36243002/84401
# https://www.reddit.com/r/haskell/comments/g00ldn/haskell_stack_on_github_actions/
- name: Restore source file timestamps
run: |
git ls-tree -r --name-only HEAD | while read filename; do
TS="$(git log -1 --format="%ct" -- ${filename})"
touch "${filename}" -mt "$(date --date="@$TS" "+%Y%m%d%H%M.%S")"
done
# 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-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global
${{ runner.os }}-stack
- name: Cache stack-installed programs in ~/.local/bin
id: stack-programs
uses: actions/cache@v2
with:
path: ~/.local/bin
key: ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-programs
${{ runner.os }}-local-bin
- name: Cache .stack-work
uses: actions/cache@v2
with:
path: .stack-work
key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }}
restore-keys: ${{ runner.os }}-stack-work
- name: Cache hledger-lib/.stack-work
uses: actions/cache@v2
with:
path: hledger-lib/.stack-work
key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }}
restore-keys: ${{ runner.os }}-hledger-lib-stack-work
- name: Cache hledger/.stack-work
uses: actions/cache@v2
with:
path: hledger/.stack-work
key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }}
restore-keys: ${{ runner.os }}-hledger-stack-work
- name: Cache hledger-ui/.stack-work
uses: actions/cache@v2
with:
path: hledger-ui/.stack-work
key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }}
restore-keys: ${{ runner.os }}-hledger-ui-stack-work
- name: Cache hledger-web/.stack-work
uses: actions/cache@v2
with:
path: hledger-web/.stack-work
key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }}
restore-keys: ${{ runner.os }}-hledger-web-stack-work
# actions:
- name: Install stack
# curl -L https://get.haskellstack.org/stable/linux-x86_64.tar.gz | tar xz --wildcards --strip-components=1 -C $INSTALLDIR '*/stack'
# mkdir -p ~/.local/bin
# export PATH=~/.local/bin:$PATH
# if [[ ! -x ~/.local/bin/stack ]]; then curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi
run: |
stack --version
- name: Install GHC
run: |
stack setup --install-ghc
- name: Install haskell deps
run: |
stack build --only-dependencies
- name: Build hledger fast
run: |
stack build --fast --ghc-options=-Werror
# --pedantic
- name: Install shelltestrunner
run: |
export PATH=~/.local/bin:$PATH
if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.9; fi
shelltest --version
- name: Test functional tests (excluding addons)
run: |
export PATH=~/.local/bin:$PATH
COLUMNS=80 stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons