Skip to content

Commit

Permalink
Initial repo setup
Browse files Browse the repository at this point in the history
  • Loading branch information
jorisdral committed Aug 22, 2023
1 parent 8ffe622 commit 25e039c
Show file tree
Hide file tree
Showing 19 changed files with 960 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Note: later rules override earlier rules.

# Default
### TODO: add @phadej
* @dcoutts @jorisdral
7 changes: 7 additions & 0 deletions .github/workflows/cabal.project.local.haskell
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ignore-project: False

tests: True
benchmarks: True

program-options
ghc-options: -Werror
221 changes: 221 additions & 0 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,221 @@
name: Haskell CI

on:
push:
branches: [ "main" ]
pull_request:
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true


permissions:
contents: read

jobs:
# Build and test
build:

runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
ghc: ["8.10.7", "9.2.8", "9.6.2"]
cabal: ["3.10.1.0"]
os: [ubuntu-latest, windows-latest, macOS-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Haskell
id: setup-haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: false

- name: "Configure cabal.project.local"
run: |
cp .github/workflows/cabal.project.local.haskell cabal.project.local
- name: Cabal update
run: cabal update

- name: Record cabal dependencies
id: record-deps
run: |
cabal build all --dry-run
- name: Cache cabal store
uses: actions/cache@v3
env:
cache-name: cache-cabal-build
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
- name: Install cabal dependencies
run: cabal build --only-dependencies --enable-tests --enable-benchmarks all

- name: Build
run: cabal build --enable-tests --enable-benchmarks all

- name: Run tests
run: cabal test all

# Check formatting for Haskell files
stylish-haskell:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
ghc: ["9.2.8"]
cabal: ["3.10.1.0"]
os: [ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install system dependencies (apt-get)
run: |
sudo apt-get update
sudo apt-get -y install fd-find
- name: Setup Haskell
id: setup-haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: false

- name: Cabal update
run: cabal update

- name: Setup cabal bin path
run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH

- name: Cache cabal store
uses: actions/cache@v3
env:
cache-name: cache-cabal-stylish
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
- name: Install stylish-haskell
run: cabal install stylish-haskell --constraint 'stylish-haskell == 0.14.4.0'

- name: Record stylish-haskell version
run: |
which stylish-haskell
stylish-haskell --version
- name: Run stylish-haskell
run: |
./scripts/format-stylish.sh -p . -d
git diff --exit-code
# Check formatting for cabal files
cabal-fmt:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
ghc: ["9.2.8"]
cabal: ["3.10.1.0"]
os: [ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Install system dependencies (apt-get)
run: |
sudo apt-get update
sudo apt-get -y install fd-find
- name: Setup Haskell
id: setup-haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: false

- name: Cabal update
run: cabal update

- name: Setup cabal bin path
run: echo "$HOME/.cabal/bin" >> $GITHUB_PATH

- name: Cache cabal store
uses: actions/cache@v3
env:
cache-name: cache-cabal-cabal-fmt
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
restore-keys: |
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
- name: Install cabal-fmt
run: cabal install cabal-fmt --constraint 'cabal-fmt == 0.1.7'

- name: Record cabal-fmt version
run: |
which cabal-fmt
cabal-fmt --version
- name: Run cabal-fmt
run: |
./scripts/format-cabal.sh
git diff --exit-code
# Check cabal files
cabal-check:
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
ghc: ["9.6.2"]
cabal: ["3.10.1.0"]
os: [ubuntu-latest]

steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Setup Haskell
id: setup-haskell
uses: haskell/actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: ${{ matrix.cabal }}
cabal-update: false

- name: Cabal update
run: cabal update

- name: Run cabal check
run: |
./scripts/check-cabal.sh
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Haskell / GHC
dist
dist-*
cabal-dev
Expand All @@ -21,3 +22,6 @@ cabal.project.local
cabal.project.local~
.HTF/
.ghc.environment.*

# Visual Studio Code
/.vscode
Loading

0 comments on commit 25e039c

Please sign in to comment.