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
82 changes: 33 additions & 49 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
name: build
on: [push]
name: haskell-ci

# INFO: The following configuration block ensures that only one build runs per branch,
# which may be desirable for projects with a costly build process.
# Remove this block from the CI workflow to let each CI job run to completion.
concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

jobs:
hlint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: haskell-actions/hlint-setup@v2
- uses: haskell-actions/hlint-run@v2
with:
Expand All @@ -13,94 +21,70 @@ jobs:
ormolu:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: haskell-actions/run-ormolu@v14

cabal:
- uses: actions/checkout@v4
- uses: haskell-actions/run-ormolu@v16
build:
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc-version: ['9.6', '9.4', '9.2', '8.10']
docspec: [false]
experimental: [false]
ghc-version: ['9.10', '9.8', '9.6']

include:
- os: windows-latest
ghc-version: '9.6'
ghc-version: '9.8'
- os: macos-latest
ghc-version: '9.6'
- os: ubuntu-latest
ghc-version: '9.6'
docspec: true
experimental: true
name: docspec
ghc-version: '9.8'

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up GHC ${{ matrix.ghc-version }}
uses: haskell/actions/setup@v2
uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc-version }}

- name: Installed minor versions of GHC and Cabal
shell: bash
run: |
GHC_VERSION=$(ghc --numeric-version)
CABAL_VERSION=$(cabal --numeric-version)
echo "GHC_VERSION=${GHC_VERSION}" >> "${GITHUB_ENV}"
echo "CABAL_VERSION=${CABAL_VERSION}" >> "${GITHUB_ENV}"

- name: Configure the build
run: |
cabal configure --enable-tests --enable-benchmarks --disable-documentation
cabal build --dry-run
# The last step generates dist-newstyle/cache/plan.json for the cache key.

- name: Restore cached dependencies
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ steps.setup.outputs.ghc-version }}-cabal-${{ steps.setup.outputs.cabal-version }}
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-cabal-${{ env.CABAL_VERSION }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: |
${{ runner.os }}-ghc-${{ env.GHC_VERSION }}-cabal-${{ env.CABAL_VERSION }}-
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-

- name: Install dependencies
# If we had an exact cache hit, the dependencies will be up to date.
if: steps.cache.outputs.cache-hit != 'true'
run: cabal build all --only-dependencies

# Cache dependencies already here, so that we do not have to rebuild them should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v3
# Caches are immutable, trying to save with the same key would error.
if: ${{ !steps.cache.outputs.cache-hit
|| steps.cache.outputs.cache-primary-key != steps.cache.outputs.cache-matched-key }}
uses: actions/cache/save@v4
# If we had an exact cache hit, trying to save the cache would error because of key clash.
if: steps.cache.outputs.cache-hit != 'true'
with:
path: ${{ steps.setup.outputs.cabal-store }}
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Build
run: cabal build all

- name: Run tests
run: cabal test all
- if: ${{ matrix.os == 'ubuntu-latest' && matrix.ghc-version == '9.8'}}
name: doctests
run: |
cabal run doctests
cabal run markup-parse-diff

- name: Check cabal file
run: cabal check

- if: matrix.docspec
name: cabal-docspec
run: |
mkdir -p $HOME/.cabal/bin
echo "$HOME/.cabal/bin" >> $GITHUB_PATH
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20230406/cabal-docspec-0.0.0.20230406-x86_64-linux.xz > cabal-docspec.xz
echo '68fa9addd5dc453d533a74a763950499d4593b1297c9a05c3ea5bd1acc04c9dd cabal-docspec.xz' | sha256sum -c -
xz -d < cabal-docspec.xz > $HOME/.cabal/bin/cabal-docspec
rm -f cabal-docspec.xz
chmod a+x $HOME/.cabal/bin/cabal-docspec
$HOME/.cabal/bin/cabal-docspec --version
cabal-docspec
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ cabal.project.local*
/.hie/
.ghc.environment.*
/.hkgr/
/checklist.org
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
packages: markup-parse.cabal

write-ghc-environment-files: always
81 changes: 20 additions & 61 deletions markup-parse.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 3.0
name: markup-parse
version: 0.1.1
version: 0.1.1.1
license: BSD-3-Clause
license-file: LICENSE
copyright: Copyright, Tony Day, 2023-
Expand All @@ -13,12 +13,15 @@ synopsis: A markup parser.
description:
A markup parser and printer, from and to strict bytestrings, optimised for speed.
build-type: Simple
tested-with: GHC == 9.6.2
tested-with:
, GHC == 9.10.1
, GHC == 9.6.5
, GHC == 9.8.2
extra-doc-files:
ChangeLog.md
other/*.html
other/*.svg
readme.org
readme.md

source-repository head
type: git
Expand All @@ -40,69 +43,16 @@ common ghc-options-stanza
-Wredundant-constraints

common ghc2021-stanza
if impl ( ghc >= 9.2 )
default-language: GHC2021

if impl ( ghc < 9.2 )
default-language: Haskell2010
default-extensions:
BangPatterns
BinaryLiterals
ConstrainedClassMethods
ConstraintKinds
DeriveDataTypeable
DeriveFoldable
DeriveFunctor
DeriveGeneric
DeriveLift
DeriveTraversable
DoAndIfThenElse
EmptyCase
EmptyDataDecls
EmptyDataDeriving
ExistentialQuantification
ExplicitForAll
FlexibleContexts
FlexibleInstances
ForeignFunctionInterface
GADTSyntax
GeneralisedNewtypeDeriving
HexFloatLiterals
ImplicitPrelude
InstanceSigs
KindSignatures
MonomorphismRestriction
MultiParamTypeClasses
NamedFieldPuns
NamedWildCards
NumericUnderscores
PatternGuards
PolyKinds
PostfixOperators
RankNTypes
RelaxedPolyRec
ScopedTypeVariables
StandaloneDeriving
StarIsType
TraditionalRecordSyntax
TupleSections
TypeApplications
TypeOperators
TypeSynonymInstances

if impl ( ghc < 9.2 ) && impl ( ghc >= 8.10 )
default-extensions:
ImportQualifiedPost
StandaloneKindSignatures
default-language: GHC2021

library
import: ghc-options-stanza
import: ghc2021-stanza
hs-source-dirs: src
build-depends:
, base >=4.7 && <5
, base >=4.14 && <5
, bytestring >=0.11.3 && <0.13
, containers >=0.6 && <0.7
, containers >=0.6 && <0.8
, deepseq >=1.4.4 && <1.6
, flatparse >=0.3.5 && <0.6
, string-interpolate >=0.3 && <0.4
Expand All @@ -115,19 +65,28 @@ library
MarkupParse.FlatParse
MarkupParse.Patch

test-suite doctests
import: ghc2021-stanza
main-is: doctests.hs
hs-source-dirs: test
build-depends:
, base >=4.14 && <5
, doctest-parallel >=0.3 && <0.4
ghc-options: -threaded
type: exitcode-stdio-1.0

test-suite markup-parse-diff
import: ghc-options-exe-stanza
import: ghc-options-stanza
import: ghc2021-stanza
main-is: diff.hs
hs-source-dirs: app
build-depends:
, base >=4.7 && <5
, base >=4.14 && <5
, bytestring >=0.11.3 && <0.13
, markup-parse
, string-interpolate >=0.3 && <0.4
, tasty >=1.2 && <1.6
, tasty-golden >=2.3.1.1 && <2.4
, tree-diff >=0.3 && <0.4
type: exitcode-stdio-1.0

File renamed without changes.
Loading