Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up CI and update cabal file #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
10 changes: 10 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Set update schedule for GitHub Actions

version: 2
updates:

- package-ecosystem: "github-actions"
directory: "/"
schedule:
# Check for updates to GitHub Actions every week
interval: "weekly"
49 changes: 49 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Tests

# Trigger the workflow on push or pull request, but only for the main branch
on:
pull_request:
push:
branches: ["master"]

jobs:
generate-matrix:
name: "Generate matrix from cabal"
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
runs-on: ubuntu-latest
steps:
- name: Extract the tested GHC versions
id: set-matrix
uses: kleidukos/[email protected]
with:
cabal-file: hsqml.cabal
ubuntu-version: latest
version: 0.1.7.1
tests:
name: ${{ matrix.ghc }} on ${{ matrix.os }}
needs: generate-matrix
runs-on: ${{ matrix.os }}
strategy:
matrix: ${{ fromJSON(needs.generate-matrix.outputs.matrix) }}
steps:
- name: Checkout base repo
uses: actions/checkout@v4
- name: Set up Haskell
id: setup-haskell
uses: haskell-actions/setup@v2
with:
ghc-version: ${{ matrix.ghc }}
cabal-version: 'latest'
- name: Configure
run: cabal configure --enable-tests
- name: Cache
uses: actions/[email protected]
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: Build
run: cabal build all
- name: Test
run: make test
3 changes: 2 additions & 1 deletion Setup.hs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import Distribution.PackageDescription
import Distribution.Simple
import Distribution.Simple.BuildPaths
import Distribution.Simple.Compiler
import Distribution.Simple.PreProcess.Types (Suffix(..))
import Distribution.Simple.LocalBuildInfo
import Distribution.Simple.Program
import Distribution.Simple.Program.Ld
Expand Down Expand Up @@ -181,7 +182,7 @@ buildGHCiFix verb pkgDesc lbi lib =
hsObjs = map ((bDir </>) . (<.> "o")) ms
lname = getHSLibraryName $ componentUnitId clbi
stubObjs <- fmap catMaybes $
mapM (findFileWithExtension ["o"] [bDir]) $ map (++ "_stub") ms
mapM (findFileWithExtension [Suffix "o"] [bDir]) $ map (++ "_stub") ms
(ld,_) <- requireProgram verb ldProgram (withPrograms lbi)
combineObjectFiles verb lbi ld (bDir </> lname <.> "o") (stubObjs ++ hsObjs)
(ghc,_) <- requireProgram verb ghcProgram (withPrograms lbi)
Expand Down
Loading