2020-06-21 19:01:18 +03:00
|
|
|
# Runs on notable pushes to master.
|
2020-07-11 18:23:43 +03:00
|
|
|
|
|
|
|
# Builds incrementally and runs functional tests on linux,
|
|
|
|
# using the latest supported GHC version.
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-03-08 01:33:05 +03:00
|
|
|
name: push CI
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
2020-06-21 18:38:01 +03:00
|
|
|
branches: [ master ]
|
2020-03-06 21:54:00 +03:00
|
|
|
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/**'
|
|
|
|
- 'tests/**'
|
2020-03-06 21:54:00 +03:00
|
|
|
- '!**.md'
|
|
|
|
- '!**.1'
|
|
|
|
- '!**.5'
|
|
|
|
- '!**.info'
|
|
|
|
- '!**.txt'
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
2020-03-07 00:54:32 +03:00
|
|
|
runs-on: ubuntu-latest
|
2020-07-11 18:23:43 +03:00
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
plan:
|
2020-07-11 19:17:43 +03:00
|
|
|
# - { ghc: "80" , stack: "stack --stack-yaml=stack8.0.yaml" }
|
|
|
|
# - { ghc: "82" , stack: "stack --stack-yaml=stack8.2.yaml" }
|
|
|
|
# - { ghc: "84" , stack: "stack --stack-yaml=stack8.4.yaml" }
|
|
|
|
# - { ghc: "86" , stack: "stack --stack-yaml=stack8.6.yaml" }
|
|
|
|
# - { ghc: "88" , stack: "stack --stack-yaml=stack.yaml" }
|
|
|
|
- { ghc: "810" , stack: "stack --stack-yaml=stack8.10.yaml" }
|
2020-07-11 18:23:43 +03:00
|
|
|
|
2020-03-06 21:54:00 +03:00
|
|
|
steps:
|
|
|
|
|
2020-03-08 01:33:05 +03:00
|
|
|
- name: Check out
|
|
|
|
uses: actions/checkout@v2
|
2020-06-06 23:55:09 +03:00
|
|
|
# deep clone so we can restore timestamps (see below)
|
2020-04-21 04:19:33 +03:00
|
|
|
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
|
2020-06-23 01:51:37 +03:00
|
|
|
# help emacs highlighter: "
|
2020-03-08 01:33:05 +03:00
|
|
|
|
2020-06-06 23:49:58 +03:00
|
|
|
# things to be cached/restored:
|
2020-03-08 01:33:05 +03:00
|
|
|
|
|
|
|
- name: Cache stack global package db
|
|
|
|
id: stack-global
|
2020-08-01 22:49:53 +03:00
|
|
|
uses: actions/cache@v2.1
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: ~/.stack
|
2020-07-11 18:23:43 +03:00
|
|
|
key: ${{ runner.os }}-stack-global-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
|
2020-03-08 01:33:05 +03:00
|
|
|
restore-keys: |
|
2020-07-11 18:23:43 +03:00
|
|
|
${{ runner.os }}-stack-global-${{ matrix.plan.ghc }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-03-08 01:33:05 +03:00
|
|
|
- name: Cache stack-installed programs in ~/.local/bin
|
|
|
|
id: stack-programs
|
2020-08-01 22:49:53 +03:00
|
|
|
uses: actions/cache@v2.1
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: ~/.local/bin
|
2020-07-11 18:23:43 +03:00
|
|
|
key: ${{ runner.os }}-stack-programs-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
|
2020-03-08 01:33:05 +03:00
|
|
|
restore-keys: |
|
2020-07-11 18:23:43 +03:00
|
|
|
${{ runner.os }}-stack-programs-${{ matrix.plan.ghc }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache .stack-work
|
2020-08-01 22:49:53 +03:00
|
|
|
uses: actions/cache@v2.1
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: .stack-work
|
2020-07-11 18:23:43 +03:00
|
|
|
key: ${{ runner.os }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-stack-work-${{ matrix.plan.ghc }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-lib/.stack-work
|
2020-08-01 22:49:53 +03:00
|
|
|
uses: actions/cache@v2.1
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger-lib/.stack-work
|
2020-07-11 18:23:43 +03:00
|
|
|
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 }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger/.stack-work
|
2020-08-01 22:49:53 +03:00
|
|
|
uses: actions/cache@v2.1
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger/.stack-work
|
2020-07-11 18:23:43 +03:00
|
|
|
key: ${{ runner.os }}-hledger-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('hledger/package.yaml') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-hledger-stack-work-${{ matrix.plan.ghc }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-ui/.stack-work
|
2020-08-01 22:49:53 +03:00
|
|
|
uses: actions/cache@v2.1
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger-ui/.stack-work
|
2020-07-11 18:23:43 +03:00
|
|
|
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 }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-web/.stack-work
|
2020-08-01 22:49:53 +03:00
|
|
|
uses: actions/cache@v2.1
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger-web/.stack-work
|
2020-07-11 18:23:43 +03:00
|
|
|
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 }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-06-06 23:49:58 +03:00
|
|
|
# actions:
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Install stack
|
2020-03-07 00:54:32 +03:00
|
|
|
# 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
|
2020-03-06 21:54:00 +03:00
|
|
|
run: |
|
2020-07-11 19:17:43 +03:00
|
|
|
$stack --version
|
|
|
|
env:
|
|
|
|
stack: ${{ matrix.plan.stack }}
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Install GHC
|
2020-07-11 18:23:43 +03:00
|
|
|
env:
|
2020-07-11 19:17:43 +03:00
|
|
|
stack: ${{ matrix.plan.stack }}
|
|
|
|
run: |
|
|
|
|
$stack setup --install-ghc
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Install haskell deps
|
2020-07-11 18:23:43 +03:00
|
|
|
env:
|
2020-07-11 19:17:43 +03:00
|
|
|
stack: ${{ matrix.plan.stack }}
|
|
|
|
run: |
|
|
|
|
$stack build --only-dependencies
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-06-23 02:12:04 +03:00
|
|
|
- name: Build hledger fast
|
2020-07-11 18:23:43 +03:00
|
|
|
env:
|
2020-07-11 19:17:43 +03:00
|
|
|
stack: ${{ matrix.plan.stack }}
|
|
|
|
run: |
|
|
|
|
$stack build --fast --ghc-options=-Werror
|
|
|
|
# --ghc-options=-fforce-recomp # needed occasionally to clear out stale compiled modules
|
|
|
|
# --pedantic
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-03-08 01:33:05 +03:00
|
|
|
- name: Install shelltestrunner
|
2020-07-11 19:17:43 +03:00
|
|
|
env:
|
|
|
|
stack: ${{ matrix.plan.stack }}
|
2020-03-07 00:54:32 +03:00
|
|
|
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
|
2020-03-08 01:33:05 +03:00
|
|
|
shelltest --version
|
2020-03-07 00:54:32 +03:00
|
|
|
|
2020-03-08 01:33:05 +03:00
|
|
|
- name: Test functional tests (excluding addons)
|
2020-07-11 19:17:43 +03:00
|
|
|
env:
|
|
|
|
stack: ${{ matrix.plan.stack }}
|
2020-03-08 01:33:05 +03:00
|
|
|
run: |
|
2020-03-16 20:34:36 +03:00
|
|
|
export PATH=~/.local/bin:$PATH
|
2020-07-11 19:17:43 +03:00
|
|
|
COLUMNS=80 $stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons
|