2022-03-26 21:54:41 +03:00
|
|
|
# Runs after notable pushes to the branches listed below. Failure does not prevent the push.
|
|
|
|
# master is configured to require a successful CI check, which should be one of the enabled
|
|
|
|
# matrix plans below (it is shown in github UI as "build (810, ..." eg). So the process is:
|
|
|
|
# 1. push new commits to a personal test branch listed below (simon)
|
2022-03-26 21:51:23 +03:00
|
|
|
# 2. wait for this check to succeed, then
|
2022-03-26 21:54:41 +03:00
|
|
|
# 3. push the same commits to master, which will now allow it.
|
|
|
|
|
|
|
|
# Builds unoptimised on x64 linux and runs functional tests, using the GHC version(s) enabled below.
|
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:
|
2022-03-26 21:54:41 +03:00
|
|
|
branches: [ simon ]
|
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/**'
|
2021-01-12 22:01:41 +03:00
|
|
|
- 'bin/*.hs'
|
2020-11-17 23:55:13 +03:00
|
|
|
- '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
|
2020-11-17 23:55:13 +03:00
|
|
|
- '!**.journal'
|
|
|
|
- '!**.j'
|
|
|
|
- '!**.ledger'
|
|
|
|
- '!**.csv'
|
|
|
|
# ignore changes to doc source files
|
2020-11-17 21:57:42 +03:00
|
|
|
- '!**.m4'
|
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: "86" , stack: "stack --stack-yaml=stack8.6.yaml" }
|
2021-01-30 02:08:18 +03:00
|
|
|
# - { ghc: "88" , stack: "stack --stack-yaml=stack8.8.yaml" }
|
2021-07-17 01:49:46 +03:00
|
|
|
- { ghc: "810" , stack: "stack --stack-yaml=stack8.10.yaml" }
|
|
|
|
# - { ghc: "90" , stack: "stack --stack-yaml=stack.yaml" }
|
2022-03-26 21:51:23 +03:00
|
|
|
# - { ghc: "92" , stack: "stack --stack-yaml=stack9.2.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
|
2021-06-04 11:44:46 +03:00
|
|
|
# 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
|
|
|
|
ci: run commitlint to check commits (#1602)
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.
2021-07-09 10:35:14 +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"..
|
2021-12-11 05:52:19 +03:00
|
|
|
# tools/commitlint "$GITHUB_BASE_REF"..
|
ci: run commitlint to check commits (#1602)
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.
2021-07-09 10:35:14 +03:00
|
|
|
|
2021-07-14 00:36:26 +03:00
|
|
|
# keep synced in all workflows which do this
|
ci: run commitlint to check commits (#1602)
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.
2021-07-09 10:35:14 +03:00
|
|
|
- name: Check commit messages
|
2021-07-14 00:36:26 +03:00
|
|
|
# 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".
|
2021-11-23 05:37:32 +03:00
|
|
|
# In this and any case where the range is invalid, we'll just skip the check, to avoid false positives
|
2021-07-14 00:36:26 +03:00
|
|
|
# related: https://stackoverflow.com/questions/64708371/how-to-run-github-workflow-on-every-commit-of-a-push
|
ci: run commitlint to check commits (#1602)
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.
2021-07-09 10:35:14 +03:00
|
|
|
env:
|
|
|
|
BEFORE: ${{ github.event.before }}
|
2022-01-06 19:31:53 +03:00
|
|
|
# NUM: 5
|
2021-08-29 21:10:09 +03:00
|
|
|
shell: bash
|
ci: run commitlint to check commits (#1602)
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.
2021-07-09 10:35:14 +03:00
|
|
|
run: |
|
2021-07-14 00:36:26 +03:00
|
|
|
RANGE=${BEFORE:-origin/master}..${GITHUB_HEAD_REF:+origin/$GITHUB_HEAD_REF}
|
2022-01-06 19:31:53 +03:00
|
|
|
if git rev-list --quiet $RANGE
|
|
|
|
then tools/commitlint $RANGE
|
|
|
|
else echo "could not identify commits, not checking them"
|
|
|
|
fi
|
ci: run commitlint to check commits (#1602)
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.
2021-07-09 10:35:14 +03:00
|
|
|
|
2022-01-06 19:31:53 +03:00
|
|
|
- name: Skip remaining steps if last commit message begins with ;
|
2021-08-29 21:10:09 +03:00
|
|
|
shell: bash
|
2021-07-21 11:51:51 +03:00
|
|
|
run: |
|
2021-08-19 06:39:31 +03:00
|
|
|
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 )
|
2021-07-21 11:51:51 +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:58:02 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: ~/.stack
|
2022-03-26 09:59:28 +03:00
|
|
|
# XXX if stack.yaml is a symlink, this fails with
|
|
|
|
# Error: The template is not valid. .github/workflows/push.yml (Line: 103, Col: 14): hashFiles('**.yaml') failed.
|
|
|
|
# Fail to hash files under directory '/home/runner/work/hledger/hledger'
|
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 }}
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
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:58:02 +03:00
|
|
|
uses: actions/cache@v2
|
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 }}
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache .stack-work
|
2020-08-01 22:58:02 +03:00
|
|
|
uses: actions/cache@v2
|
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 }}
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-lib/.stack-work
|
2020-08-01 22:58:02 +03:00
|
|
|
uses: actions/cache@v2
|
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 }}
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger/.stack-work
|
2020-08-01 22:58:02 +03:00
|
|
|
uses: actions/cache@v2
|
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 }}
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-ui/.stack-work
|
2020-08-01 22:58:02 +03:00
|
|
|
uses: actions/cache@v2
|
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 }}
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-web/.stack-work
|
2020-08-01 22:58:02 +03:00
|
|
|
uses: actions/cache@v2
|
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 }}
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
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
|
|
|
|
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
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
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
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
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
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
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: |
|
2020-09-08 01:30:03 +03:00
|
|
|
$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
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
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
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|
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
|
2021-01-12 22:47:57 +03:00
|
|
|
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
|
2021-07-21 11:51:51 +03:00
|
|
|
if: env.CONTINUE
|