Skip to content

Commit

Permalink
Use diff-package-api Workflow (#72)
Browse files Browse the repository at this point in the history
* Use diff-package-api Workflow

* Use newer version of the action

* Build docs before package

* Reorganise the project files

* Use new version

* Name the interface file with the GHC version

* update action version
  • Loading branch information
Kleidukos authored Jul 21, 2024
1 parent 98d14b8 commit b01258e
Show file tree
Hide file tree
Showing 9 changed files with 390 additions and 13 deletions.
20 changes: 15 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,27 @@ jobs:
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 'latest'
- name: Configure
run: cabal configure --enable-tests
- name: Freeze
run: cabal freeze
run: cabal freeze --project-file=cabal.ci.project
- name: Cache
uses: actions/cache@v4.0.2
with:
path: ${{ steps.setup-haskell.outputs.cabal-store }}
key: ${{ runner.os }}-ghc-${{ matrix.ghc }}-cabal-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ runner.os }}-ghc-${{ matrix.ghc }}-
- name: Setup mdBook
uses: peaceiris/actions-mdbook@v2
with:
mdbook-version: '0.4.40'
- run: make docs
- name: Build
run: cabal new-build
run: cabal build --project-file=cabal.ci.project --write-ghc-environment-files=always
- name: Test
run: cabal new-test all
run: cabal test --project-file=cabal.ci.project all
- name: API Golden tests
uses: kleidukos/diff-package-api@v0.1.0.1
with:
package-name: text-display
expected-interface: test/package-api-${{ matrix.ghc }}.txt
ghc: ${{ matrix.ghc }}
version: 0.1.0.1
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
deps: ## Install the dependencies of the backend
@cabal build --only-dependencies

docs: ## Run mdbook
@cd doc ; mdbook build

build: ## Build the project in fast mode
@cabal build

Expand Down
7 changes: 7 additions & 0 deletions cabal.ci.project
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import: ./cabal.project

tests: True

flags: +book

documentation: False
2 changes: 0 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,5 @@ flags: -book

documentation: True

test-show-details: direct

package *
ghc-options: -haddock
6 changes: 1 addition & 5 deletions cabal.project.release → cabal.release.project
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
packages: ./
import: ./cabal.project

tests: True

flags: +book

documentation: True

test-show-details: direct
119 changes: 119 additions & 0 deletions test/package-api-9.10.1.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,119 @@

module Data.Text.Display where
type Display :: * -> Constraint
class Display a where
displayBuilder :: a -> Data.Text.Internal.Builder.Builder
displayList :: [a] -> Data.Text.Internal.Builder.Builder
displayPrec :: GHC.Types.Int -> a -> Data.Text.Internal.Builder.Builder
{-# MINIMAL displayBuilder | displayPrec #-}
type role OpaqueInstance phantom representational
type OpaqueInstance :: GHC.Types.Symbol -> * -> *
newtype OpaqueInstance str a = Opaque a
type RecordInstance :: * -> *
newtype RecordInstance a = RecordInstance {unDisplayProduct :: a}
type ShowInstance :: * -> *
newtype ShowInstance a = ShowInstance a
display :: forall a. Display a => a -> Data.Text.Internal.Text
displayParen :: GHC.Types.Bool -> Data.Text.Internal.Builder.Builder -> Data.Text.Internal.Builder.Builder

module Data.Text.Display.Core where
type CannotDisplayBareFunctions :: Constraint
type family CannotDisplayBareFunctions where
CannotDisplayBareFunctions = (TypeError ...)
type CannotDisplayByteStrings :: Constraint
type family CannotDisplayByteStrings where
CannotDisplayByteStrings = (TypeError ...)
type Display :: * -> Constraint
class Display a where
displayBuilder :: a -> Data.Text.Internal.Builder.Builder
displayList :: [a] -> Data.Text.Internal.Builder.Builder
displayPrec :: GHC.Types.Int -> a -> Data.Text.Internal.Builder.Builder
{-# MINIMAL displayBuilder | displayPrec #-}
type DisplayDecimal :: * -> *
newtype DisplayDecimal e = DisplayDecimal e
type DisplayRealFloat :: * -> *
newtype DisplayRealFloat e = DisplayRealFloat e
type role OpaqueInstance phantom representational
type OpaqueInstance :: GHC.Types.Symbol -> * -> *
newtype OpaqueInstance str a = Opaque a
type ShowInstance :: * -> *
newtype ShowInstance a = ShowInstance a
display :: forall a. Display a => a -> Data.Text.Internal.Text
displayParen :: GHC.Types.Bool -> Data.Text.Internal.Builder.Builder -> Data.Text.Internal.Builder.Builder

module Data.Text.Display.Generic where
type Assert :: GHC.Types.Bool -> GHC.Internal.TypeError.ErrorMessage -> Constraint
class Assert pred msg
{-# MINIMAL #-}
type AssertNoSumRecordInstance :: (* -> Constraint) -> * -> Constraint
type AssertNoSumRecordInstance constraint a = Assert (GHC.Internal.Data.Type.Bool.Not (HasSum (GHC.Internal.Generics.Rep a))) (((((GHC.Internal.TypeError.Text "\128683 Cannot derive " GHC.Internal.TypeError.:<>: GHC.Internal.TypeError.ShowType constraint) GHC.Internal.TypeError.:<>: GHC.Internal.TypeError.Text " instance for ") GHC.Internal.TypeError.:<>: GHC.Internal.TypeError.ShowType a) GHC.Internal.TypeError.:<>: GHC.Internal.TypeError.Text " via RecordInstance due to sum type") GHC.Internal.TypeError.:$$: GHC.Internal.TypeError.Text "\128161 Sum types should use a manual instance or derive one via ShowInstance.") :: Constraint
type GDisplay1 :: (* -> *) -> Constraint
class GDisplay1 f where
gdisplayBuilder1 :: forall p. f p -> Data.Text.Internal.Builder.Builder
{-# MINIMAL gdisplayBuilder1 #-}
type HasSum :: (* -> *) -> GHC.Types.Bool
type family HasSum f where
HasSum GHC.Internal.Generics.V1 = GHC.Types.False
HasSum GHC.Internal.Generics.U1 = GHC.Types.False
forall i c. HasSum (GHC.Internal.Generics.K1 i c) = GHC.Types.False
forall i (c :: GHC.Internal.Generics.Meta) (f :: * -> *). HasSum (GHC.Internal.Generics.M1 i c f) = HasSum f
forall (f :: * -> *) (g :: * -> *). HasSum (f GHC.Internal.Generics.:*: g) = HasSum f GHC.Internal.Data.Type.Bool.|| HasSum g
forall (f :: * -> *) (g :: * -> *). HasSum (f GHC.Internal.Generics.:+: g) = GHC.Types.True
type RecordInstance :: * -> *
newtype RecordInstance a = RecordInstance {unDisplayProduct :: a}
gdisplayBuilderDefault :: forall a. (GHC.Internal.Generics.Generic a, GDisplay1 (GHC.Internal.Generics.Rep a)) => a -> Data.Text.Internal.Builder.Builder


-- Instances:
instance forall e. GHC.Internal.Enum.Enum e => GHC.Internal.Enum.Enum (Data.Text.Display.Core.DisplayDecimal e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Float.Floating e => GHC.Internal.Float.Floating (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Float.RealFloat e => GHC.Internal.Float.RealFloat (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance forall a. GHC.Internal.Generics.Generic a => GHC.Internal.Generics.Generic (Data.Text.Display.Generic.RecordInstance a) -- Defined in ‘Data.Text.Display.Generic’
instance forall e. GHC.Internal.Num.Num e => GHC.Internal.Num.Num (Data.Text.Display.Core.DisplayDecimal e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Num.Num e => GHC.Internal.Num.Num (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Real.Fractional e => GHC.Internal.Real.Fractional (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Real.Integral e => GHC.Internal.Real.Integral (Data.Text.Display.Core.DisplayDecimal e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Real.Real e => GHC.Internal.Real.Real (Data.Text.Display.Core.DisplayDecimal e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Real.Real e => GHC.Internal.Real.Real (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Real.RealFrac e => GHC.Internal.Real.RealFrac (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance forall a. GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Data.Text.Display.Core.ShowInstance a) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Classes.Eq e => GHC.Classes.Eq (Data.Text.Display.Core.DisplayDecimal e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Classes.Eq e => GHC.Classes.Eq (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Classes.Ord e => GHC.Classes.Ord (Data.Text.Display.Core.DisplayDecimal e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Classes.Ord e => GHC.Classes.Ord (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Types.Bool -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.CannotDisplayByteStrings => Data.Text.Display.Core.Display Data.ByteString.Lazy.Internal.ByteString -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.CannotDisplayByteStrings => Data.Text.Display.Core.Display bytestring-0.12.1.0:Data.ByteString.Internal.Type.ByteString -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Types.Char -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Real.Integral e => Data.Text.Display.Core.Display (Data.Text.Display.Core.DisplayDecimal e) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Float.RealFloat e => Data.Text.Display.Core.Display (Data.Text.Display.Core.DisplayRealFloat e) -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Types.Double -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Types.Float -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.IO.Exception.IOException -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Types.Int -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Int.Int16 -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Int.Int32 -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Int.Int64 -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Int.Int8 -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Num.Integer.Integer -- Defined in ‘Data.Text.Display.Core’
instance forall a. Data.Text.Display.Core.Display a => Data.Text.Display.Core.Display [a] -- Defined in ‘Data.Text.Display.Core’
instance forall a. Data.Text.Display.Core.Display a => Data.Text.Display.Core.Display (GHC.Internal.Maybe.Maybe a) -- Defined in ‘Data.Text.Display.Core’
instance forall a. Data.Text.Display.Core.Display a => Data.Text.Display.Core.Display (GHC.Internal.Base.NonEmpty a) -- Defined in ‘Data.Text.Display.Core’
instance forall (str :: GHC.Types.Symbol) a. GHC.Internal.TypeLits.KnownSymbol str => Data.Text.Display.Core.Display (Data.Text.Display.Core.OpaqueInstance str a) -- Defined in ‘Data.Text.Display.Core’
instance forall e. GHC.Internal.Show.Show e => Data.Text.Display.Core.Display (Data.Text.Display.Core.ShowInstance e) -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Exception.Type.SomeException -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display Data.Text.Internal.Text -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display Data.Text.Internal.Lazy.Text -- Defined in ‘Data.Text.Display.Core’
instance forall a b. (Data.Text.Display.Core.Display a, Data.Text.Display.Core.Display b) => Data.Text.Display.Core.Display (a, b) -- Defined in ‘Data.Text.Display.Core’
instance forall a b c. (Data.Text.Display.Core.Display a, Data.Text.Display.Core.Display b, Data.Text.Display.Core.Display c) => Data.Text.Display.Core.Display (a, b, c) -- Defined in ‘Data.Text.Display.Core’
instance forall a b c d. (Data.Text.Display.Core.Display a, Data.Text.Display.Core.Display b, Data.Text.Display.Core.Display c, Data.Text.Display.Core.Display d) => Data.Text.Display.Core.Display (a, b, c, d) -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display () -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Base.Void -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Types.Word -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Word.Word16 -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Word.Word32 -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Word.Word64 -- Defined in ‘Data.Text.Display.Core’
instance Data.Text.Display.Core.Display GHC.Internal.Word.Word8 -- Defined in ‘Data.Text.Display.Core’
instance forall a. (Data.Text.Display.Generic.AssertNoSumRecordInstance Data.Text.Display.Core.Display a, GHC.Internal.Generics.Generic a, Data.Text.Display.Generic.GDisplay1 (GHC.Internal.Generics.Rep a)) => Data.Text.Display.Core.Display (Data.Text.Display.Generic.RecordInstance a) -- Defined in ‘Data.Text.Display.Generic’
instance forall (msg :: GHC.Internal.TypeError.ErrorMessage). ((TypeError ...) ~ '()) => Data.Text.Display.Generic.Assert GHC.Types.False msg -- Defined in ‘Data.Text.Display.Generic’
instance forall (msg :: GHC.Internal.TypeError.ErrorMessage). Data.Text.Display.Generic.Assert GHC.Types.True msg -- Defined in ‘Data.Text.Display.Generic’
Loading

0 comments on commit b01258e

Please sign in to comment.