From a1c2c82c038469d5fc6ddaa9785a64c0e42c54ce Mon Sep 17 00:00:00 2001 From: Simon Michael Date: Sat, 11 Jul 2020 08:23:43 -0700 Subject: [PATCH] ci: spread ghc versions among workflows, clean up restore keys --- .github/workflows/linux.yml | 61 ++++++++++++++--------------- .github/workflows/mac.yml | 72 ++++++++++++++++++++++++---------- .github/workflows/push.yml | 73 +++++++++++++++++++++++------------ .github/workflows/windows.yml | 45 +++++++++++---------- 4 files changed, 153 insertions(+), 98 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index 11aaa988b..817fc29e5 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -1,9 +1,12 @@ -# Thorough tests on linux. # Runs on notable pushes to ci-linux, on notable pull requests against # master, and weekly on master. -# Builds all modules optimised, runs unit, benchmark, doc, functional, -# haddock tests, with all supported GHC versions, -# and uploads binaries artifact. + +# Builds all modules optimised and runs +# unit/doc/functional/haddock/benchmark tests on linux, +# using the oldest supported GHC version (only, as a compromise to +# reduce carbon emissions. Some of the other versions are exercised by +# the other workflows.) +# Currently does not upload a binaries artifact. name: linux CI @@ -46,18 +49,18 @@ on: jobs: build: + runs-on: ubuntu-latest strategy: fail-fast: false matrix: plan: # GHC 8.0 is still supported but we don't have a build plan for hledger-web, let it go - # - { key: "80", args: "--stack-yaml=stack8.0.yaml" } - - { key: "82", args: "--stack-yaml=stack8.2.yaml" } - - { key: "84", args: "--stack-yaml=stack8.4.yaml" } - - { key: "86", args: "--stack-yaml=stack8.6.yaml" } - - { key: "88", args: "--stack-yaml=stack.yaml" } - - { key: "810", args: "--stack-yaml=stack8.10.yaml" } - runs-on: ubuntu-latest + # - { ghc: "80", args: "--stack-yaml=stack8.0.yaml" } + - { ghc: "82", args: "--stack-yaml=stack8.2.yaml" } + # - { ghc: "84", args: "--stack-yaml=stack8.4.yaml" } + # - { ghc: "86", args: "--stack-yaml=stack8.6.yaml" } + # - { ghc: "88", args: "--stack-yaml=stack.yaml" } + # - { ghc: "810", args: "--stack-yaml=stack8.10.yaml" } steps: @@ -71,65 +74,58 @@ jobs: uses: actions/cache@v2 with: path: ~/.stack - key: ${{ runner.os }}-stack-global-${{ matrix.plan.key }}-${{ hashFiles('**.yaml') }} + key: ${{ runner.os }}-stack-global-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-stack-global-${{ matrix.plan.key }} - ${{ runner.os }}-stack-global + ${{ 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.key }}-${{ hashFiles('**.yaml') }} + key: ${{ runner.os }}-stack-programs-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-stack-programs-${{ matrix.plan.key }} - ${{ runner.os }}-stack-programs + ${{ 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.key }}-${{ hashFiles('**.yaml') }} + key: ${{ runner.os }}-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-stack-work-${{ matrix.plan.key }} - ${{ runner.os }}-stack-work + ${{ 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.key }}-${{ hashFiles('hledger-lib/package.yaml') }} + 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.key }} - ${{ runner.os }}-hledger-lib-stack-work + ${{ 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.key }}-${{ hashFiles('hledger/package.yaml') }} + key: ${{ runner.os }}-hledger-stack-work-${{ matrix.plan.ghc }}-${{ hashFiles('hledger/package.yaml') }} restore-keys: | - ${{ runner.os }}-hledger-stack-work-${{ matrix.plan.key }} - ${{ runner.os }}-hledger-stack-work + ${{ 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.key }}-${{ hashFiles('hledger-ui/package.yaml') }} + 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.key }} - ${{ runner.os }}-hledger-ui-stack-work + ${{ 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.key }}-${{ hashFiles('hledger-web/package.yaml') }} + 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.key }} - ${{ runner.os }}-hledger-web-stack-work + ${{ runner.os }}-hledger-web-stack-work-${{ matrix.plan.ghc }} # For now due to # https://github.com/actions/virtual-environments/issues/709 @@ -168,7 +164,6 @@ jobs: df -h stack $ARGS setup --install-ghc df -h - env: ARGS: ${{ matrix.plan.args }} diff --git a/.github/workflows/mac.yml b/.github/workflows/mac.yml index 83e8eef99..054dafa3a 100644 --- a/.github/workflows/mac.yml +++ b/.github/workflows/mac.yml @@ -1,7 +1,8 @@ -# Fairly thorough tests on mac. # Runs on notable pushes to ci-mac, and weekly on master. -# Builds all modules optimised, runs unit, doc, functional tests, -# and uploads binaries artifact. + +# Builds all modules optimised and runs unit/doc/functional tests on mac, +# using GHC 8.6, +# and uploads a binaries artifact. name: mac CI @@ -28,6 +29,17 @@ on: jobs: build: runs-on: macos-latest + strategy: + fail-fast: false + matrix: + plan: + # - { ghc: "80", args: "--stack-yaml=stack8.0.yaml" } + # - { ghc: "82", args: "--stack-yaml=stack8.2.yaml" } + # - { ghc: "84", args: "--stack-yaml=stack8.4.yaml" } + - { ghc: "86", args: "--stack-yaml=stack8.6.yaml" } + # - { ghc: "88", args: "--stack-yaml=stack.yaml" } + # - { ghc: "810", args: "--stack-yaml=stack8.10.yaml" } + steps: - name: Check out @@ -40,50 +52,58 @@ jobs: uses: actions/cache@v2 with: path: ~/.stack - key: ${{ runner.os }}-stack-global-${{ hashFiles('**.yaml') }} + key: ${{ runner.os }}-stack-global-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-stack-global - ${{ runner.os }}-stack + ${{ runner.os }}-stack-global - name: Cache stack-installed programs in ~/.local/bin id: stack-programs uses: actions/cache@v2 with: path: ~/.local/bin - key: ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }} + key: ${{ runner.os }}-stack-programs-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-stack-programs - ${{ runner.os }}-local-bin + ${{ runner.os }}-stack-programs - name: Cache .stack-work uses: actions/cache@v2 with: path: .stack-work - key: ${{ runner.os }}-stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} + restore-keys: | + ${{ runner.os }}-stack-work - name: Cache hledger-lib/.stack-work uses: actions/cache@v2 with: path: hledger-lib/.stack-work - key: ${{ runner.os }}-hledger-lib-stack-work + key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-lib-stack-work - name: Cache hledger/.stack-work uses: actions/cache@v2 with: path: hledger/.stack-work - key: ${{ runner.os }}-hledger-stack-work + key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-stack-work - name: Cache hledger-ui/.stack-work uses: actions/cache@v2 with: path: hledger-ui/.stack-work - key: ${{ runner.os }}-hledger-ui-stack-work + key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-ui-stack-work - name: Cache hledger-web/.stack-work uses: actions/cache@v2 with: path: hledger-web/.stack-work - key: ${{ runner.os }}-hledger-web-stack-work + key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-web-stack-work # actions: @@ -91,32 +111,44 @@ jobs: # curl --insecure -L https://get.haskellstack.org/stable/osx-x86_64.tar.gz | tar xz --strip-components=1 --include '*/stack' -C $INSTALLDIR run: | brew install haskell-stack - stack --version + stack $ARGS --version + env: + ARGS: ${{ matrix.plan.args }} - name: Install GHC run: | - stack setup --install-ghc + stack $ARGS setup --install-ghc + env: + ARGS: ${{ matrix.plan.args }} - name: Install haskell deps run: | - stack build --test --only-dependencies + stack $ARGS build --test --only-dependencies + env: + ARGS: ${{ matrix.plan.args }} - name: Build hledger and test unit tests, doc tests run: | - stack install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror + stack $ARGS install --test --force-dirty --ghc-options=-fforce-recomp --ghc-options=-Werror # --ghc-options=-split-sections doesn't work on mac # --pedantic + env: + ARGS: ${{ matrix.plan.args }} - name: Install shelltestrunner run: | export PATH=~/.local/bin:$PATH - if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.9; fi + if [[ ! -x ~/.local/bin/shelltest ]]; then stack $ARGS install shelltestrunner-1.9; fi shelltest --version + env: + ARGS: ${{ matrix.plan.args }} - name: Test functional tests (excluding addons) run: | export PATH=~/.local/bin:$PATH - COLUMNS=80 stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons + COLUMNS=80 stack $ARGS exec -- shelltest --execdir -j16 tests -x /bin -x /addons + env: + ARGS: ${{ matrix.plan.args }} # artifacts: diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index e591028f9..e55b25604 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -1,6 +1,7 @@ -# Quick tests on linux, minimising compute power and carbon emissions. # Runs on notable pushes to master. -# Builds incrementally and runs functional tests with one GHC version. + +# Builds incrementally and runs functional tests on linux, +# using the latest supported GHC version. name: push CI @@ -24,6 +25,17 @@ on: jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + plan: + # - { ghc: "80", args: "--stack-yaml=stack8.0.yaml" } + # - { ghc: "82", args: "--stack-yaml=stack8.2.yaml" } + # - { ghc: "84", args: "--stack-yaml=stack8.4.yaml" } + # - { ghc: "86", args: "--stack-yaml=stack8.6.yaml" } + # - { ghc: "88", args: "--stack-yaml=stack.yaml" } + - { ghc: "810", args: "--stack-yaml=stack8.10.yaml" } + steps: - name: Check out @@ -51,55 +63,58 @@ jobs: uses: actions/cache@v2 with: path: ~/.stack - key: ${{ runner.os }}-stack-global-${{ hashFiles('**.yaml') }} + key: ${{ runner.os }}-stack-global-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-stack-global - ${{ runner.os }}-stack + ${{ 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-${{ hashFiles('**.yaml') }} + key: ${{ runner.os }}-stack-programs-${{ matrix.plan.ghc }}-${{ hashFiles('**.yaml') }} restore-keys: | - ${{ runner.os }}-stack-programs - ${{ runner.os }}-local-bin + ${{ runner.os }}-stack-programs-${{ matrix.plan.ghc }} - name: Cache .stack-work uses: actions/cache@v2 with: path: .stack-work - key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} - restore-keys: ${{ runner.os }}-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-${{ hashFiles('hledger-lib/package.yaml') }} - restore-keys: ${{ runner.os }}-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-${{ hashFiles('hledger/package.yaml') }} - restore-keys: ${{ runner.os }}-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-${{ hashFiles('hledger-ui/package.yaml') }} - restore-keys: ${{ runner.os }}-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-${{ hashFiles('hledger-web/package.yaml') }} - restore-keys: ${{ runner.os }}-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: @@ -109,29 +124,39 @@ jobs: # export PATH=~/.local/bin:$PATH # if [[ ! -x ~/.local/bin/stack ]]; then curl -L https://www.stackage.org/stack/linux-x86_64 | tar xz --wildcards --strip-components=1 -C ~/.local/bin '*/stack'; chmod a+x ~/.local/bin/stack; fi run: | - stack --version + stack $ARGS --version - name: Install GHC run: | - stack setup --install-ghc + stack $ARGS setup --install-ghc + env: + ARGS: ${{ matrix.plan.args }} - name: Install haskell deps run: | - stack build --only-dependencies + stack $ARGS build --only-dependencies + env: + ARGS: ${{ matrix.plan.args }} - name: Build hledger fast run: | - stack build --fast --ghc-options=-Werror + stack $ARGS build --fast --ghc-options=-Werror # --ghc-options=-fforce-recomp # needed occasionally to clear out stale compiled modules # --pedantic + env: + ARGS: ${{ matrix.plan.args }} - name: Install shelltestrunner run: | export PATH=~/.local/bin:$PATH - if [[ ! -x ~/.local/bin/shelltest ]]; then stack install shelltestrunner-1.9; fi + if [[ ! -x ~/.local/bin/shelltest ]]; then stack $ARGS install shelltestrunner-1.9; fi shelltest --version + env: + ARGS: ${{ matrix.plan.args }} - name: Test functional tests (excluding addons) run: | export PATH=~/.local/bin:$PATH - COLUMNS=80 stack exec -- shelltest --execdir -j16 tests -x /bin -x /addons + COLUMNS=80 stack $ARGS exec -- shelltest --execdir -j16 tests -x /bin -x /addons + env: + ARGS: ${{ matrix.plan.args }} diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index ed9d6e555..d8d31fbfb 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,12 +1,8 @@ -# Fairly thorough tests on windows. # Runs on notable pushes to ci-windows, and weekly on master. -# Builds all modules optimised, runs unit, doc tests, -# and uploads binaries artifact. -# Light Windows CI tests: build and run functional tests with one GHC version. -# GHC 8.8.2 for now to avoid https://gitlab.haskell.org/ghc/ghc/issues/17926. -# -# Runs: periodically on master, and on notable push to ci-windows. +# Builds all modules optimised on windows, +# using GHC 8.8.2 to avoid https://gitlab.haskell.org/ghc/ghc/issues/17926, +# and uploads a binaries artifact. name: windows CI @@ -45,8 +41,9 @@ jobs: uses: actions/cache@v2 with: path: C:\Users\runneradmin\AppData\Roaming\stack\ - key: ${{ runner.os }}-appdata-roaming-stack-${{ hashFiles('**.yaml') }} - restore-keys: ${{ runner.os }}-appdata-roaming-stack + key: ${{ runner.os }}-appdata-roaming-stack-${{ hashFiles('**.yaml') }} + restore-keys: | + ${{ runner.os }}-appdata-roaming-stack - name: Cache stack programs dir # ghc, ghc-included packages and their haddocks, mingw, msys2 id: stack-programs-dir @@ -55,43 +52,49 @@ jobs: path: C:\Users\runneradmin\AppData\Local\Programs\stack\ # 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 - key: ${{ runner.os }}-appdata-local-programs-stack-${{ hashFiles('**.yaml') }} - restore-keys: ${{ runner.os }}-appdata-local-programs-stack + key: ${{ runner.os }}-appdata-local-programs-stack-${{ hashFiles('**.yaml') }} + restore-keys: | + ${{ runner.os }}-appdata-local-programs-stack - name: Cache .stack-work uses: actions/cache@v2 with: path: .stack-work - key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} - restore-keys: ${{ runner.os }}-stack-work + key: ${{ runner.os }}-stack-work-${{ hashFiles('**.yaml') }} + restore-keys: | + ${{ runner.os }}-stack-work - name: Cache hledger-lib/.stack-work uses: actions/cache@v2 with: path: hledger-lib/.stack-work - key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }} - restore-keys: ${{ runner.os }}-hledger-lib-stack-work + key: ${{ runner.os }}-hledger-lib-stack-work-${{ hashFiles('hledger-lib/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-lib-stack-work - name: Cache hledger/.stack-work uses: actions/cache@v2 with: path: hledger/.stack-work - key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }} - restore-keys: ${{ runner.os }}-hledger-stack-work + key: ${{ runner.os }}-hledger-stack-work-${{ hashFiles('hledger/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-stack-work - name: Cache hledger-ui/.stack-work uses: actions/cache@v2 with: path: hledger-ui/.stack-work - key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }} - restore-keys: ${{ runner.os }}-hledger-ui-stack-work + key: ${{ runner.os }}-hledger-ui-stack-work-${{ hashFiles('hledger-ui/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-ui-stack-work - name: Cache hledger-web/.stack-work uses: actions/cache@v2 with: path: hledger-web/.stack-work - key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }} - restore-keys: ${{ runner.os }}-hledger-web-stack-work + key: ${{ runner.os }}-hledger-web-stack-work-${{ hashFiles('hledger-web/package.yaml') }} + restore-keys: | + ${{ runner.os }}-hledger-web-stack-work # - name: showStuff # shell: bash