As first step in our main "check" workflows (push, linux, mac, windows), check all the commit messages with commitlint. These workflows can be triggered in various ways: pull requests, pushes, manually, or scheduled. For (each push to) a pull request, all commits currently in the PR branch are checked. For a regular push, all the pushed commits are checked, usually. Subcases: push to master, push to other branch, force push; I think at least the first two work, I don't care to spend more time on it. For a manual run, it seemed to check the same commits as a push (which push ? Not sure how this works). For a scheduled run - we'll see.
181 lines
5.9 KiB
YAML
181 lines
5.9 KiB
YAML
# 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:
|
|
- '.github/workflows/push.yml'
|
|
- 'stack*.yaml'
|
|
- 'hledger-lib/**'
|
|
- 'hledger/**'
|
|
- 'hledger-ui/**'
|
|
- 'hledger-web/**'
|
|
- 'bin/*.hs'
|
|
# ignore changes to example files, though currently some func tests depend on them
|
|
- 'examples/**'
|
|
- '!**.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:
|
|
# - { ghc: "86" , stack: "stack --stack-yaml=stack8.6.yaml" }
|
|
# - { ghc: "88" , stack: "stack --stack-yaml=stack8.8.yaml" }
|
|
- { ghc: "810" , stack: "stack --stack-yaml=stack.yaml" }
|
|
# - { ghc: "90" , stack: "stack --stack-yaml=stack9.0.yaml" }
|
|
|
|
steps:
|
|
|
|
- name: Check out
|
|
uses: actions/checkout@v2
|
|
# have to fetch everything for git describe for --version
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
# - 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"..
|
|
# bin/commitlint "$GITHUB_BASE_REF"..
|
|
|
|
- name: Check commit messages
|
|
env:
|
|
BEFORE: ${{ github.event.before }}
|
|
# for a PR this 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 (not locally) this is an "invalid revision range"
|
|
run: |
|
|
bin/commitlint ${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
|
|
|
|
# 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 }}
|
|
|
|
- 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 }}
|
|
|
|
- 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 }}
|
|
|
|
- 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 }}
|
|
|
|
- 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 }}
|
|
|
|
- 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 }}
|
|
|
|
- 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 }}
|
|
|
|
# actions:
|
|
|
|
- name: Install stack
|
|
run: |
|
|
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
|
|
|
|
- name: Install GHC
|
|
env:
|
|
stack: ${{ matrix.plan.stack }}
|
|
run: |
|
|
$stack setup --install-ghc
|
|
|
|
- name: Install haskell deps
|
|
env:
|
|
stack: ${{ matrix.plan.stack }}
|
|
run: |
|
|
$stack build --only-dependencies
|
|
|
|
- name: Build hledger fast
|
|
env:
|
|
stack: ${{ matrix.plan.stack }}
|
|
run: |
|
|
$stack build --fast --ghc-options=-Werror --force-dirty
|
|
# --ghc-options=-fforce-recomp # needed occasionally to clear out stale compiled modules
|
|
# --pedantic
|
|
|
|
- name: Install shelltestrunner
|
|
env:
|
|
stack: ${{ matrix.plan.stack }}
|
|
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)
|
|
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
|