hledger/.github/workflows/binaries-mac-x64.yml

199 lines
6.9 KiB
YAML
Raw Normal View History

# Runs on any push to ci-mac, and weekly on master.
# 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.
name: binaries-mac-x64
on:
schedule:
- cron: "0 07 * * 0" # sunday midnight pacific
push:
branches: [ binaries-mac-x64, binaries ]
workflow_dispatch:
jobs:
build:
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
plan:
2021-07-17 07:25:30 +03:00
# - { ghc: "810" , stack: "stack --stack-yaml=stack8.10.yaml" }
# 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" }
steps:
- name: Check out
2023-01-27 10:54:56 +03:00
uses: actions/checkout@v3
# 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
- 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:
- name: Cache stack global package db
id: stack-global
2023-01-27 10:53:51 +03:00
uses: actions/cache@v3
with:
path: ~/.stack
key: ${{ runner.os }}-stack-global-from20220817-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-global-from20220817
if: env.CONTINUE
- name: Cache stack-installed programs in ~/.local/bin
id: stack-programs
2023-01-27 10:53:51 +03:00
uses: actions/cache@v3
with:
path: ~/.local/bin
key: ${{ runner.os }}-stack-programs-from20220817-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-programs-from20220817
if: env.CONTINUE
- name: Cache .stack-work
2023-01-27 10:53:51 +03:00
uses: actions/cache@v3
with:
path: .stack-work
key: ${{ runner.os }}-stack-work-from20220817-${{ hashFiles('**.yaml') }}
restore-keys: |
${{ runner.os }}-stack-work-from20220817
if: env.CONTINUE
- name: Cache hledger-lib/.stack-work
2023-01-27 10:53:51 +03:00
uses: actions/cache@v3
with:
path: hledger-lib/.stack-work
key: ${{ runner.os }}-hledger-lib-stack-work-from20220817-${{ hashFiles('hledger-lib/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-lib-stack-work-from20220817
if: env.CONTINUE
- name: Cache hledger/.stack-work
2023-01-27 10:53:51 +03:00
uses: actions/cache@v3
with:
path: hledger/.stack-work
key: ${{ runner.os }}-hledger-stack-work-from20220817-${{ hashFiles('hledger/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-stack-work-from20220817
if: env.CONTINUE
- name: Cache hledger-ui/.stack-work
2023-01-27 10:53:51 +03:00
uses: actions/cache@v3
with:
path: hledger-ui/.stack-work
key: ${{ runner.os }}-hledger-ui-stack-work-from20220817-${{ hashFiles('hledger-ui/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-ui-stack-work-from20220817
if: env.CONTINUE
- name: Cache hledger-web/.stack-work
2023-01-27 10:53:51 +03:00
uses: actions/cache@v3
with:
path: hledger-web/.stack-work
key: ${{ runner.os }}-hledger-web-stack-work-from20220817-${{ hashFiles('hledger-web/package.yaml') }}
restore-keys: |
${{ runner.os }}-hledger-web-stack-work-from20220817
if: env.CONTINUE
2020-06-06 23:49:58 +03:00
# actions:
- name: Install stack
# run: |
# brew install haskell-stack
# $stack --version
run: |
mkdir -p ~/.local/bin
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
if: env.CONTINUE
- name: Install GHC (with stack)
env:
stack: ${{ matrix.plan.stack }}
run: |
$stack setup --install-ghc
if: env.CONTINUE
# - 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
# - 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
- name: Install haskell deps
env:
2020-07-11 19:17:43 +03:00
stack: ${{ matrix.plan.stack }}
run: |
$stack build --test --only-dependencies --dry-run
2020-07-11 19:17:43 +03:00
$stack build --test --only-dependencies
if: env.CONTINUE
- name: Build hledger and test unit tests, doc tests
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
if: env.CONTINUE
- name: Install shelltestrunner
2020-07-11 19:17:43 +03:00
env:
stack: ${{ matrix.plan.stack }}
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
shelltest --version
if: env.CONTINUE
- name: Test functional tests (excluding addons)
2020-07-11 19:17:43 +03:00
env:
stack: ${{ matrix.plan.stack }}
run: |
export PATH=~/.local/bin:$PATH
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
if: env.CONTINUE
# artifacts:
- name: Gather binaries
run: |
mkdir tmp
cd tmp
cp ~/.local/bin/hledger .
cp ~/.local/bin/hledger-ui .
cp ~/.local/bin/hledger-web .
strip hledger
strip hledger-ui
strip hledger-web
tar cvf hledger-mac-x64.tar hledger hledger-ui hledger-web
if: env.CONTINUE
# 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.
- name: Upload binaries artifact
uses: actions/upload-artifact@v3
with:
name: hledger-mac-x64
path: tmp/hledger-mac-x64.tar
if: env.CONTINUE
2021-12-02 07:48:53 +03:00