Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
61 changes: 58 additions & 3 deletions .github/workflows/haskell.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ on:
pull_request:

jobs:
build:
lint-and-format:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: 'Set up HLint'
uses: haskell-actions/hlint-setup@v2
Expand All @@ -29,8 +29,15 @@ jobs:
with:
version: "latest"

build-with-stack:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache Stack and binaries
uses: actions/cache@v3
uses: actions/cache@v4.2.3
with:
path: |
~/.stack
Expand All @@ -43,5 +50,53 @@ jobs:
- name: Build project
run: stack build --fast --ghc-options="-Werror"

- name: Check that .cabal file has not changed except hpack comment
run: |
CABAL_FILE=jbeam-edit.cabal
TMP_DIR=$(mktemp -d)
git show HEAD:$CABAL_FILE > $TMP_DIR/committed.cabal
cp $CABAL_FILE $TMP_DIR/current.cabal
tail -n +2 $TMP_DIR/committed.cabal > $TMP_DIR/committed_trimmed.cabal
tail -n +2 $TMP_DIR/current.cabal > $TMP_DIR/current_trimmed.cabal

if ! diff -q $TMP_DIR/committed_trimmed.cabal $TMP_DIR/current_trimmed.cabal > /dev/null; then
echo "Error: .cabal file has changed beyond the expected hpack comment line."
echo "Please commit the updated .cabal file if this is intentional."
exit 1
else
echo ".cabal file is unchanged except for the first comment line."
fi

- name: Run tests
run: stack test --fast

build-with-cabal:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Cache GHC, Cabal, and build artifacts
uses: actions/cache@v4.2.3
with:
path: |
/usr/local/.ghcup
~/.cabal
dist-newstyle
key: ${{ runner.os }}-cabal-ghc947-${{ hashFiles('**/package.yaml') }}
restore-keys: |
${{ runner.os }}-cabal-ghc947-

- name: Set up GHC and Cabal (GHC 9.4.7)
uses: haskell-actions/setup@v2.8.0
with:
ghc-version: 9.4.7
cabal-version: latest
cabal-update: true

- name: Build project
run: cabal build --ghc-options="-Werror"

- name: Run tests
run: cabal test --test-show-details=direct
22 changes: 22 additions & 0 deletions hie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
cradle:
multi:
- path: "./Setup.hs"
config:
cradle:
direct:
arguments: ["Setup.hs"]
- path: "./src"
config:
cradle:
cabal:
component: "lib:jbeam-edit"
- path: "./app"
config:
cradle:
cabal:
component: "exe:jbeam-edit-exe"
- path: "./test"
config:
cradle:
cabal:
component: "test:jbeam-edit-test"
5 changes: 5 additions & 0 deletions jbeam-edit.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ library
base >=4.7 && <5
, bytestring
, containers
, foldable1-classes-compat
, megaparsec
, scientific
, text
Expand All @@ -71,6 +72,7 @@ executable jbeam-edit-exe
base >=4.7 && <5
, bytestring
, containers
, foldable1-classes-compat
, jbeam-edit
, megaparsec
, scientific
Expand All @@ -97,11 +99,14 @@ test-suite jbeam-edit-test
base >=4.7 && <5
, bytestring
, containers
, foldable1-classes-compat
, hspec
, hspec-megaparsec
, jbeam-edit
, megaparsec
, scientific
, text
, vector
build-tool-depends:
hspec-discover:hspec-discover
default-language: Haskell2010
3 changes: 3 additions & 0 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ dependencies:
- megaparsec
- text
- scientific
- foldable1-classes-compat

default-extensions:
- OverloadedStrings
Expand Down Expand Up @@ -69,3 +70,5 @@ tests:
- jbeam-edit
- hspec
- hspec-megaparsec
build-tools:
- hspec-discover
2 changes: 1 addition & 1 deletion stack.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#
# snapshot: ./custom-snapshot.yaml
# snapshot: https://example.com/snapshots/2024-01-01.yaml
snapshot: lts-23.23
snapshot: lts-23.24

# User packages to be built.
# Various formats can be used as shown in the example below.
Expand Down
10 changes: 5 additions & 5 deletions stack.yaml.lock
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# This file was autogenerated by Stack.
# You should not edit this file by hand.
# For more information, please see the documentation at:
# https://docs.haskellstack.org/en/stable/lock_files
# https://docs.haskellstack.org/en/stable/topics/lock_files

packages: []
snapshots:
- completed:
sha256: 5e44cb81460cd2f90011ab6868958d58bde10f63babf4847a56118450b51221e
size: 683836
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/23.yaml
original: lts-23.23
sha256: 400dfb2174640dd2f9f2ba7cbf9148699f2380ab64faa46f4be298a5d6205316
size: 684057
url: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/23/24.yaml
original: lts-23.24