2021-12-02 10:09:21 +03:00
# Runs on any push to ci-mac, and weekly on master.
2022-01-05 21:56:17 +03:00
# Produces optimised mac binaries and runs unit/doc/functional tests,
2022-01-05 22:01:59 +03:00
# using the default stack.yaml's GHC version.
2020-03-06 21:54:00 +03:00
2022-06-06 13:58:34 +03:00
name : binaries-mac-x64
2020-03-06 21:54:00 +03:00
on :
2020-03-17 02:30:14 +03:00
schedule :
2020-03-18 03:17:41 +03:00
- cron : "0 07 * * 0" # sunday midnight pacific
2020-03-06 21:54:00 +03:00
push :
2022-08-18 05:19:42 +03:00
branches : [ binaries-mac-x64, binaries ]
2021-07-04 03:51:17 +03:00
workflow_dispatch :
2020-03-06 21:54:00 +03:00
jobs :
build :
runs-on : macos-latest
2020-07-11 18:23:43 +03:00
strategy :
fail-fast : false
matrix :
plan :
2021-07-17 07:25:30 +03:00
# - { ghc: "810" , stack: "stack --stack-yaml=stack8.10.yaml" }
2021-07-17 01:49:46 +03:00
# XXX func tests in bin should be run only with GHC 8.10 for now (see shelltest below) (?)
2022-04-17 20:40:03 +03:00
# - { ghc: "90" , stack: "stack --stack-yaml=stack9.0.yaml" }
2023-03-11 08:02:34 +03:00
# - { ghc: "92" , stack: "stack --stack-yaml=stack9.2.yaml" }
- { ghc : "94" , stack : "stack --stack-yaml=stack.yaml" }
2020-07-11 18:23:43 +03:00
2020-03-06 21:54:00 +03:00
steps :
2020-03-08 00:39:53 +03:00
- name : Check out
2023-01-27 10:54:56 +03:00
uses : actions/checkout@v3
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
2022-01-06 20:06:57 +03:00
- name : Confirm all remaining steps should run
run : echo "CONTINUE=true" >> $GITHUB_ENV
2020-06-06 23:49:58 +03:00
# things to be cached/restored:
2020-03-06 21:54:00 +03:00
2020-03-08 00:39:53 +03:00
- name : Cache stack global package db
id : stack-global
2023-01-27 10:53:51 +03:00
uses : actions/cache@v3
2020-03-06 21:54:00 +03:00
with :
path : ~/.stack
2022-08-18 06:15:44 +03:00
key : ${{ runner.os }}-stack-global-from20220817-${{ hashFiles('**.yaml') }}
2020-03-08 00:39:53 +03:00
restore-keys : |
2022-08-18 06:15:44 +03:00
${{ runner.os }}-stack-global-from20220817
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
2020-03-08 00:39:53 +03:00
- name : Cache stack-installed programs in ~/.local/bin
id : stack-programs
2023-01-27 10:53:51 +03:00
uses : actions/cache@v3
2020-03-06 21:54:00 +03:00
with :
path : ~/.local/bin
2022-08-18 06:15:44 +03:00
key : ${{ runner.os }}-stack-programs-from20220817-${{ hashFiles('**.yaml') }}
2020-03-08 00:39:53 +03:00
restore-keys : |
2022-08-18 06:15:44 +03:00
${{ runner.os }}-stack-programs-from20220817
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
- name : Cache .stack-work
2023-01-27 10:53:51 +03:00
uses : actions/cache@v3
2020-03-06 21:54:00 +03:00
with :
path : .stack-work
2022-08-18 06:15:44 +03:00
key : ${{ runner.os }}-stack-work-from20220817-${{ hashFiles('**.yaml') }}
2020-07-11 18:23:43 +03:00
restore-keys : |
2022-08-18 06:15:44 +03:00
${{ runner.os }}-stack-work-from20220817
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
- name : Cache hledger-lib/.stack-work
2023-01-27 10:53:51 +03:00
uses : actions/cache@v3
2020-03-06 21:54:00 +03:00
with :
path : hledger-lib/.stack-work
2022-08-18 06:15:44 +03:00
key : ${{ runner.os }}-hledger-lib-stack-work-from20220817-${{ hashFiles('hledger-lib/package.yaml') }}
2020-07-11 18:23:43 +03:00
restore-keys : |
2022-08-18 06:15:44 +03:00
${{ runner.os }}-hledger-lib-stack-work-from20220817
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
- name : Cache hledger/.stack-work
2023-01-27 10:53:51 +03:00
uses : actions/cache@v3
2020-03-06 21:54:00 +03:00
with :
path : hledger/.stack-work
2022-08-18 06:15:44 +03:00
key : ${{ runner.os }}-hledger-stack-work-from20220817-${{ hashFiles('hledger/package.yaml') }}
2020-07-11 18:23:43 +03:00
restore-keys : |
2022-08-18 06:15:44 +03:00
${{ runner.os }}-hledger-stack-work-from20220817
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
- name : Cache hledger-ui/.stack-work
2023-01-27 10:53:51 +03:00
uses : actions/cache@v3
2020-03-06 21:54:00 +03:00
with :
path : hledger-ui/.stack-work
2022-08-18 06:15:44 +03:00
key : ${{ runner.os }}-hledger-ui-stack-work-from20220817-${{ hashFiles('hledger-ui/package.yaml') }}
2020-07-11 18:23:43 +03:00
restore-keys : |
2022-08-18 06:15:44 +03:00
${{ runner.os }}-hledger-ui-stack-work-from20220817
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
- name : Cache hledger-web/.stack-work
2023-01-27 10:53:51 +03:00
uses : actions/cache@v3
2020-03-06 21:54:00 +03:00
with :
path : hledger-web/.stack-work
2022-08-18 06:15:44 +03:00
key : ${{ runner.os }}-hledger-web-stack-work-from20220817-${{ hashFiles('hledger-web/package.yaml') }}
2020-07-11 18:23:43 +03:00
restore-keys : |
2022-08-18 06:15:44 +03:00
${{ runner.os }}-hledger-web-stack-work-from20220817
2021-07-21 12:01:57 +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
2020-10-19 08:04:32 +03:00
# run: |
# brew install haskell-stack
# $stack --version
2020-03-06 21:54:00 +03:00
run : |
2020-10-19 08:04:32 +03:00
mkdir -p ~/.local/bin
2020-10-19 08:57:11 +03:00
export PATH=~/.local/bin:$PATH
# brew install gnu-tar; curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack
if [[ ! -x ~/.local/bin/stack ]]; then brew install gnu-tar; curl -sL https://get.haskellstack.org/stable/osx-x86_64.tar.gz | gtar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi
2020-10-19 08:23:37 +03:00
stack --version
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
2022-08-18 06:04:08 +03:00
- name : Install GHC (with stack)
env :
stack : ${{ matrix.plan.stack }}
run : |
$stack setup --install-ghc
if : env.CONTINUE
2022-08-18 05:16:47 +03:00
# - name: Install GHC (with ghcup)
# run: |
# mkdir -p ~/.ghcup/bin && curl -sL https://downloads.haskell.org/~ghcup/x86_64-apple-darwin-ghcup > ~/.ghcup/bin/ghcup && chmod +x ~/.ghcup/bin/ghcup
# ~/.ghcup/bin/ghcup install --set ghc 9.2.4 # && ~/.ghcup/bin/ghcup install stack
# echo "$HOME/.ghcup/bin/" >> $GITHUB_PATH
# if: env.CONTINUE
2022-08-18 06:04:08 +03:00
# - name: Install GHC (from haskell.org)
# run: |
# curl -sL https://downloads.haskell.org/~ghc/9.2.4/ghc-9.2.4-x86_64-apple-darwin.tar.xz | tar xj && cd ghc-9.2.4-x86_64-apple-darwin && ./configure && make install
# ghc --version
# mkdir -p ~/.stack && printf "system-ghc: true\ninstall-ghc: false\n" >>~/.stack/config.yaml
# 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 : |
2022-08-17 13:50:10 +03:00
$stack build --test --only-dependencies --dry-run
2020-07-11 19:17:43 +03:00
$stack build --test --only-dependencies
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
2020-03-08 00:39:53 +03:00
- name : Build hledger and test unit tests, doc tests
2020-07-11 18:23:43 +03:00
env :
2020-07-11 19:17:43 +03:00
stack : ${{ matrix.plan.stack }}
run : |
$stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror
# --ghc-options=-split-sections doesn't work on mac
# --pedantic
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-06 21:54:00 +03:00
2020-03-08 00:39:53 +03:00
- name : Install shelltestrunner
2020-07-11 19:17:43 +03:00
env :
stack : ${{ matrix.plan.stack }}
2020-03-08 00:39:53 +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 00:39:53 +03:00
shelltest --version
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-08 00:39:53 +03:00
- name : Test functional tests (excluding addons)
2020-07-11 19:17:43 +03:00
env :
stack : ${{ matrix.plan.stack }}
2020-03-08 00:39:53 +03:00
run : |
2020-03-16 20:34:36 +03:00
export PATH=~/.local/bin:$PATH
2022-12-22 22:15:06 +03:00
COLUMNS=80 $stack exec -- shelltest --execdir -j16 hledger/test -x /_ -x /addons -x ledger-compat/baseline -x ledger-compat/regress -x ledger-compat/collected # bin
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-03-08 00:39:53 +03:00
2020-06-10 01:27:30 +03:00
# artifacts:
2022-07-27 00:49:47 +03:00
- name : Gather binaries
2020-06-09 01:32:37 +03:00
run : |
mkdir tmp
cd tmp
2020-06-10 01:27:30 +03:00
cp ~/.local/bin/hledger .
cp ~/.local/bin/hledger-ui .
cp ~/.local/bin/hledger-web .
2022-05-22 12:46:57 +03:00
strip hledger
strip hledger-ui
strip hledger-web
2022-07-27 01:27:53 +03:00
tar cvf hledger-mac-x64.tar hledger hledger-ui hledger-web
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2020-06-09 01:32:37 +03:00
2022-07-27 01:27:53 +03:00
# upload-artifact loses execute permissions, so we tar the binaries to preserve them.
# github UI always zips artifacts when they are downloaded, so we don't bother compressing the tar.
# Unfortunately it means users must both unzip and untar.
2022-07-27 00:49:47 +03:00
- name : Upload binaries artifact
2022-07-26 13:02:01 +03:00
uses : actions/upload-artifact@v3
2020-06-09 01:32:37 +03:00
with :
2022-05-22 12:41:56 +03:00
name : hledger-mac-x64
2022-07-27 01:27:53 +03:00
path : tmp/hledger-mac-x64.tar
2021-07-21 12:01:57 +03:00
if : env.CONTINUE
2021-12-02 07:48:53 +03:00