|
2 | 2 | Contributing to the ``cardano-db-sync`` project
|
3 | 3 | ***********************************************
|
4 | 4 |
|
5 |
| -The ``cardano-db-sync`` development is primarily based on the Nix infrastructure (https://nixos.org/ ), which enables packaging, CI, development environments and deployments. |
| 5 | +The ``cardano-db-sync`` development is primarily based on the Nix infrastructure |
| 6 | +(https://nixos.org/ ), which enables packaging, CI, development environments and |
| 7 | +deployments. |
6 | 8 |
|
7 |
| -On how to set up Nix for ``cardano-db-sync`` development, please see `Building Cardano Node with nix <https://github.com/input-output-hk/cardano-node/tree/master/doc/getting-started/building-the-node-using-nix.md>`_. |
8 |
| - |
9 |
| -Our formater of choice is [`fourmolu`](https://github.com/fourmolu/fourmolu) on version 0.10.1.0 We have a script `scripts/fourmolize.sh` that can be run once fourmolu is intalled locally. |
| 9 | +On how to set up Nix for ``cardano-db-sync`` development, please see `Building Cardano |
| 10 | +Node with nix |
| 11 | +<https://github.com/input-output-hk/cardano-node/tree/master/doc/getting-started/building-the-node-using-nix.md>`_. |
10 | 12 |
|
11 | 13 | Roles and Responsibilities
|
12 | 14 | ==========================
|
13 | 15 |
|
14 |
| -We maintain a [CODEOWNERS file][CODEOWNERS] which provides information who |
| 16 | +We maintain a `CODEOWNERS file <CODEOWNERS_>`_ which provides information who |
15 | 17 | should review a contributing PR. Note that you might need to get approvals
|
16 | 18 | from all code owners (even though GitHub doesn't give a way to enforce it).
|
17 | 19 |
|
18 |
| -[CODEOWNERS]: https://github.com/input-output-hk/cardano-db-sync/blob/master//CODEOWNERS |
| 20 | +Supplementary Tooling |
| 21 | +===================== |
| 22 | + |
| 23 | +Fourmolu |
| 24 | +-------- |
| 25 | + |
| 26 | +`Fourmolu <fourmolu_>`_ is our formatter of choice, version 0.10.1.0. We have a |
| 27 | +script `scripts/fourmolize.sh` that can be run once fourmolu is installed |
| 28 | +locally. |
| 29 | + |
| 30 | +Updating Dependencies |
| 31 | +===================== |
| 32 | + |
| 33 | +From Hackage |
| 34 | +------------ |
| 35 | + |
| 36 | +Updating package dependencies from Hackage should work like normal in a Haskell |
| 37 | +project. The most important thing to note is that we pin the ``index-state`` of |
| 38 | +the Hackage package index in ``cabal.project``. This means that cabal will |
| 39 | +always see Hackage “as if” it was that time, ensuring reproducibility. But it |
| 40 | +also means that if you need a package version that was released *after* that |
| 41 | +time, you need to bump the ``index-state`` (and to run ``cabal update`` |
| 42 | +locally). |
| 43 | + |
| 44 | +Because of how we use Nix to manage our Haskell build, whenever you do this you |
| 45 | +will also need to pull in the Nix equivalent of the newer ``index-state``. You |
| 46 | +can do this by running ``nix flake lock --update-input hackageNix``. |
| 47 | + |
| 48 | +From the Cardano Haskell Package repository |
| 49 | +--------------------------------------------- |
| 50 | + |
| 51 | +Many Cardano packages are not on Hackage and are instead in the `Cardano Haskell |
| 52 | +Package repository <cardano-haskell-packages_>`_ (CHaP), see the README for |
| 53 | +(lots) more information. Getting new packages from there works much like |
| 54 | +getting them from Hackage. The differences are that it has an independent |
| 55 | +``index-state``, and that there is a different Nix command you need to run |
| 56 | +afterwards: ``nix flake lock --update-input CHaP``. |
| 57 | + |
| 58 | +Using unreleased versions of dependencies |
| 59 | +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 60 | + |
| 61 | +Sometimes we need to use an unreleased version of one of our dependencies, |
| 62 | +either to fix an issue in a package that is not under our control, or to |
| 63 | +experiment with a pre-release version of one of our own packages. You can use a |
| 64 | +``source-repository-package`` stanza to pull in the unreleased version. Try |
| 65 | +only to do this for a short time, as it does not play very well with tooling, |
| 66 | +and will interfere with the ability to release cardano-db-sync itself. |
| 67 | + |
| 68 | +For packages that we do not control, we can end up in a situation where we have |
| 69 | +a fork that looks like it will be long-lived or permanent (e.g. the maintainer |
| 70 | +is unresponsive, or the change has been merged but not released). In that case, |
| 71 | +release a patched version to the `Cardano Haskell Package repository |
| 72 | +<cardano-haskell-packages_>`_, which allows us to remove the |
| 73 | +``source-repository-package`` stanza. See the README for instructions. |
| 74 | + |
| 75 | +Releasing a New Version |
| 76 | +======================= |
| 77 | + |
| 78 | +See `<doc/release-process.md>`__ |
| 79 | + |
| 80 | +.. _CODEOWNERS: https://github.com/input-output-hk/cardano-db-sync/blob/master/CODEOWNERS |
| 81 | +.. _cardano-haskell-packages: https://github.com/input-output-hk/cardano-haskell-packages |
| 82 | +.. _fourmolu: https://github.com/fourmolu/fourmolu |
0 commit comments