Debian Codegraph @

CONTRIBUTING.md

raw
1 # Contributing to Archivista
2
3 We welcome contributions from the community and first want to thank you for
4 taking the time to contribute!
5
6 Before starting, please take some time to familiarize yourself with the [Code of Conduct](CODE_OF_CONDUCT.md).
7
8
9 ## Getting Started
10
11 We welcome many different types of contributions and not all of them need a
12 Pull Request. Contributions may include:
13
14 * New features and proposals
15 * Documentation
16 * Bug fixes
17 * Issue Triage
18 * Answering questions and giving feedback
19 * Helping to onboard new contributors
20 * Other related activities
21
22 ### Setting up your environment
23
24 ### Required Tooling
25 Some tools are required on your system in order to help you with
26 the development process:
27
28 * Git: Archivista is hosted on GitHub, so you will need to have Git installed. For
29 more information, please follow [this guide](https://github.com/git-guides/install-git).
30
31 * GNU Make: The root of the directory contains a `Makefile` for automating development
32 processes. The `make` CLI tool is usually installed by default on most systems
33 (excluding Windows), but you can check if it is installed by running `make --version`
34 on your terminal. If this command is unsuccessful, you will need to find the standard
35 method for installing it for your system. For installing `make` on Windows, please see
36 [here](https://gnuwin32.sourceforge.net/packages/make.html).
37
38 * Go v1.19: Archivista is written in [Go](https://golang.org/), so you
39 will need this installed in order to compile and run the source code.
40
41 * pre-commit: It is a framework for managing and maintaining multi-language
42 pre-commit hooks. It is used to run some checks on the code before it is
43 committed. You can install it by following the instructions
44 [here](https://pre-commit.com/#install).
45
46 * jq: It is a lightweight and flexible command-line JSON processor. It is
47 used to parse JSON files. You can install it by following the instructions
48 [here](https://stedolan.github.io/jq/download/).
49
50 * A Container Runtime: Archivista is a container-based tool, and therefore you might
51 need a container runtime tool installed for development. The most common solution
52 for this is [Docker](https://docs.docker.com/engine/install/), however this is not
53 free on all platforms. If you are using MacOS, [Colima](https://github.com/abiosoft/colima)
54 is a free good alternative, as well as [Rancher Desktop](https://github.com/rancher-sandbox/rancher-desktop).
55 Please note that Archivista is not tested on these alternative tools, so compatibility
56 is not guaranteed.
57
58 #### Getting the Archivista source code
59
60 [Fork](https://docs.github.com/en/get-started/quickstart/fork-a-repo>) the repository on GitHub and
61 [clone](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) it to
62 your local machine:
63 ```console
64 git clone [email protected]:YOUR-USERNAME/archivista.git
65 ```
66 *The command above uses SSH to clone the repository, which we recommend. You can find out more
67 about how to set SSH up with Github [here](https://docs.github.com/en/authentication/connecting-to-github-with-ssh).*
68
69
70 Add a [remote](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/configuring-a-remote-for-a-fork) and
71 regularly [sync](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork) to make sure
72 you stay up-to-date with our repository:
73
74 ```console
75 git remote add upstream https://github.com/in-toto/archivista.git
76 git checkout main
77 git fetch upstream
78 git merge upstream/main
79 ```
80
81 ### Running Archivista Development Environment
82
83 *Please note that the following `make` commands make use of both the `docker` and
84 `docker compose` commands, so you may need to modify this locally if using tools
85 such as [nerdctl](https://github.com/containerd/nerdctl) or [podman](https://github.com/containers/podman).*
86
87 To start the Archivista development environment, simply execute the command:
88 ```console
89 make run-dev
90 ```
91 This will run the Archivista container and its required dependent services.
92 Archivista will be available at http://localhost:8082
93
94 Any changes made to the source code will be reflected in the development environment
95 while it is running, so there is no need to restart it.
96
97 To stop the development environment, run:
98
99 ```console
100 make stop
101 ```
102
103 To clean all Archivista containers in your environment execute the command:
104
105 ```console
106 make clean
107 ```
108
109 ### Changes in the Archivista SQL Schema `ent/schema`
110
111 If there are changes in the SQL Schema you must to create the database migration.
112 To do this, you must run the following command:
113
114 ```console
115 make db-migrations
116 ```
117
118 ### Running Tests
119
120 You can run all the tests by executing the command:
121
122 ```console
123 make test
124 ```