Fix #241: Create devcontainer.json
to enable GitHub CodeSpaces
#1470
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Haskell CI | |
on: | |
pull_request: | |
branches: [ "**" ] | |
jobs: | |
whitespace: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Trailing whitespace check | |
if: matrix.os != 'windows-latest' | |
run: | | |
offenders="$(git grep "\s$" -- *.hs *.c *.h *.nix *.yml *.md || true)"; | |
if [ -n "${offenders}" ]; then | |
echo -e "Fix trailing whitespace in:\n" | |
echo -n "${offenders}" | |
exit 1 | |
fi | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
ghc: ["8.10.7", "9.2.7", "9.6.2"] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
env: | |
# Modify this value to "invalidate" the cabal cache. | |
CABAL_CACHE_VERSION: "2023-04-27" | |
steps: | |
- name: Install Haskell | |
uses: input-output-hk/actions/haskell@latest | |
id: setup-haskell | |
with: | |
ghc-version: ${{ matrix.ghc }} | |
cabal-version: 3.10.1.0 | |
- name: Install system dependencies | |
uses: input-output-hk/actions/base@latest | |
with: | |
use-sodium-vrf: false # default is true | |
- uses: actions/checkout@v3 | |
- name: Cabal update | |
run: cabal update | |
- name: Configure build | |
shell: bash | |
run: | | |
cp ".github/workflows/cabal.project.local.ci.$(uname -s)" cabal.project.local | |
echo "# cabal.project.local" | |
cat cabal.project.local | |
- name: Record dependencies | |
id: record-deps | |
run: | | |
# The tests call out to msys2 commands. We generally do not want to mix toolchains, so | |
# we are very deliberate about only adding msys64 to the path where absolutely necessary. | |
${{ (runner.os == 'Windows' && '$env:PATH=("C:\msys64\mingw64\bin;{0}" -f $env:PATH)') || '' }} | |
cabal build all --dry-run | |
cat dist-newstyle/cache/plan.json | jq -r '."install-plan"[].id' | sort | uniq > dependencies.txt | |
- name: Cache Cabal store | |
uses: actions/cache@v3 | |
with: | |
path: | | |
${{ steps.setup-haskell.outputs.cabal-store }} | |
dist-newstyle | |
key: cache-${{ env.CABAL_CACHE_VERSION }}-${{ runner.os }}-${{ matrix.ghc }}-${{ hashFiles('dependencies.txt') }} | |
- name: Install dependencies | |
run: cabal build all --enable-tests --only-dependencies -j --ghc-option=-j4 | |
- name: Build [testing] | |
run: cabal build all --enable-tests -j --ghc-option=-j4 | |
- name: Run tests | |
env: | |
# these two are msys2 env vars, they have no effect on non-msys2 installs. | |
MSYS2_PATH_TYPE: inherit | |
MSYSTEM: MINGW64 | |
run: cabal test all --enable-tests --test-show-details=direct -j1 | |
- name: Build strict-checked-vars with invariants | |
run: cabal build -f+checktvarinvariants -f+checkmvarinvariants strict-checked-vars | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: Build & test logs | |
path: | | |
dist-newstyle/**/*.log | |
# - name: Run benchmarks | |
# run: cabal bench all --enable-tests | |
# Uncomment the following back in for debugging. Remember to launch a `pwsh` from | |
# the tmux session to debug `pwsh` issues. And be reminded that the `/msys2` and | |
# `/msys2/mingw64` paths are not in PATH by default for the workflow, but tmate | |
# will put them in. | |
# You may also want to run | |
# | |
# $env:PATH=("C:\Program Files\PowerShell\7;{0}" -f $env:ORIGINAL_PATH) | |
# | |
# to restore the original path. Do note that some test might need msys2 | |
# and will silently fail if msys2 is not in path. See the "Run tests" step. | |
# | |
# - name: Setup tmate session | |
# if: ${{ failure() }} | |
# uses: mxschmitt/action-tmate@v3 | |
# with: | |
# limit-access-to-actor: true |