Skip to content

Commit 0825f4b

Browse files
Merge pull request #66 from brandonchinn178/updates
Updates
2 parents 275d55f + 504db21 commit 0825f4b

24 files changed

+255
-233
lines changed

.github/workflows/ci.yml

+135-50
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,14 @@ on:
44
push:
55
branches:
66
- main
7+
schedule:
8+
- cron: '0 0 * * *'
79
workflow_call:
810

911
jobs:
1012
build_and_test:
11-
strategy:
12-
matrix:
13-
stack_yaml:
14-
- stack-ghc-8.10.yaml
15-
- stack-ghc-9.0.yaml
16-
# - stack-ghc-9.2.yaml
17-
- stack-ghc-9.4.yaml
18-
- stack-persistent-2.13.yaml
19-
- stack-persistent-2.14.yaml
20-
include:
21-
- stack_yaml: stack.yaml
22-
latest: true
23-
24-
name: build_and_test (${{ matrix.stack_yaml }})
25-
runs-on: ubuntu-22.04
13+
name: build_and_test
14+
runs-on: ubuntu-latest
2615
services:
2716
postgres:
2817
image: postgres:13.1
@@ -32,82 +21,178 @@ jobs:
3221
ports:
3322
- 5432:5432
3423
env:
35-
STACK_YAML: ${{ matrix.stack_yaml }}
3624
TEST_POSTGRESQL: 1
3725

3826
steps:
39-
- uses: actions/checkout@v3
40-
41-
- uses: actions/cache@v3
27+
-
28+
uses: actions/checkout@v3
29+
-
30+
uses: actions/cache@v3
4231
with:
4332
path: ~/.stack
44-
key: ${{ runner.os }}-stack-cache-${{ hashFiles(matrix.stack_yaml, 'package.yaml') }}
45-
- run: stack test --coverage
46-
47-
- name: Check that files are unmodified
33+
key: ${{ runner.os }}-stack-cache-${{ hashFiles('stack.yaml', 'package.yaml') }}
34+
-
35+
run: stack test --coverage
36+
-
37+
name: Check that files are unmodified
4838
run: git diff --exit-code
49-
50-
# upload coverage data
51-
- name: Generate coverage data
52-
run: stack install hpc-lcov && hpc-lcov
53-
- uses: codecov/codecov-action@v3
39+
-
40+
name: Check for any outdated packages
41+
run: cabal outdated --exit-code
42+
-
43+
name: Generate coverage data
44+
run: |
45+
HPC_LCOV_VERSION=1.1.1
46+
curl -fsSL \
47+
"https://github.com/brandonchinn178/hpc-lcov/releases/download/v${HPC_LCOV_VERSION}/hpc-lcov-${HPC_LCOV_VERSION}-linux-x86_64" \
48+
-o /usr/local/bin/hpc-lcov
49+
chmod +x /usr/local/bin/hpc-lcov
50+
hpc-lcov
51+
-
52+
uses: codecov/codecov-action@v3
5453
with:
5554
files: lcov.info
56-
if: ${{ matrix.latest }}
55+
56+
compat_test:
57+
strategy:
58+
matrix:
59+
ghc_version:
60+
- '8.10'
61+
- '9.0'
62+
- '9.4'
63+
- '9.6'
64+
persistent_version:
65+
- '2.13'
66+
- '2.14'
67+
include:
68+
- ghc_version: '8.10.1'
69+
persistent_version: '2.13'
70+
oldest: true
71+
exclude:
72+
- ghc_version: '9.4'
73+
persistent_version: '2.13'
74+
- ghc_version: '9.6'
75+
persistent_version: '2.13'
76+
77+
name: compat_test (ghc-${{ matrix.ghc_version }}, persistent-${{ matrix.persistent_version }})
78+
runs-on: ubuntu-latest
79+
80+
steps:
81+
-
82+
uses: actions/checkout@v3
83+
-
84+
id: setup
85+
name: Set up GHC ${{ matrix.ghc_version }}
86+
uses: haskell-actions/setup@v2
87+
with:
88+
ghc-version: ${{ matrix.ghc_version }}
89+
-
90+
name: Configure the build
91+
run:
92+
cabal configure
93+
--enable-test
94+
--test-options='--color=always'
95+
--test-show-details=streaming
96+
--constraint='persistent ^>= ${{ matrix.persistent_version }}'
97+
--constraint='persistent < 2.13.3.4 || >= 2.14.0.2'
98+
-
99+
# TODO: remove
100+
if: ${{ matrix.ghc_version == '9.6' }}
101+
run:
102+
cabal configure
103+
--enable-append
104+
--allow-newer='persistent:template-haskell'
105+
--allow-newer='unliftio-pool:transformers'
106+
--allow-newer='explainable-predicates:base'
107+
--allow-newer='explainable-predicates:template-haskell'
108+
-
109+
if: ${{ matrix.oldest }}
110+
name: Use oldest dependencies
111+
run:
112+
cabal configure
113+
--enable-append --prefer-oldest
114+
--constraint 'conduit >= 1.3.1'
115+
--constraint 'silently >= 0.0.3'
116+
--constraint 'string-conversions >= 0.4'
117+
--constraint 'unix-time >= 0.3.8'
118+
-
119+
name: Get build plan
120+
run: cabal build --dry-run
121+
-
122+
name: Get current month to clear cache
123+
run: echo "CURR_MONTH=$(date +%B)" | tee -a "$GITHUB_ENV"
124+
-
125+
uses: actions/cache@v3
126+
with:
127+
path: ${{ steps.setup.outputs.cabal-store }}
128+
key: ${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-${{ hashFiles('**/plan.json') }}
129+
restore-keys: |
130+
${{ runner.os }}-cabal-cache-${{ env.CURR_MONTH }}-${{ matrix.ghc_version }}-
131+
-
132+
name: Build + Test
133+
run: cabal test
57134

58135
lint:
59136
runs-on: ubuntu-latest
60137
env:
61138
HLINT_VERSION: '3.5'
62-
FOURMOLU_VERSION: '0.10.1.0'
139+
FOURMOLU_VERSION: '0.13.0.0'
63140
steps:
64-
- uses: actions/checkout@v3
65-
66-
- name: Install hlint
141+
-
142+
uses: actions/checkout@v3
143+
-
144+
name: Install hlint
67145
run: |
68146
HLINT_ARCHIVE="hlint-${HLINT_VERSION}-x86_64-linux.tar.gz"
69147
curl -sSLO "https://github.com/ndmitchell/hlint/releases/download/v${HLINT_VERSION}/${HLINT_ARCHIVE}"
70148
tar xzf "${HLINT_ARCHIVE}" -C /usr/local/bin/ --strip-components=1 "hlint-${HLINT_VERSION}/hlint"
71-
72-
- name: Install fourmolu
149+
-
150+
name: Install fourmolu
73151
run: |
74152
curl -sSL \
75153
"https://github.com/fourmolu/fourmolu/releases/download/v${FOURMOLU_VERSION}/fourmolu-${FOURMOLU_VERSION}-linux-x86_64" \
76154
-o /usr/local/bin/fourmolu
77155
chmod +x /usr/local/bin/fourmolu
78-
79-
- run: pip install pre-commit
80-
- run: pre-commit run --all-files -v --show-diff-on-failure
156+
-
157+
run: pip install pre-commit
158+
-
159+
run: pre-commit run --all-files -v --show-diff-on-failure
81160
env:
82161
SKIP: no-commit-to-branch
83162

84163
check_sdist:
85164
runs-on: ubuntu-latest
86165
steps:
87-
- uses: actions/checkout@v3
88-
- uses: actions/cache@v3
166+
-
167+
uses: actions/checkout@v3
168+
-
169+
uses: actions/cache@v3
89170
with:
90171
path: ~/.stack
91172
key: ${{ runner.os }}-check_sdist-${{ hashFiles('stack.yaml', 'package.yaml') }}
92-
93-
- name: Strip unreleased section from CHANGELOG
173+
-
174+
name: Strip unreleased section from CHANGELOG
94175
run: sed -i -n '/^# Unreleased/d; /^#/,$p' CHANGELOG.md
95-
96-
- name: Create sdist bundle
176+
-
177+
name: Create sdist bundle
97178
run: stack sdist --test-tarball --tar-dir .
98-
99-
- uses: actions/upload-artifact@v3
179+
-
180+
uses: actions/upload-artifact@v3
100181
with:
101182
name: persistent-mtl-sdist
102183
path: persistent-mtl-*.tar.gz
103184

104185
check_codegen:
105186
runs-on: ubuntu-latest
106187
steps:
107-
- uses: actions/checkout@v3
108-
- uses: actions/cache@v3
188+
-
189+
uses: actions/checkout@v3
190+
-
191+
uses: actions/cache@v3
109192
with:
110193
path: ~/.stack
111194
key: ${{ runner.os }}-check_codegen-${{ hashFiles('stack.yaml') }}
112-
- run: scripts/generate/run.sh
113-
- run: git diff --exit-code *.hs
195+
-
196+
run: scripts/generate/run.sh
197+
-
198+
run: git diff --exit-code *.hs

.github/workflows/release.yml

+18-18
Original file line numberDiff line numberDiff line change
@@ -11,43 +11,43 @@ jobs:
1111
- ci
1212

1313
steps:
14-
- uses: actions/checkout@v3
15-
with:
16-
ref: main
17-
18-
- uses: actions/download-artifact@v3
14+
-
15+
uses: actions/checkout@v3
16+
-
17+
uses: actions/download-artifact@v3
1918
with:
2019
name: persistent-mtl-sdist
2120
path: ./sdist/
22-
23-
- uses: brandonchinn178/haskell-actions/parse-cabal-file@parse-cabal-file
21+
-
2422
id: cabal_file
23+
uses: haskell-actions/parse-cabal-file@v1
2524
with:
2625
cabal_file: persistent-mtl.cabal
27-
- name: Set version label
26+
-
27+
name: Set version label
2828
run: echo 'VERSION=v${{ steps.cabal_file.outputs.version }}' >> "${GITHUB_ENV}"
29-
30-
- name: Load Hackage token secret name
29+
-
3130
id: hackage_token_secret
31+
name: Load Hackage token secret name
3232
run: |
3333
USERNAME="$(echo "${GITHUB_ACTOR}" | tr '[:lower:]' '[:upper:]' | tr '-' '_')"
3434
echo "name=HACKAGE_TOKEN_${USERNAME}" >> "${GITHUB_OUTPUT}"
35-
36-
- name: Get CHANGELOG section
35+
-
36+
name: Get CHANGELOG section
3737
run: |
3838
sed '/^# Unreleased/,/^$/d' CHANGELOG.md > /tmp/changelog-without-unreleased
3939
if [[ "$(head -n 1 /tmp/changelog-without-unreleased)" != "# ${VERSION}" ]]; then
4040
echo "CHANGELOG doesn't look updated" >&2
4141
exit 1
4242
fi
4343
sed '1 d; /^# v/,$ d' /tmp/changelog-without-unreleased > /tmp/changelog-body
44-
45-
- uses: brandonchinn178/haskell-actions/hackage-upload@hackage-upload
44+
-
45+
uses: haskell-actions/hackage-publish@v1
4646
with:
47-
archive: sdist/persistent-mtl-*.tar.gz
48-
token: ${{ secrets[steps.hackage_token_secret.outputs.name] }}
49-
50-
- uses: softprops/action-gh-release@v1
47+
hackageToken: ${{ secrets[steps.hackage_token_secret.outputs.name] }}
48+
packagesPath: ./sdist/
49+
-
50+
uses: softprops/action-gh-release@v1
5151
with:
5252
tag_name: ${{ env.VERSION }}
5353
body_path: /tmp/changelog-body

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@
44
.stack-work/
55
stack-*.yaml.lock
66

7-
.ci/
7+
cabal.project.local*
8+
dist-newstyle/

cabal.project

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
packages: .
2+
3+
program-options
4+
ghc-options: -Werror

package.yaml

+18-19
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,27 @@ extra-source-files:
1212
- README.md
1313
- test/goldens/**/*.golden
1414

15-
ghc-options: -Wall
15+
ghc-options: -Wall -Wcompat -Wunused-packages
1616

1717
github: brandonchinn178/persistent-mtl
1818

1919
library:
2020
source-dirs: src
2121
dependencies:
2222
- base >= 4.14 && < 5
23-
- conduit >= 1.3.4 && < 1.4
24-
- containers >= 0.6 && < 0.7
25-
- exceptions >= 0.10 && < 0.11
26-
- monad-logger >= 0.3 && < 0.4
27-
- mtl >= 2.2.2 && < 2.3
23+
- conduit < 1.4
24+
- containers < 0.7
25+
- exceptions < 0.11
26+
- monad-logger < 0.4
27+
- mtl < 2.4
2828
- persistent >= 2.13 && < 2.15
29-
- resource-pool >= 0.2.3.2 && < 1
30-
- resourcet >= 1.2.4 && < 1.3
31-
- text >= 1.2.4 && < 2.1
32-
- transformers >= 0.5.6 && < 0.6
33-
- unliftio >= 0.2 && < 0.3
34-
- unliftio-core >= 0.2 && < 0.3
35-
- unliftio-pool >= 0.2 && < 1
29+
- resource-pool < 1
30+
- resourcet < 1.4
31+
- text < 2.1
32+
- transformers < 0.7
33+
- unliftio < 0.3
34+
- unliftio-core < 0.3
35+
- unliftio-pool < 1
3636

3737
when:
3838
# https://gitlab.haskell.org/ghc/ghc/-/issues/20836
@@ -53,18 +53,17 @@ tests:
5353
- bytestring
5454
- conduit
5555
- containers
56-
- esqueleto
57-
- explainable-predicates
56+
- esqueleto >= 3.5
57+
- explainable-predicates >= 0.1.2.0
5858
- monad-logger
5959
- persistent
6060
- persistent-mtl
61-
- persistent-postgresql
62-
- persistent-sqlite
63-
- persistent-template
61+
- persistent-postgresql >= 2.13.0.0
62+
- persistent-sqlite >= 2.13.0.3
6463
- resource-pool
6564
- resourcet
6665
- tasty
67-
- tasty-autocollect
66+
- tasty-autocollect >= 0.2.0.0
6867
- tasty-golden
6968
- tasty-hunit
7069
- text

0 commit comments

Comments
 (0)