Skip to content

Commit

Permalink
Merge pull request #72 from biocad/maksbotan/update-haskell-ci
Browse files Browse the repository at this point in the history
haskell-ci regenerate
  • Loading branch information
maksbotan authored Nov 9, 2023
2 parents c0dcfa2 + 918cb72 commit d28b905
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 46 deletions.
41 changes: 21 additions & 20 deletions .github/workflows/haskell-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
#
# For more information, see https://github.com/haskell-CI/haskell-ci
#
# version: 0.14.3
# version: 0.16.6
#
# REGENDATA ("0.14.3",["github","cobot-io.cabal"])
# REGENDATA ("0.16.6",["github","cobot-io.cabal"])
#
name: Haskell-CI
on:
Expand All @@ -23,7 +23,7 @@ on:
jobs:
linux:
name: Haskell-CI - Linux - ${{ matrix.compiler }}
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
timeout-minutes:
60
container:
Expand All @@ -32,14 +32,9 @@ jobs:
strategy:
matrix:
include:
- compiler: ghc-9.4.4
- compiler: ghc-9.2.8
compilerKind: ghc
compilerVersion: 9.4.4
setup-method: ghcup
allow-failure: true
- compiler: ghc-9.2.5
compilerKind: ghc
compilerVersion: 9.2.5
compilerVersion: 9.2.8
setup-method: ghcup
allow-failure: true
- compiler: ghc-9.0.2
Expand All @@ -59,10 +54,10 @@ jobs:
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.17.5/x86_64-linux-ghcup-0.1.17.5 > "$HOME/.ghcup/bin/ghcup"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.2/x86_64-linux-ghcup-0.1.19.2 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER"
"$HOME/.ghcup/bin/ghcup" install cabal 3.6.2.0
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -78,7 +73,7 @@ jobs:
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HOME/.ghcup/bin/$HCKIND-pkg-$HCVER" >> "$GITHUB_ENV"
echo "HADDOCK=$HOME/.ghcup/bin/haddock-$HCVER" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.6.2.0 -vnormal+nowrap" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
HCNUMVER=$(${HC} --numeric-version|perl -ne '/^(\d+)\.(\d+)\.(\d+)(\.(\d+))?$/; print(10000 * $1 + 100 * $2 + ($3 == 0 ? $5 != 1 : $3))')
echo "HCNUMVER=$HCNUMVER" >> "$GITHUB_ENV"
echo "ARG_TESTS=--enable-tests" >> "$GITHUB_ENV"
Expand Down Expand Up @@ -128,8 +123,8 @@ jobs:
- name: install cabal-plan
run: |
mkdir -p $HOME/.cabal/bin
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.6.2.0/cabal-plan-0.6.2.0-x86_64-linux.xz > cabal-plan.xz
echo 'de73600b1836d3f55e32d80385acc055fd97f60eaa0ab68a755302685f5d81bc cabal-plan.xz' | sha256sum -c -
curl -sL https://github.com/haskell-hvr/cabal-plan/releases/download/v0.7.3.0/cabal-plan-0.7.3.0-x86_64-linux.xz > cabal-plan.xz
echo 'f62ccb2971567a5f638f2005ad3173dba14693a45154c1508645c52289714cb2 cabal-plan.xz' | sha256sum -c -
xz -d < cabal-plan.xz > $HOME/.cabal/bin/cabal-plan
rm -f cabal-plan.xz
chmod a+x $HOME/.cabal/bin/cabal-plan
Expand All @@ -142,7 +137,7 @@ jobs:
chmod a+x $HOME/.cabal/bin/hpack
hpack --version
- name: checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
path: source
- name: generate cabal file
Expand Down Expand Up @@ -183,8 +178,8 @@ jobs:
run: |
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
cabal-plan
- name: cache
uses: actions/cache@v2
- name: restore cache
uses: actions/cache/restore@v3
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
Expand All @@ -208,8 +203,14 @@ jobs:
${CABAL} -vnormal check
- name: haddock
run: |
$CABAL v2-haddock $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
$CABAL v2-haddock --disable-documentation --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
- name: unconstrained build
run: |
rm -f cabal.project.local
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
- name: save cache
uses: actions/cache/save@v3
if: always()
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
10 changes: 8 additions & 2 deletions package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,11 @@ extra-source-files:
tested-with: |
GHC ==8.10.7
|| ==9.0.2
|| ==9.2.5
|| ==9.4.4
|| ==9.2.8
# hyraxAbif does not support text >= 1.3 yet
# || ==9.4.5
# || ==9.6.2

# Metadata used when publishing your package

Expand Down Expand Up @@ -97,3 +100,6 @@ tests:
- hspec >= 2.4.1 && < 2.11
- neat-interpolation >= 0.3
- linear
# megaparsec-9.3 changed something in error messages
# so that our tests do not pass.
- megaparsec < 9.3
49 changes: 25 additions & 24 deletions test/FASTASpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,36 +43,37 @@ badFasta8 :: Either String (Fasta Char)
badFasta8 = Left "input.fasta:21:5:\n |\n21 | CMV + enhMCK + prcTnT-2\r\n | ^^\nunexpected \"+ \"\nexpecting end of input, end of line, or letter\n"

fastaSpec :: Spec
fastaSpec = describe "Fasta files parser." $ do
parseFile "test/FASTA/order1.fasta" correctFasta1
writeFile "test/FASTA/input.fasta" correctFasta1
parseBadFile "test/FASTA/order2.fasta" badFasta2
parseFile "test/FASTA/order3.fasta" correctFasta3
writeFile "test/FASTA/input.fasta" correctFasta3
parseBadFile "test/FASTA/order4.fasta" badFasta4
parseFile "test/FASTA/order5.fasta" correctFasta5
writeFile "test/FASTA/input.fasta" correctFasta5
parseBadFile "test/FASTA/order6.fasta" badFasta6
parseBadFile "test/FASTA/order7.fasta" badFasta7
parseBadFile "test/FASTA/order8.fasta" badFasta8
fastaSpec = describe "Fasta files parser" $ do
describe "fromFile" $ do
parseFile "test/FASTA/order1.fasta" correctFasta1
parseBadFile "test/FASTA/order2.fasta" badFasta2
parseFile "test/FASTA/order3.fasta" correctFasta3
parseBadFile "test/FASTA/order4.fasta" badFasta4
parseFile "test/FASTA/order5.fasta" correctFasta5
parseBadFile "test/FASTA/order6.fasta" badFasta6
parseBadFile "test/FASTA/order7.fasta" badFasta7
parseBadFile "test/FASTA/order8.fasta" badFasta8

describe "toFile" $ do
writeFile "test/FASTA/input.fasta" correctFasta5
writeFile "test/FASTA/input.fasta" correctFasta1
writeFile "test/FASTA/input.fasta" correctFasta3

parseFile :: FilePath -> Fasta Char -> Spec
parseFile path cf = do
describe "fromFile" $ do
it "correctly parses fasta from file" $ do
fasta <- fromFile path
fasta `shouldBe` cf
parseFile path cf =
it ("correctly parses good fasta from file " <> path) $ do
fasta <- fromFile path
fasta `shouldBe` cf

parseBadFile :: FilePath -> Either String (Fasta Char) -> Spec
parseBadFile path cf = do
describe "fromFile" $ do
it "correctly parses fasta from file" $ do
res <- liftIO (readFile path)
let badRes = parseOnly fastaP res
badRes `shouldBe` cf
parseBadFile path cf =
it ("correctly parses bad fasta from file " <> path) $ do
res <- liftIO (readFile path)
let badRes = parseOnly fastaP res
badRes `shouldBe` cf

writeFile :: FilePath -> Fasta Char -> Spec
writeFile path cf = describe "writeFile" $ do
writeFile path cf =
it "correctly write fasta into file" $ do
toFile cf path
fasta <- fromFile path
Expand Down

0 comments on commit d28b905

Please sign in to comment.