Skip to content

Commit 709990e

Browse files
Dennis LabordusRob Tjalma
authored andcommitted
Added Github packages and gradle to contributing.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 1c1bfbf commit 709990e

File tree

2 files changed

+60
-0
lines changed

2 files changed

+60
-0
lines changed

.gitignore

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: 2021 Alliander N.V.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
# IDE specific
6+
.vscode/
7+
.idea
8+
9+
# General
10+
.DS_Store
11+
target
12+
*.iml
13+
.settings
14+
.project
15+
.classpath
16+
out
17+
lib
18+
bin
19+
.java-version
20+
*.orig
21+
*.rej
22+
*.swp
23+
*.swo
24+
.cache
25+
build
26+

CONTRIBUTING.md

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,40 @@ A Pull Request can't be merged before all SonarCloud issues are being fixed!
168168
#### Architecture and technologies
169169
For all architecture and technology choices (for example frameworks, build tools, database choices, etcetera), please check the source code (duh!) and our [CoMPAS Architecture Github Pages](https://com-pas.github.io/compas-architecture/).
170170

171+
#### Github Packages
172+
To make artifacts between the different GIT repositories available we are using Guthub Packages to ditribute these.
173+
Every GIT repository can build its artifacts and publish these to Github Packages.
174+
Other GIT repositories can then add Github Packages as Maven repository to their build tool.
175+
See below how to do both action for the specific tools.
176+
177+
To use Github Packages a username and token is needed. The username is your Github username. The token can be genreate in Github by going to your settings, Developer settings, Personal access tokens.
178+
Generate a new token here and make sure that the scope "read:packages" is enabled. Use this token below to configure the build tools.
179+
180+
#### Basic Gradle
181+
The project uses Gradle to manage the build. Most projects use multi-module structures to build all code. A basic command to run gradle is:
182+
```
183+
$ gradle build
184+
```
185+
#### Github Packages in Gradle
186+
To use Github Packages in Gradle an extra repository need to be added to the build process.
187+
```
188+
repositories {
189+
...
190+
maven {
191+
name = "GitHubPackages"
192+
url = uri("https://maven.pkg.github.com/com-pas/*")
193+
credentials {
194+
username = project.hasProperty('githubUsername') ? project.getProperty("githubUsername") : System.getenv("GITHUB_USERNAME")
195+
password = project.hasProperty('githubToken') ? project.getProperty("githubToken") : System.getenv("GITHUB_TOKEN")
196+
}
197+
}
198+
...
199+
}
200+
```
201+
Because credentials are needed for Github Packages these can be passed in 2 different ways.
202+
- First solution is to added the properties "githubUsername" and "githubToken" to your gradle.properties in your home directory (~/.gradle/gradle.properties). This solution doesn't seem to work with Intellij IDEA.
203+
- The second solution is to create two environment properties "GITHUB_USERNAME" and "GITHUB_TOKEN". This ones is also used by Github Actions.
204+
171205
#### Basic Maven Usage
172206
The project uses maven to manage the build. The configuration of all the tools is fairly standard, so if you have already contributed to Java projects, you should feel right at home. You can safely run the full test suite, checkstyle, see code coverage information and the generated documentation with the following command:
173207
```

0 commit comments

Comments
 (0)