Skip to content

Commit 4e212b2

Browse files
authored
Merge pull request #10 from input-output-hk/jdral/refactor
Refactoring
2 parents 7ed1a13 + c5ac955 commit 4e212b2

16 files changed

+969
-572
lines changed

.github/workflows/cabal.project.local.Linux

-7
This file was deleted.

.github/workflows/cabal.project.local.Windows

-9
This file was deleted.

.github/workflows/haskell.yml

+37-28
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,25 @@ on:
44
push:
55
branches: [ "master" ]
66
pull_request:
7+
merge_group:
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
712

813
permissions:
914
contents: read
1015

1116
jobs:
17+
# Build and test
1218
build:
13-
1419
runs-on: ${{ matrix.os }}
1520

1621
strategy:
1722
fail-fast: false
1823
matrix:
19-
ghc: ["8.10.7", "9.2.5"]
20-
cabal: ["3.8.1.0"]
24+
ghc: ["8.10.7", "9.2.8", "9.4.8", "9.6.4", "9.8.2"]
25+
cabal: ["3.10.3.0"]
2126
os: [ubuntu-latest, windows-latest, macOS-latest]
2227

2328
steps:
@@ -34,12 +39,11 @@ jobs:
3439
- name: "MacOS: Install system dependencies (brew)"
3540
if: runner.os == 'macOS'
3641
run: |
42+
brew update
3743
brew install pkg-config lmdb
38-
cp ./.github/workflows/lmdb.pc /usr/local/lib/pkgconfig
3944
4045
- name: "Windows: Install system dependencies via pacman (msys2)"
4146
if: runner.os == 'Windows'
42-
shell: pwsh
4347
run: |
4448
ghcup run -- pacman --noconfirm -S `
4549
mingw-w64-x86_64-pkg-config `
@@ -53,48 +57,53 @@ jobs:
5357
5458
- name: Setup Haskell
5559
id: setup-haskell
56-
uses: haskell/actions/setup@v2
60+
uses: haskell-actions/setup@v2
5761
with:
5862
ghc-version: ${{ matrix.ghc }}
5963
cabal-version: ${{ matrix.cabal }}
60-
cabal-update: false
64+
cabal-update: true
6165

62-
- name: "Linux/MacOS: Configure cabal.project.local"
63-
if: runner.os != 'Windows'
64-
run: |
65-
cp .github/workflows/cabal.project.local.Linux cabal.project.local
66-
67-
- name: "Windows: configure cabal.project.local"
68-
if: runner.os == 'Windows'
66+
- name: Configure the build
6967
run: |
70-
cp .github/workflows/cabal.project.local.Windows cabal.project.local
71-
72-
- name: Cabal update
73-
run: cabal update
68+
cabal configure --enable-tests --enable-benchmark --ghc-options="-Werror" --ghc-options="-fno-ignore-asserts"
69+
cat cabal.project.local
7470
7571
- name: Record cabal dependencies
7672
id: record-deps
7773
run: |
7874
cabal build all --dry-run
7975
80-
- name: Cache cabal store
81-
uses: actions/cache@v3
76+
- name: "Restore cache"
77+
uses: actions/cache/restore@v4
78+
id: restore-cabal-cache
8279
env:
83-
cache-name: cache-cabal
80+
cache-name: cache-cabal-build
8481
with:
8582
path: ${{ steps.setup-haskell.outputs.cabal-store }}
86-
key: ${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
83+
key: ${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
8784
restore-keys: |
88-
${{ runner.os }}-${{ matrix.ghc }}-build-${{ env.cache-name }}-
89-
${{ runner.os }}-${{ matrix.ghc }}-build-
90-
${{ runner.os }}-${{ matrix.ghc }}-
91-
${{ runner.os }}-
85+
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-${{ hashFiles('**/cabal.project') }}
86+
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-${{ hashFiles('**/*.cabal') }}-
87+
${{ runner.os }}-${{ matrix.ghc }}-${{ env.cache-name }}-
9288
9389
- name: Install cabal dependencies
90+
id: build-dependencies
9491
run: cabal build --only-dependencies --enable-tests --enable-benchmarks all
9592

93+
- name: "Save cache"
94+
uses: actions/cache/save@v4
95+
id: save-cabal-cache
96+
# Note: cache-hit will be set to true only when cache hit occurs for the
97+
# exact key match. For a partial key match via restore-keys or a cache
98+
# miss, it will be set to false.
99+
if: steps.build-dependencies.outcome == 'success' && steps.restore-cabal-cache.outputs.cache-hit != 'true'
100+
with:
101+
path: ${{ steps.setup-haskell.outputs.cabal-store }}
102+
key: ${{ steps.restore-cabal-cache.outputs.cache-primary-key }}
103+
96104
- name: Build
97-
run: cabal build --enable-tests --enable-benchmarks all
105+
run: cabal build all
98106

99107
- name: Run tests
100-
run: cabal test all
108+
run: |
109+
cabal test -j1 --test-show-details=direct all

.github/workflows/lmdb.pc

-11
This file was deleted.

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# Haskell
12
dist
23
dist-*
34
cabal-dev

CHANGELOG.md

+28-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,32 @@
1+
## next release — ????-??-??
2+
3+
### Breaking
4+
5+
* Stricter bounds on `base` dependency: `base >= 4.14 && < 4.20`.
6+
* Stricter bounds on `lmdb` system package dependency: `lmdb >= 0.9 && <0.10`
7+
* Major, minor and patch field versions in `LMDB_Version` changed from `Int` to `CLong`.
8+
* Remove the `Ord` instance for `LMDB_Version`.
9+
* Change `Int` to `CInt` in the `e_code` field in `LMDB_Error`.
10+
* Remove the `Ord` instance for `LMDB_Error`.
11+
* Remove the `Ix` instance for `MDB_ErrCode`.
12+
* Remove `MDB_txnid`.
13+
* Change the type of the `mv_data` field in `MDB_val` from `Ptr Word8` to `Ptr
14+
()`.
15+
* Remove the `Ord` instances for `MDB_stat`.
16+
* Remove the `Ord` instance for `MDB_envinfo`.
17+
* `me_last_txnid` now returns `CSize` instead of `MDB_txnid`.
18+
* Remove the `Ix` instance for` MDB_EnvFlag`.
19+
* Remove the `Ix` instance for `MDB_DbFlag`.
20+
* Remove the `Ix` instance for `MDB_cursor_op`.
21+
* Remove the `Ix` instance for `MDB_WriteFlag`.
22+
23+
### Non-breaking
24+
25+
* No longer depends on the `array` package.
26+
* Add an `Enum` instance for `MDB_ErrCode`.
27+
* Add an `Enum` instance for `MDB_EnvFlag`.
28+
* Add an `Enum` instance for `MDB_DbFlag`.
129

2-
<a id='changelog-0.3.0.0'></a>
330
## 0.3.0.0 — 2023-02-17
431

532
First release of `lmdb` fork. See

CONTRIBUTING.md

+74-3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,74 @@
1-
See [the contributing file in the `ouroboros-network` repository](
2-
https://github.com/input-output-hk/ouroboros-network/blob/master/CONTRIBUTING.md).
3-
We follow consensus guidelines where consensus and network diverge.
1+
# Contributing
2+
3+
## Building
4+
5+
Building the project requires LMDB to be installed on your system. Either build
6+
LMDB from source on any system, or use a package manager on Ubuntu/MacOS, or use
7+
`ghcup` on Windows.
8+
9+
* **Ubuntu**:
10+
```
11+
apt-get update
12+
apt-get install pkg-config liblmdb-dev
13+
```
14+
* **MacOS**:
15+
```
16+
brew update
17+
brew install pkg-config lmdb
18+
```
19+
* **Windows**:
20+
```
21+
ghcup run -- pacman --noconfirm -S `
22+
mingw-w64-x86_64-pkg-config `
23+
mingw-w64-x86_64-lmdb
24+
```
25+
Make sure that the path to the install folder is included in your `PATH`
26+
variable, e.g., "C:\msys64\bin".
27+
28+
29+
The project is built using `ghc` and `cabal`.
30+
31+
```
32+
cabal update
33+
cabal build all
34+
```
35+
36+
## Testing
37+
38+
Tests are run using `cabal`.
39+
40+
```
41+
cabal build all
42+
cabal test all
43+
```
44+
45+
## Code style
46+
47+
There is no strict code style, but try to keep the code style consistent
48+
throughout the repository and favour readability. Code should be well-documented and well-tested.
49+
50+
## Formatting
51+
52+
We enforce no formatter for Haskell or Cabal files, but try to keep the
53+
formatting consistent throughout the repository. We suggest using
54+
`stylish-haskell` and `cabal-fmt` to keep formatting consistent.
55+
56+
## Pull requests
57+
58+
The following are requirements for merging a PR into `master`:
59+
* Each commit should be small and should preferably address one thing. Commit messages should be useful.
60+
* Document and test your changes.
61+
* The PR should have a useful description, and it should link issues that it
62+
resolves (if any).
63+
* Changes introduced by the PR should be recorded in the relevant changelog
64+
files.
65+
* PRs should not bundle many unrelated changes.
66+
* PRs should be approved by at least 1 developer.
67+
* The PR should pass all CI checks.
68+
69+
## Releases
70+
71+
Releases follow the [Haskell Package Versioning Policy](https://pvp.haskell.org/). We use version numbers consisting of 4 parts, like `A.B.C.D`.
72+
* `A.B` is the *major* version number. A bump indicates a breaking change.
73+
* `C` is the *minor* version number. A bump indicates a non-breaking change.
74+
* `D` is the *patch* version number. A bump indicates a small, non-breaking patch.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
[![Haskell CI](https://img.shields.io/github/actions/workflow/status/input-output-hk/haskell-lmdb/haskell.yml?label=Build&style=for-the-badge)](https://github.com/input-output-hk/haskell-lmdb/actions/workflows/haskell.yml)
21
[![handbook](https://img.shields.io/badge/policy-Cardano%20Engineering%20Handbook-informational?style=for-the-badge)](https://input-output-hk.github.io/cardano-engineering-handbook)
2+
[![Haskell CI](https://img.shields.io/github/actions/workflow/status/input-output-hk/haskell-lmdb/haskell.yml?label=Build&style=for-the-badge)](https://github.com/input-output-hk/haskell-lmdb/actions/workflows/haskell.yml)
33

44
# Input-Ouptut fork haskell-lmdb
55

RELEASE_PROCESS.md

-4
This file was deleted.

Setup.hs

-3
This file was deleted.

cabal.project

+5
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
1+
index-state:
2+
-- Bump this if you need newer packages from Hackage
3+
-- current date: put reason of current date here
4+
, hackage.haskell.org 2024-04-03T11:41:05Z
5+
16
packages:
27
.

0 commit comments

Comments
 (0)