mirror of
https://github.com/swarm-game/swarm.git
synced 2024-08-16 18:10:23 +03:00
Update Github Actions and fix Doctest (#352)
* Fix doctests * Regenerate haskell-ci with config - use latest haskell-ci - configure haskell-ci to use doctest * Update tested with compiler - update cabal tested-with field - update .mergify.yaml to new compiler - restore note about mergify in haskell-ci
This commit is contained in:
parent
8578a5675a
commit
7ad65ad00a
79
.github/workflows/haskell-ci.yml
vendored
79
.github/workflows/haskell-ci.yml
vendored
@ -1,8 +1,15 @@
|
||||
## Hand edited to add paths filter ;)
|
||||
#####################################################################
|
||||
## NOTE: #
|
||||
## When changing versions, do not forget to update .mergify.yaml #
|
||||
## #
|
||||
## WARNING: #
|
||||
## Hand edited to add filter in on.push and on.pull_request. #
|
||||
## If possible do not manually edit beside the above. #
|
||||
#####################################################################
|
||||
#
|
||||
# This GitHub workflow config has been generated by a script via
|
||||
#
|
||||
# haskell-ci 'github' 'swarm.cabal'
|
||||
# haskell-ci 'github' '--config=cabal.haskell-ci' 'swarm.cabal'
|
||||
#
|
||||
# To regenerate the script (for example after adjusting tested-with) run
|
||||
#
|
||||
@ -10,9 +17,9 @@
|
||||
#
|
||||
# For more information, see https://github.com/haskell-CI/haskell-ci
|
||||
#
|
||||
# version: 0.13.20210901
|
||||
# version: 0.15.20220531
|
||||
#
|
||||
# REGENDATA ("0.13.20210901",["github","swarm.cabal"])
|
||||
# REGENDATA ("0.15.20220531",["github","--config=cabal.haskell-ci","swarm.cabal"])
|
||||
#
|
||||
name: Haskell-CI
|
||||
on:
|
||||
@ -36,25 +43,25 @@ on:
|
||||
- 'cabal.project*'
|
||||
jobs:
|
||||
linux:
|
||||
# when changing the name or adding ghc version, please don't forget to update
|
||||
# the .mergify.yml rules at the root of the project.
|
||||
name: Haskell-CI - Linux - ${{ matrix.compiler }}
|
||||
runs-on: ubuntu-18.04
|
||||
runs-on: ubuntu-20.04
|
||||
timeout-minutes:
|
||||
60
|
||||
container:
|
||||
image: buildpack-deps:bionic
|
||||
continue-on-error: ${{ matrix.allow-failure }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- compiler: ghc-9.0.1
|
||||
- compiler: ghc-9.0.2
|
||||
compilerKind: ghc
|
||||
compilerVersion: 9.0.1
|
||||
setup-method: hvr-ppa
|
||||
compilerVersion: 9.0.2
|
||||
setup-method: ghcup
|
||||
allow-failure: false
|
||||
- compiler: ghc-8.10.4
|
||||
- compiler: ghc-8.10.7
|
||||
compilerKind: ghc
|
||||
compilerVersion: 8.10.4
|
||||
setup-method: hvr-ppa
|
||||
compilerVersion: 8.10.7
|
||||
setup-method: ghcup
|
||||
allow-failure: false
|
||||
fail-fast: false
|
||||
steps:
|
||||
@ -62,9 +69,11 @@ jobs:
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
|
||||
apt-add-repository -y 'ppa:hvr/ghc'
|
||||
apt-get update
|
||||
apt-get install -y "$HCNAME" cabal-install-3.4
|
||||
mkdir -p "$HOME/.ghcup/bin"
|
||||
curl -sL https://downloads.haskell.org/ghcup/0.1.17.8/x86_64-linux-ghcup-0.1.17.8 > "$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
|
||||
env:
|
||||
HCKIND: ${{ matrix.compilerKind }}
|
||||
HCNAME: ${{ matrix.compiler }}
|
||||
@ -76,11 +85,11 @@ jobs:
|
||||
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
|
||||
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
|
||||
HCDIR=/opt/$HCKIND/$HCVER
|
||||
HC=$HCDIR/bin/$HCKIND
|
||||
HC=$HOME/.ghcup/bin/$HCKIND-$HCVER
|
||||
echo "HC=$HC" >> "$GITHUB_ENV"
|
||||
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
|
||||
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
|
||||
echo "CABAL=/opt/cabal/3.4/bin/cabal -vnormal+nowrap" >> "$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"
|
||||
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"
|
||||
@ -114,6 +123,10 @@ jobs:
|
||||
repository hackage.haskell.org
|
||||
url: http://hackage.haskell.org/
|
||||
EOF
|
||||
cat >> $CABAL_CONFIG <<EOF
|
||||
program-default-options
|
||||
ghc-options: $GHCJOBS +RTS -M3G -RTS
|
||||
EOF
|
||||
cat $CABAL_CONFIG
|
||||
- name: versions
|
||||
run: |
|
||||
@ -132,6 +145,15 @@ jobs:
|
||||
rm -f cabal-plan.xz
|
||||
chmod a+x $HOME/.cabal/bin/cabal-plan
|
||||
cabal-plan --version
|
||||
- name: install cabal-docspec
|
||||
run: |
|
||||
mkdir -p $HOME/.cabal/bin
|
||||
curl -sL https://github.com/phadej/cabal-extras/releases/download/cabal-docspec-0.0.0.20211114/cabal-docspec-0.0.0.20211114.xz > cabal-docspec.xz
|
||||
echo 'e224700d9e8c9ec7ec6bc3f542ba433cd9925a5d356676c62a9bd1f2c8be8f8a 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
|
||||
cabal-docspec --version
|
||||
- name: checkout
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
@ -159,8 +181,8 @@ jobs:
|
||||
echo "packages: ${PKGDIR_swarm}" >> cabal.project
|
||||
echo "package swarm" >> cabal.project
|
||||
echo " ghc-options: -Werror=missing-methods" >> cabal.project
|
||||
# ensure we use the ghc901 fix
|
||||
cat "${GITHUB_WORKSPACE}/source/cabal.project" | grep -v "^packages" >> cabal.project
|
||||
cat >> cabal.project <<EOF
|
||||
EOF
|
||||
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(swarm)$/; }' >> cabal.project.local
|
||||
cat cabal.project
|
||||
cat cabal.project.local
|
||||
@ -178,23 +200,20 @@ jobs:
|
||||
run: |
|
||||
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks --dependencies-only -j2 all
|
||||
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dependencies-only -j2 all
|
||||
- name: build w/o tests
|
||||
run: |
|
||||
$CABAL v2-build $ARG_COMPILER --disable-tests --disable-benchmarks all
|
||||
- name: build
|
||||
run: |
|
||||
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --write-ghc-environment-files=always
|
||||
- name: tests
|
||||
run: |
|
||||
$CABAL v2-test $ARG_COMPILER $ARG_TESTS $ARG_BENCH all --test-show-details=direct
|
||||
- name: docspec
|
||||
run: |
|
||||
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH all
|
||||
cabal-docspec $ARG_COMPILER
|
||||
- name: cabal check
|
||||
run: |
|
||||
cd ${PKGDIR_swarm} || false
|
||||
${CABAL} -vnormal check
|
||||
- name: haddock
|
||||
run: |
|
||||
$CABAL v2-haddock $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
|
||||
$CABAL v2-haddock --haddock-all $ARG_COMPILER --with-haddock $HADDOCK $ARG_TESTS $ARG_BENCH all
|
||||
|
@ -1,8 +1,8 @@
|
||||
queue_rules:
|
||||
- name: default
|
||||
conditions:
|
||||
- check-success=Haskell-CI - Linux - ghc-9.0.1
|
||||
- check-success=Haskell-CI - Linux - ghc-8.10.4
|
||||
- check-success=Haskell-CI - Linux - ghc-9.0.2
|
||||
- check-success=Haskell-CI - Linux - ghc-8.10.7
|
||||
|
||||
pull_request_rules:
|
||||
- actions:
|
||||
@ -26,8 +26,8 @@ pull_request_rules:
|
||||
- -files~=^[^/]*\.yaml$
|
||||
- -files~=^data/.*\.yaml$
|
||||
- and:
|
||||
- check-success=Haskell-CI - Linux - ghc-9.0.1
|
||||
- check-success=Haskell-CI - Linux - ghc-8.10.4
|
||||
- check-success=Haskell-CI - Linux - ghc-9.0.2
|
||||
- check-success=Haskell-CI - Linux - ghc-8.10.7
|
||||
- label=merge me
|
||||
- ! '#approved-reviews-by>=1'
|
||||
- ! '#changes-requested-reviews-by=0'
|
||||
|
26
cabal.haskell-ci
Normal file
26
cabal.haskell-ci
Normal file
@ -0,0 +1,26 @@
|
||||
-- See cabal.haskell-ci in the tool repository for all field explanations
|
||||
-- https://github.com/haskell-CI/haskell-ci/blob/master/cabal.haskell-ci
|
||||
|
||||
-- --no-tests --no-benchmarks build is useful to verify that package
|
||||
-- builds when less constrained
|
||||
-- But Swarm constrains all library dependencies and tests almost not at all
|
||||
no-tests-no-benchmarks: False
|
||||
unconstrained: False
|
||||
|
||||
-- Run cabal-docspec
|
||||
docspec: True
|
||||
|
||||
-- Build haddocks. Accepts booleans or version range.
|
||||
haddock: True
|
||||
|
||||
-- Build benchmarks. There are no way to run benchmarks. Accepts booleans or version range.
|
||||
-- Swarm has benchmarks so at least build them :)
|
||||
benchmarks: True
|
||||
|
||||
-- TODO: enable HLint
|
||||
|
||||
-- Run HLint
|
||||
-- hlint: True
|
||||
-- hlint-job: 9.0.2
|
||||
-- hlint-yaml: .hlint.yaml
|
||||
-- hlint-download-binary: True
|
@ -24,6 +24,8 @@ module Swarm.Language.Parse (
|
||||
parsePolytype,
|
||||
parseType,
|
||||
parseTerm,
|
||||
binOps,
|
||||
unOps,
|
||||
|
||||
-- * Utility functions
|
||||
runParser,
|
||||
@ -58,6 +60,11 @@ import Data.Set.Lens (setOf)
|
||||
import Swarm.Language.Syntax
|
||||
import Swarm.Language.Types
|
||||
|
||||
-- Imports for doctests (cabal-docspec needs this)
|
||||
|
||||
-- $setup
|
||||
-- >>> import qualified Data.Map.Strict as Map
|
||||
|
||||
-- | When parsing a term using a quasiquoter (i.e. something in the
|
||||
-- Swarm source code that will be parsed at compile time), we want
|
||||
-- to allow antiquoting, i.e. writing something like $x to refer to
|
||||
@ -345,7 +352,7 @@ parseExpr = fixDefMissingSemis <$> makeExprParser parseTermAtom table
|
||||
-- | Precedences and parsers of binary operators.
|
||||
--
|
||||
-- >>> Map.map length binOps
|
||||
-- fromList [(4,6),(6,2),(7,2),(8,1)]
|
||||
-- fromList [(0,1),(2,1),(3,1),(4,6),(6,3),(7,2),(8,1)]
|
||||
binOps :: Map.Map Int [Operator Parser Syntax]
|
||||
binOps = Map.unionsWith (++) $ mapMaybe binOpToTuple allConst
|
||||
where
|
||||
|
@ -18,7 +18,7 @@ maintainer: byorgey@gmail.com
|
||||
bug-reports: https://github.com/swarm-game/swarm/issues
|
||||
copyright: Brent Yorgey 2021
|
||||
category: Game
|
||||
tested-with: GHC ==8.10.4 || ==9.0.1
|
||||
tested-with: GHC ==8.10.7 || ==9.0.2
|
||||
extra-source-files: CHANGELOG.md
|
||||
example/*.sw
|
||||
data-dir: data/
|
||||
|
Loading…
Reference in New Issue
Block a user