2020-06-07 19:37:53 +03:00
|
|
|
# Light Windows CI tests: build and run functional tests with one GHC version.
|
2020-06-06 23:49:58 +03:00
|
|
|
# GHC 8.8.2 for now to avoid https://gitlab.haskell.org/ghc/ghc/issues/17926.
|
|
|
|
#
|
2020-06-07 19:37:53 +03:00
|
|
|
# Runs: periodically on master, and on notable push to ci-windows.
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-03-18 03:17:41 +03:00
|
|
|
name: windows CI
|
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-06-07 19:37:53 +03:00
|
|
|
|
2020-03-06 21:54:00 +03:00
|
|
|
push:
|
2020-03-17 02:30:14 +03:00
|
|
|
branches: [ ci-windows ]
|
2020-03-06 21:54:00 +03:00
|
|
|
paths:
|
2020-03-18 03:17:41 +03:00
|
|
|
- '.github/workflows/windows.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:
|
|
|
|
runs-on: windows-latest
|
|
|
|
steps:
|
|
|
|
|
2020-03-07 12:38:10 +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)
|
|
|
|
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
|
2020-06-07 03:31:53 +03:00
|
|
|
shell: bash
|
2020-06-06 23:55:09 +03:00
|
|
|
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-03-07 12:38:10 +03:00
|
|
|
|
2020-06-06 23:49:58 +03:00
|
|
|
# things to be cached/restored:
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-03-07 14:35:19 +03:00
|
|
|
- name: Cache stack global package db
|
|
|
|
id: stack-global-package-db
|
2020-05-30 04:04:52 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-07 14:22:44 +03:00
|
|
|
with:
|
|
|
|
path: C:\Users\runneradmin\AppData\Roaming\stack\
|
|
|
|
key: ${{ runner.os }}-appdata-roaming-stack-${{ hashFiles('**.yaml') }}
|
|
|
|
restore-keys: ${{ runner.os }}-appdata-roaming-stack
|
|
|
|
|
2020-03-07 14:51:38 +03:00
|
|
|
- name: Cache stack programs dir # ghc, ghc-included packages and their haddocks, mingw, msys2
|
2020-03-07 14:35:19 +03:00
|
|
|
id: stack-programs-dir
|
2020-05-30 04:04:52 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
2020-03-06 22:16:13 +03:00
|
|
|
path: C:\Users\runneradmin\AppData\Local\Programs\stack\
|
2020-03-07 13:50:26 +03:00
|
|
|
# which files signal a change in stack's global db ?
|
|
|
|
# **.yaml includes */package.yaml and stack.yaml* (too many), and hopefully no other changing yamls
|
2020-03-07 12:51:53 +03:00
|
|
|
key: ${{ runner.os }}-appdata-local-programs-stack-${{ hashFiles('**.yaml') }}
|
2020-03-07 13:05:27 +03:00
|
|
|
restore-keys: ${{ runner.os }}-appdata-local-programs-stack
|
2020-03-06 22:41:27 +03:00
|
|
|
|
2020-03-06 21:54:00 +03:00
|
|
|
- name: Cache .stack-work
|
2020-05-30 04:04:52 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: .stack-work
|
2020-03-07 13:50:26 +03:00
|
|
|
key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }}
|
2020-03-07 13:23:54 +03:00
|
|
|
restore-keys: ${{ runner.os }}-stack-work
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-lib/.stack-work
|
2020-05-30 04:04:52 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger-lib/.stack-work
|
2020-03-07 13:50:26 +03:00
|
|
|
key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }}
|
2020-03-07 13:23:54 +03:00
|
|
|
restore-keys: ${{ runner.os }}-hledger-lib-stack-work
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger/.stack-work
|
2020-05-30 04:04:52 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger/.stack-work
|
2020-03-07 13:50:26 +03:00
|
|
|
key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }}
|
2020-03-07 13:23:54 +03:00
|
|
|
restore-keys: ${{ runner.os }}-hledger-stack-work
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-ui/.stack-work
|
2020-05-30 04:04:52 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger-ui/.stack-work
|
2020-03-07 13:50:26 +03:00
|
|
|
key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }}
|
2020-03-07 13:23:54 +03:00
|
|
|
restore-keys: ${{ runner.os }}-hledger-ui-stack-work
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
- name: Cache hledger-web/.stack-work
|
2020-05-30 04:04:52 +03:00
|
|
|
uses: actions/cache@v2
|
2020-03-06 21:54:00 +03:00
|
|
|
with:
|
|
|
|
path: hledger-web/.stack-work
|
2020-03-07 13:50:26 +03:00
|
|
|
key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }}
|
2020-03-07 13:23:54 +03:00
|
|
|
restore-keys: ${{ runner.os }}-hledger-web-stack-work
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-06-06 23:49:58 +03:00
|
|
|
# - name: showStuff
|
|
|
|
# shell: bash
|
|
|
|
# run: |
|
|
|
|
# ls -lFRa /c/users/runneradmin/appdata/roaming/stack
|
|
|
|
# ls -lFRa /c/users/runneradmin/appdata/local/programs/stack
|
|
|
|
|
|
|
|
# actions:
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-03-07 14:14:54 +03:00
|
|
|
# - name: Add stack local bin to PATH
|
|
|
|
# run: echo "::add-path::C:\Users\runneradmin\AppData\Roaming\stack\local\bin"
|
2020-03-07 13:57:59 +03:00
|
|
|
|
2020-03-06 21:54:00 +03:00
|
|
|
- name: Install stack
|
2020-03-07 14:40:48 +03:00
|
|
|
#if: steps.stack-programs-dir.outputs.cache-hit != 'true'
|
|
|
|
# this step is needed to get stack.exe into PATH, for now
|
2020-03-06 21:54:00 +03:00
|
|
|
run: |
|
|
|
|
curl -skL -o stack.zip http://www.stackage.org/stack/windows-x86_64
|
|
|
|
7z x stack.zip -oC:\Windows stack.exe
|
|
|
|
stack --version
|
|
|
|
|
2020-04-02 00:14:02 +03:00
|
|
|
# resolver lts-15.3 to avoid GHC 8.8.3 access violation, https://gitlab.haskell.org/ghc/ghc/issues/17926:
|
|
|
|
|
2020-03-06 22:24:26 +03:00
|
|
|
- name: Install GHC
|
2020-03-07 14:51:38 +03:00
|
|
|
# if: steps.stack-programs-dir.outputs.cache-hit != 'true'
|
2020-03-07 14:40:48 +03:00
|
|
|
# set PATH=C:\Users\runneradmin\AppData\Local\Programs\stack\local\bin;%PATH%
|
2020-03-06 22:24:26 +03:00
|
|
|
run: |
|
2020-03-17 04:35:21 +03:00
|
|
|
stack --resolver=lts-15.3 --no-terminal setup --install-ghc
|
2020-03-06 22:24:26 +03:00
|
|
|
|
2020-03-06 21:54:00 +03:00
|
|
|
# - name: Install shelltestrunner
|
2020-03-16 20:34:36 +03:00
|
|
|
## - export PATH=~/.local/bin:$PATH
|
2020-03-06 21:54:00 +03:00
|
|
|
# - if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.9; fi
|
|
|
|
# - shelltest --version
|
|
|
|
|
|
|
|
- name: Install haskell deps
|
|
|
|
run: |
|
2020-03-17 04:35:21 +03:00
|
|
|
stack --resolver=lts-15.3 --no-terminal build --only-dependencies
|
2020-03-06 21:54:00 +03:00
|
|
|
|
2020-03-07 14:51:38 +03:00
|
|
|
- name: Build hledger executables
|
2020-03-07 14:22:44 +03:00
|
|
|
run: |
|
2020-03-17 04:35:21 +03:00
|
|
|
stack --resolver=lts-15.3 --no-terminal install --ghc-options=-Werror
|
2020-03-08 01:53:12 +03:00
|
|
|
# --pedantic
|
2020-03-06 21:54:00 +03:00
|
|
|
|
|
|
|
# run hledger-lib/hledger functional tests, skipping the ones for addons
|
2020-03-16 20:34:36 +03:00
|
|
|
## - export PATH=~/.local/bin:$PATH
|
2020-03-06 21:54:00 +03:00
|
|
|
#- COLUMNS=80 stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons
|
|
|
|
|
2020-04-02 00:14:02 +03:00
|
|
|
# - name: Zip executables
|
|
|
|
# #cd `stack path --local-bin`
|
|
|
|
# run: |
|
|
|
|
# cd C:\Users\runneradmin\AppData\Roaming\local\bin\
|
|
|
|
# 7z a D:\a\hledger\hledger\hledger.zip hledger.exe hledger-web.exe
|
|
|
|
|
|
|
|
# github automatically zips every artifact, though it's not
|
|
|
|
# apparent in the displayed link text and file size
|
|
|
|
|
|
|
|
- name: Gather executables
|
2020-03-07 07:06:20 +03:00
|
|
|
run: |
|
2020-04-02 00:14:02 +03:00
|
|
|
mkdir tmp
|
|
|
|
cd tmp
|
|
|
|
mkdir hledger
|
|
|
|
cd hledger
|
|
|
|
copy C:\Users\runneradmin\AppData\Roaming\local\bin\hledger.exe .
|
|
|
|
copy C:\Users\runneradmin\AppData\Roaming\local\bin\hledger-web.exe .
|
2020-03-07 07:24:59 +03:00
|
|
|
|
2020-04-02 00:14:02 +03:00
|
|
|
- name: Create executables artifact
|
2020-06-09 01:24:13 +03:00
|
|
|
uses: actions/upload-artifact@v2
|
2020-03-07 07:06:20 +03:00
|
|
|
with:
|
2020-06-09 21:49:04 +03:00
|
|
|
name: hledger-win
|
2020-04-02 00:14:02 +03:00
|
|
|
path: tmp/hledger
|