Skip to content

screened 2024-06-02 21:37:57+00:00 #647

screened 2024-06-02 21:37:57+00:00

screened 2024-06-02 21:37:57+00:00 #647

name: Build and Test
on: push
jobs:
build-with-cabal:
name: ${{ matrix.os }} / ghc-${{ matrix.ghc }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
# - ubuntu-20.04
- ubuntu-22.04
# - macos-11
# - macos-12
- macos-13
# - windows-2019
- windows-2022
ghc:
- 8.4.4
- 8.6.5
- 8.8.2
- 8.10.7
- 9.0.2
- 9.2.8
- 9.4.8
- 9.6.4
- 9.8.2
- 9.10.1
cabal:
- '3.10'
env:
builddocs: ${{ matrix.ghc == '9.4.5' }}
runtests: ${{ matrix.ghc == '8.4.4' || matrix.ghc == '9.10.1' }}
tests-to-run: # e.g. -t=EXAMPLE
testcmd: cabal run -- darcs-test -j=6 -f=123 -i=yn -c=yn --hide
ACTIONS_ALLOW_UNSECURE_COMMANDS: true
# avoid occasional timeouts in test scripts that access darcs.net:
DARCS_CONNECTION_TIMEOUT: 15
steps:
- name: Configure git
if: runner.os == 'Windows'
run: git config --global core.autocrlf input
- name: Checkout
uses: actions/checkout@v4
- name: Setup Haskell
id: setup-haskell-cabal
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
- name: Configure
run: cabal configure --enable-tests -fwarn-as-error
- name: Cabal freeze
run: cabal freeze
- name: Restore cabal store from cache
id: restore-cabal-store
uses: actions/cache/restore@v4
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: cabal-store-${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
restore-keys: cabal-store-${{ matrix.os }}-ghc-${{ matrix.ghc }}-
- name: Build dependencies (with docs)
if: env.builddocs == 'true'
run: cabal build --only-dependencies --enable-documentation
- name: Build dependencies (without docs)
if: env.builddocs == 'false'
run: cabal build --only-dependencies --disable-documentation
- name: Save cabal store to cache
if: steps.restore-cabal-store.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }}
key: cabal-store-${{ matrix.os }}-ghc-${{ matrix.ghc }}-${{ hashFiles('cabal.project.freeze') }}
- name: Build
run: cabal build
- name: Haddock
if: env.builddocs == 'true'
run: cabal haddock lib:darcs
- name: Run tests on Linux
if: runner.os == 'Linux' && env.runtests == 'true'
run: |
sudo apt-get install lighttpd
${{ env.testcmd }} ${{ env.tests-to-run }}
- name: Run tests on MacOS
if: runner.os == 'macos' && env.runtests == 'true'
run: |
brew install lighttpd
brew install gnu-sed
PATH="$(brew --prefix)/opt/gnu-sed/libexec/gnubin:$PATH"
${{ env.testcmd }} ${{ env.tests-to-run }}
- name: Run tests on Windows
if: runner.os == 'Windows' && env.runtests == 'true'
# running the tests for all three patch formats takes over an hour
run: cabal run -- darcs-test -j=6 -f=2 -s=sn -i=yn ${{ env.tests-to-run }} --hide