Skip to content

Commit

Permalink
Merge branch derive
Browse files Browse the repository at this point in the history
  • Loading branch information
ddssff committed Dec 1, 2024
2 parents f89962d + bd0147b commit 2aab2ce
Show file tree
Hide file tree
Showing 20 changed files with 415 additions and 241 deletions.
108 changes: 42 additions & 66 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/andreasabel/haskell-ci
#
# version: 0.17.20231010
# version: 0.19.20240517
#
# REGENDATA ("0.17.20231010",["github","safecopy.cabal"])
# REGENDATA ("0.19.20240517",["github","safecopy.cabal"])
#
name: Haskell-CI
on:
Expand All @@ -27,24 +27,29 @@ jobs:
timeout-minutes:
60
container:
image: buildpack-deps:focal
image: buildpack-deps:jammy
continue-on-error: ${{ matrix.allow-failure }}
strategy:
matrix:
include:
- compiler: ghc-9.8.1
- compiler: ghc-9.10.1
compilerKind: ghc
compilerVersion: 9.8.1
compilerVersion: 9.10.1
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.6.3
- compiler: ghc-9.8.2
compilerKind: ghc
compilerVersion: 9.6.3
compilerVersion: 9.8.2
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.7
- compiler: ghc-9.6.5
compilerKind: ghc
compilerVersion: 9.4.7
compilerVersion: 9.6.5
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.4.8
compilerKind: ghc
compilerVersion: 9.4.8
setup-method: ghcup
allow-failure: false
- compiler: ghc-9.2.8
Expand All @@ -65,51 +70,39 @@ jobs:
- compiler: ghc-8.8.4
compilerKind: ghc
compilerVersion: 8.8.4
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.6.5
compilerKind: ghc
compilerVersion: 8.6.5
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.4.4
compilerKind: ghc
compilerVersion: 8.4.4
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.2.2
compilerKind: ghc
compilerVersion: 8.2.2
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
- compiler: ghc-8.0.2
compilerKind: ghc
compilerVersion: 8.0.2
setup-method: hvr-ppa
setup-method: ghcup
allow-failure: false
fail-fast: false
steps:
- name: apt
run: |
apt-get update
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5
if [ "${{ matrix.setup-method }}" = ghcup ]; then
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
"$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)
else
apt-add-repository -y 'ppa:hvr/ghc'
apt-get update
apt-get install -y "$HCNAME"
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.19.5/x86_64-linux-ghcup-0.1.19.5 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" config add-release-channel https://raw.githubusercontent.com/haskell/ghcup-metadata/master/ghcup-prereleases-0.0.7.yaml;
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.1.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
fi
apt-get install -y --no-install-recommends gnupg ca-certificates dirmngr curl git software-properties-common libtinfo5 libnuma-dev
mkdir -p "$HOME/.ghcup/bin"
curl -sL https://downloads.haskell.org/ghcup/0.1.20.0/x86_64-linux-ghcup-0.1.20.0 > "$HOME/.ghcup/bin/ghcup"
chmod a+x "$HOME/.ghcup/bin/ghcup"
"$HOME/.ghcup/bin/ghcup" install ghc "$HCVER" || (cat "$HOME"/.ghcup/logs/*.* && false)
"$HOME/.ghcup/bin/ghcup" install cabal 3.10.3.0 || (cat "$HOME"/.ghcup/logs/*.* && false)
env:
HCKIND: ${{ matrix.compilerKind }}
HCNAME: ${{ matrix.compiler }}
Expand All @@ -121,22 +114,13 @@ jobs:
echo "CABAL_DIR=$HOME/.cabal" >> "$GITHUB_ENV"
echo "CABAL_CONFIG=$HOME/.cabal/config" >> "$GITHUB_ENV"
HCDIR=/opt/$HCKIND/$HCVER
if [ "${{ matrix.setup-method }}" = ghcup ]; then
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
else
HC=$HCDIR/bin/$HCKIND
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCDIR/bin/$HCKIND-pkg" >> "$GITHUB_ENV"
echo "HADDOCK=$HCDIR/bin/haddock" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.1.0 -vnormal+nowrap" >> "$GITHUB_ENV"
fi
HC=$("$HOME/.ghcup/bin/ghcup" whereis ghc "$HCVER")
HCPKG=$(echo "$HC" | sed 's#ghc$#ghc-pkg#')
HADDOCK=$(echo "$HC" | sed 's#ghc$#haddock#')
echo "HC=$HC" >> "$GITHUB_ENV"
echo "HCPKG=$HCPKG" >> "$GITHUB_ENV"
echo "HADDOCK=$HADDOCK" >> "$GITHUB_ENV"
echo "CABAL=$HOME/.ghcup/bin/cabal-3.10.3.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 @@ -220,18 +204,17 @@ jobs:
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo "package safecopy" >> cabal.project ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then echo " ghc-options: -Werror=missing-methods" >> cabal.project ; fi
cat >> cabal.project <<EOF
allow-newer: bytestring
allow-newer: text
allow-newer: lens
EOF
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: $_ installed\n" unless /^(safecopy)$/; }' >> cabal.project.local
$HCPKG list --simple-output --names-only | perl -ne 'for (split /\s+/) { print "constraints: any.$_ installed\n" unless /^(safecopy)$/; }' >> cabal.project.local
cat cabal.project
cat cabal.project.local
- name: dump install plan
run: |
$CABAL v2-build $ARG_COMPILER $ARG_TESTS $ARG_BENCH --dry-run all
cabal-plan
- name: restore cache
uses: actions/cache/restore@v3
uses: actions/cache/restore@v4
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
path: ~/.cabal/store
Expand Down Expand Up @@ -263,22 +246,15 @@ jobs:
- name: prepare for constraint sets
run: |
rm -f cabal.project.local
- name: constraint set text-2.1
run: |
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>= 2.1' all --dry-run ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>= 2.1' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>= 2.1' all ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='text ^>= 2.1' all ; fi
- name: constraint set bytestring-0.12
- name: constraint set lens-5.3.1
run: |
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>= 0.12' all --dry-run ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>= 0.12' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>= 0.12' all ; fi
if [ $((HCNUMVER >= 80200)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='bytestring ^>= 0.12' all ; fi
if [ $((HCNUMVER < 91000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='lens ^>= 5.3.1' all --dry-run ; fi
if [ $((HCNUMVER < 91000)) -ne 0 ] ; then cabal-plan topo | sort ; fi
if [ $((HCNUMVER < 91000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='lens ^>= 5.3.1' --dependencies-only -j2 all ; fi
if [ $((HCNUMVER < 91000)) -ne 0 ] ; then $CABAL v2-build $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='lens ^>= 5.3.1' all ; fi
if [ $((HCNUMVER < 91000)) -ne 0 ] ; then $CABAL v2-test $ARG_COMPILER --enable-tests --disable-benchmarks --constraint='lens ^>= 5.3.1' all ; fi
- name: save cache
uses: actions/cache/save@v3
uses: actions/cache/save@v4
if: always()
with:
key: ${{ runner.os }}-${{ matrix.compiler }}-${{ github.sha }}
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/stack.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Stack build

on:
push:
branches: [master]
pull_request:
branches: [master]

jobs:
build:
name: Stack ${{ matrix.ghc }} ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
ghc: ['9.8', '9.6', '9.4', '9.2', '9.0', '8.10', '8.8', '8.6', '8.4', '8.2', '8.0']
include:
- os: macos-latest
ghc: '9.8'
- os: windows-latest
ghc: '9.8'

steps:
- uses: actions/checkout@v4

- uses: haskell-actions/setup@v2
id: setup
with:
ghc-version: ${{ matrix.ghc }}
enable-stack: true
cabal-update: false

- name: Restore cache
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-stack-${{ steps.setup.outputs.stack-version }}-ghc-${{ steps.setup.outputs.ghc-version }}
with:
key: ${{ env.key }}-commit-${{ github.sha }}
restore-keys: ${{ env.key }}-
path: |
${{ steps.setup.outputs.stack-root }}
.stack-work
- name: Build dependencies
run: stack build --stack-yaml=stack-${{ matrix.ghc }}.yaml --system-ghc --only-dependencies

- name: Build
run: stack build --stack-yaml=stack-${{ matrix.ghc }}.yaml --system-ghc

- name: Build tests
run: stack test --stack-yaml=stack-${{ matrix.ghc }}.yaml --system-ghc --no-run-tests

- name: Run tests
run: stack test --stack-yaml=stack-${{ matrix.ghc }}.yaml --system-ghc

- name: Save cache
uses: actions/cache/save@v4
if: always() && steps.cache.outputs.cache-hit != 'true'
with:
key: ${{ steps.cache.outputs.cache-primary-key }}
path: |
${{ steps.setup.outputs.stack-root }}
.stack-work
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
/dist-newstyle/
*.nix
/.stack-work/
*.nix
stack*.yaml.lock
15 changes: 4 additions & 11 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,18 +1,11 @@
branches: master
installed: +all

constraint-set bytestring-0.12
ghc: >= 8.2
constraints: bytestring ^>= 0.12
tests: True
run-tests: True

constraint-set text-2.1
ghc: >= 8.2
constraints: text ^>= 2.1
constraint-set lens-5.3.1
ghc: >= 8.0 && < 9.10
constraints: lens ^>= 5.3.1
tests: True
run-tests: True

raw-project
allow-newer: bytestring
allow-newer: text
allow-newer: lens
31 changes: 22 additions & 9 deletions safecopy.cabal
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
Name: safecopy
Version: 0.10.5
Version: 0.10.4.2
x-revision: 10
Synopsis: Binary serialization with version control.
Description: An extension to Data.Serialize with built-in version control.
Homepage: https://github.com/acid-state/safecopy
Expand All @@ -13,9 +15,10 @@ Extra-source-files: CHANGELOG.md
Cabal-version: >=1.10

tested-with:
GHC == 9.8.1
GHC == 9.6.3
GHC == 9.4.7
GHC == 9.10.1
GHC == 9.8.2
GHC == 9.6.5
GHC == 9.4.8
GHC == 9.2.8
GHC == 9.0.2
GHC == 8.10.7
Expand All @@ -41,14 +44,18 @@ Library
-- Packages needed in order to build this package.
Build-depends: base >= 4.9 && < 5,
array < 0.6,
cereal >= 0.5 && < 0.6,
cereal >= 0.5.3 && < 0.6,
-- cereal 0.5.3 introduced instance Monoid Put
bytestring < 0.13,
generic-data >= 0.3,
generic-data >= 0.3.0.0,
containers >= 0.3 && < 0.8,
old-time < 1.2,
template-haskell < 2.22,
pretty,
regex-tdfa,
syb,
template-haskell >= 2.11.0.0 && < 2.23,
text < 1.3 || >= 2.0 && < 2.2,
time < 1.13,
time >= 1.6.0.1 && < 1.15,
transformers < 0.7,
vector >= 0.10 && < 0.14

Expand All @@ -67,8 +74,14 @@ Test-suite instances
Hs-Source-Dirs: test/
GHC-Options: -Wall -threaded -rtsopts -with-rtsopts=-N
Build-depends: base, cereal, template-haskell, safecopy,
containers, time, array, vector, lens >= 4.7 && < 5.3,
lens-action, tasty, tasty-quickcheck, quickcheck-instances, QuickCheck
containers, time, array, vector, lens >= 4.7 && < 6,
lens-action
, tasty
, tasty-hunit
, tasty-quickcheck
, quickcheck-instances
, QuickCheck >= 2.8.2 && < 3
, th-orphans

Test-suite generic
Default-language: Haskell2010
Expand Down
6 changes: 6 additions & 0 deletions src/Data/SafeCopy.hs
Original file line number Diff line number Diff line change
Expand Up @@ -122,11 +122,17 @@ module Data.SafeCopy

-- * Template haskell functions
, deriveSafeCopy
, deriveSafeCopy'
, deriveSafeCopyIndexedType
, deriveSafeCopyIndexedType'
, deriveSafeCopySimple
, deriveSafeCopySimple'
, deriveSafeCopySimpleIndexedType
, deriveSafeCopySimpleIndexedType'
, deriveSafeCopyHappstackData
, deriveSafeCopyHappstackData'
, deriveSafeCopyHappstackDataIndexedType
, deriveSafeCopyHappstackDataIndexedType'

-- * Rarely used functions
, getSafeGet
Expand Down
Loading

0 comments on commit 2aab2ce

Please sign in to comment.