Skip to content

Commit 543cb79

Browse files
committed
Handling for cabal.project.local
1 parent 1d9c9d7 commit 543cb79

File tree

4 files changed

+73
-46
lines changed

4 files changed

+73
-46
lines changed

.github/workflows/haskell.yml

Lines changed: 27 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
ghc: ["9.0.1", "8.10.7", "8.8.4", "8.6.5"]
21-
os: [ubuntu-latest]
20+
ghc: ["9.2.2", "9.0.2", "8.10.7", "8.8.4", "8.6.5"]
21+
os: [ubuntu-latest, macOS-latest, windows-latest]
2222

2323
steps:
2424
- uses: actions/checkout@v2
@@ -27,57 +27,46 @@ jobs:
2727
id: setup-haskell
2828
with:
2929
ghc-version: ${{ matrix.ghc }}
30-
cabal-version: 3.4.0.0
30+
cabal-version: 3.6.2.0
3131

3232
- name: Set some window specific things
3333
if: matrix.os == 'windows-latest'
3434
run: echo 'EXE_EXT=.exe' >> $GITHUB_ENV
3535

3636
- name: Configure project
37-
run: cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
37+
run: |
38+
cabal configure --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
39+
APPEND=1 ./scripts/gen-cabal-project-local.sh
40+
echo "cabal.project.local:"
41+
cat cabal.project.local
3842
39-
- name: Restore cabal cache
40-
uses: haskell-works/cabal-cache-action@v1
43+
- name: Cabal cache over S3
44+
uses: action-works/cabal-cache-s3@v1
4145
env:
4246
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
4347
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
44-
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
45-
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
46-
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
4748
with:
48-
args: |
49-
sync-from-archive \
50-
--threads "$BINARY_CACHE_THREADS" \
51-
--archive-uri "$BINARY_CACHE_URI" \
52-
--region "$BINARY_CACHE_REGION" \
53-
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
49+
region: us-west-2
50+
dist-dir: dist-newstyle
51+
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
52+
threads: 16
53+
archive-uri: ${{ secrets.BINARY_CACHE_URI }}
54+
skip: "${{ secrets.BINARY_CACHE_URI == '' }}"
55+
56+
- name: Cabal cache over HTTPS
57+
uses: action-works/cabal-cache-s3@v1
58+
with:
59+
dist-dir: dist-newstyle
60+
store-path: ${{ steps.setup-haskell.outputs.cabal-store }}
61+
threads: 16
62+
archive-uri: https://cache.haskellworks.io/archive
63+
skip: "${{ secrets.BINARY_CACHE_URI != '' }}"
5464

5565
- name: Build
56-
# Try building it twice in case of flakey builds on Windows
57-
run: |
58-
cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ || \
59-
cabal build all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+ -j1
66+
run: cabal build all --enable-tests --enable-benchmarks
6067

6168
- name: Test
62-
run: |
63-
cabal test all --enable-tests --enable-benchmarks --write-ghc-environment-files=ghc8.4.4+
64-
65-
- name: Save cabal cache
66-
uses: haskell-works/cabal-cache-action@v1
67-
if: ${{ always() }}
68-
env:
69-
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
70-
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
71-
BINARY_CACHE_REGION: ${{ secrets.BINARY_CACHE_REGION }}
72-
BINARY_CACHE_THREADS: ${{ secrets.BINARY_CACHE_THREADS }}
73-
BINARY_CACHE_URI: ${{ secrets.BINARY_CACHE_URI }}
74-
with:
75-
args: |
76-
sync-to-archive \
77-
--threads "$BINARY_CACHE_THREADS" \
78-
--archive-uri "$BINARY_CACHE_URI" \
79-
--region "$BINARY_CACHE_REGION" \
80-
--store-path "${{ steps.setup-haskell.outputs.cabal-store }}"
69+
run: cabal test all --enable-tests --enable-benchmarks
8170

8271
check:
8372
needs: build

bench/Main.hs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ module Main where
33
import Control.Monad
44
import Criterion.Main
55
import Data.Char
6-
import Data.List
76
import Data.Word
87
import HaskellWorks.Data.Vector.AsVector64s
98

109
import qualified Data.ByteString.Lazy as LBS
10+
import qualified Data.List as L
1111
import qualified Data.Vector.Storable as DVS
1212
import qualified HaskellWorks.Data.Simd.Capabilities as CAP
1313
import qualified HaskellWorks.Data.Simd.Comparison.Avx2 as AVX2
@@ -41,7 +41,7 @@ runAndBitsStock bs = do
4141
benchcmpEqWord8s :: IO [Benchmark]
4242
benchcmpEqWord8s = do
4343
entries <- IO.listDirectory "data/bench"
44-
let files = ("data/bench/" ++) <$> (".csv" `isSuffixOf`) `filter` entries
44+
let files = ("data/bench/" ++) <$> (".csv" `L.isSuffixOf`) `filter` entries
4545
benchmarks <- forM files $ \file -> return $
4646
[ env (LBS.readFile file) $ \bs -> bgroup file
4747
[ bench ("hw-simd/cmpEqWord8s/avx2/" <> file) (nfIO (runCmpEqWord8sAvx2 bs))
@@ -53,7 +53,7 @@ benchcmpEqWord8s = do
5353
benchAndBits :: IO [Benchmark]
5454
benchAndBits = do
5555
entries <- IO.listDirectory "data/bench"
56-
let files = ("data/bench/" ++) <$> (".csv" `isSuffixOf`) `filter` entries
56+
let files = ("data/bench/" ++) <$> (".csv" `L.isSuffixOf`) `filter` entries
5757
benchmarks <- forM files $ \file -> return $
5858
[ env (LBS.readFile file) $ \bs -> bgroup file
5959
[ bench ("hw-simd/andBits/avx2/" <> file) (nfIO (runAndBitsAvx2 bs))

hw-simd.cabal

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ maintainer: newhoggy@gmail.com
1212
copyright: 2018-2021 John Ky
1313
license: BSD-3-Clause
1414
license-file: LICENSE
15-
tested-with: GHC == 9.0.1, GHC == 8.10.7, GHC == 8.8.4, GHC == 8.6.5
15+
tested-with: GHC == 9.2.2, GHC == 9.0.2, GHC == 8.10.7, GHC == 8.8.4, GHC == 8.6.5
1616
build-type: Simple
1717
extra-source-files: README.md
1818
ChangeLog.md
@@ -47,9 +47,9 @@ common containers { build-depends: containers >=
4747
common criterion { build-depends: criterion >= 1.4.1.0 && < 1.6 }
4848
common deepseq { build-depends: deepseq >= 1.4 && < 1.5 }
4949
common directory { build-depends: directory >= 1.2.2 && < 1.4 }
50-
common doctest { build-depends: doctest >= 0.16.2 && < 0.19 }
50+
common doctest { build-depends: doctest >= 0.16.2 && < 0.21 }
5151
common doctest-discover { build-depends: doctest-discover >= 0.2 && < 0.3 }
52-
common hedgehog { build-depends: hedgehog >= 0.5 && < 1.1 }
52+
common hedgehog { build-depends: hedgehog >= 0.5 && < 1.2 }
5353
common hspec { build-depends: hspec >= 2.4 && < 3 }
5454
common hw-bits { build-depends: hw-bits >= 0.7.0.2 && < 0.8 }
5555
common hw-hedgehog { build-depends: hw-hedgehog >= 0.1.0.1 && < 0.2 }
@@ -59,8 +59,8 @@ common hw-rankselect { build-depends: hw-rankselect >=
5959
common hw-rankselect-base { build-depends: hw-rankselect-base >= 0.3.2.0 && < 0.4 }
6060
common lens { build-depends: lens >= 4 && < 6 }
6161
common mmap { build-depends: mmap >= 0.5.9 && < 0.6 }
62-
common text { build-depends: text >= 1.2.2 && < 2.0 }
63-
common transformers { build-depends: transformers >= 0.4 && < 0.6 }
62+
common text { build-depends: text >= 1.2.2 && < 2.1 }
63+
common transformers { build-depends: transformers >= 0.4 && < 0.7 }
6464
common vector { build-depends: vector >= 0.12.0.1 && < 0.13 }
6565

6666
common config

scripts/gen-cabal-project-local.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
OS=$(uname -s)
2+
3+
echo "OS=$OS"
4+
5+
[ "APPEND" != "1" ] && rm -f cabal.project.local
6+
7+
bmi_enabled() {
8+
case "$(uname -s)" in
9+
Darwin)
10+
sysctl -a | grep 'cpu\..*features' | grep BMI2 > /dev/null
11+
;;
12+
Linux)
13+
cat /proc/cpuinfo | grep '^flags' | grep bmi2 > /dev/null
14+
;;
15+
WinNT)
16+
return 0
17+
;;
18+
*)
19+
echo "Unrecognised OS" 1>&2
20+
return 1
21+
;;
22+
esac
23+
}
24+
25+
(
26+
echo 'package bits-extra'
27+
bmi_enabled && echo ' flags: +bmi2'
28+
echo
29+
echo 'package hw-rankselect'
30+
bmi_enabled && echo 'flags: +bmi2'
31+
echo
32+
echo 'package hw-rankselect-base'
33+
bmi_enabled && echo 'flags: +bmi2'
34+
echo
35+
echo 'package hw-simd'
36+
bmi_enabled && echo 'flags: +bmi2'
37+
echo
38+
) >> cabal.project.local

0 commit comments

Comments
 (0)