Skip to content

Commit 66f1c7c

Browse files
author
Dennis Labordus
committed
Describe how to make a release and moving parts to new file.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent e54776f commit 66f1c7c

File tree

3 files changed

+184
-121
lines changed

3 files changed

+184
-121
lines changed
File renamed without changes.

CONTRIBUTING.md

Lines changed: 6 additions & 121 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,8 @@ Current Definition of Done:
120120
### How-to begin
121121

122122
Before you start your coding journey within the CoMPAS project, there are some things we have to talk about.
123-
Some things that will make your start a little bit easier!
123+
Some things that will make your start a little bit easier!
124+
On the [developing](DEVELOPING.md) page information about tooling can be found.
124125

125126
#### Open Community Calls
126127
It's good to know that every other monday, we are having a so called Open Community Call. Everyone participating in the CoMPAS project can join and talk about and ask question about the CoMPAS project.
@@ -136,11 +137,6 @@ One of the first important things, is to meet the community. Feel free to introd
136137

137138
The Slack channel is the first communication platform within the CoMPAS project (besides email and the Github platform), so if you need help for example you can use Slack!
138139

139-
#### Github
140-
What's Github? It's where you're looking right now! (Joking!).
141-
142-
We are using Github for hosting our Git repositories. Github is being used for creating issues and creating Pull Requests to review / merge each others code.
143-
144140
#### Documenting
145141
A good (open source) project requires documentation.
146142
We have two places for our documentation
@@ -152,109 +148,16 @@ LF Energy has it's own [CoMPAS specific Wiki](https://wiki.lfenergy.org/display/
152148
There is also a [Github Pages](https://com-pas.github.io/compas-architecture/) website for CoMPAS architecture specific topics.
153149

154150
#### Copyright and Licensing
155-
Copyright and license information is done on per-file basis. We use the specification of [REUSE](https://reuse.software/spec/) to ensure that copyright information of the project is clear and can be analuzed in an automated fashion.
151+
Copyright and license information is done on per-file basis. We use the specification of [REUSE](https://reuse.software/spec/)
152+
to ensure that copyright information of the project is clear and can be analuzed in an automated fashion.
156153

157154
Every source code repository within CoMPAS has a Github Action for checking against the REUSE specification.
158155

159156
For more information, check the [Copyright Guidelines](#copyright-guidelines) section.
160157

161-
#### LFX Security Tool
162-
For checking potential security issues, we use the [LFX Security Tool](https://security.lfx.linuxfoundation.org/#/e8b6fdf9-2686-44c5-bbaa-6965d04ad3e1/licenses). The LFX Security Tool scans selected repositories for potential security issues in dependencies. It also scans every license that is being used within a repository and checks if they are compatible within open source projects.
163-
164-
#### SonarCloud
165-
CoMPAS is using [SonarCloud](https://sonarcloud.io/organizations/com-pas/projects) for static code analysis. Every Github repository has a Github Action which automatically pushes the code to SonarCloud with a frequency of the given Github Action (most of the time on each push).
166-
167-
A Pull Request can't be merged before all SonarCloud issues are being fixed!
168-
169158
#### Architecture and technologies
170-
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/).
171-
172-
#### Github Packages
173-
To make artifacts between the different GIT repositories available we are using Guthub Packages to ditribute these.
174-
Every GIT repository can build its artifacts and publish these to Github Packages.
175-
Other GIT repositories can then add Github Packages as Maven repository to their build tool.
176-
See below how to do both action for the specific tools.
177-
178-
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.
179-
Generate a new token here and make sure that the scope "read:packages" is enabled. Use this token below to configure the build tools.
180-
181-
#### Basic Maven
182-
The project uses Maven to manage the build. Most projects use multi-module structures to build all code. A basic command to run Maven is:
183-
```
184-
$ maven clean verify
185-
```
186-
#### Github Packages in Maven
187-
To use Github Packages in Maven an extra repository need to be added to the build process.
188-
```
189-
<repositories>
190-
<repository>
191-
<id>github-packages-compas</id>
192-
<name>Github Packages CoMPAS</name>
193-
<url>https://maven.pkg.github.com/com-pas/*</url>
194-
</repository>
195-
</repositories>
196-
```
197-
Because credentials are needed for Github Packages, these will be passed by using the Settings.xml file.
198-
199-
##### Local Settings.xml
200-
Edit (or create if not already exists) the `~/.m2/settings.xml` file and add the following content:
201-
```xml
202-
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
203-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
204-
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
205-
http://maven.apache.org/xsd/settings-1.0.0.xsd">
206-
207-
<servers>
208-
<server>
209-
<id>github-packages-compas</id>
210-
<username>username</username>
211-
<password>password</password>
212-
</server>
213-
</servers>
214-
215-
</settings>
216-
```
217-
Add this server section. The ID of the server must be the same as the ID found in the previous repository ID, it should map.
218-
Username should be your Github username, password can both be your own [encrypted password](https://maven.apache.org/guides/mini/guide-encryption.html)
219-
or a [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token).
220-
221-
##### Settings.xml during Github Action
222-
During multiple Github Actions (like building and SonarCloud analysis), the `settings.xml` file is also needed because it needs access to the Github Packages
223-
to download certain artifacts. We can do this by adding the following step **before** the Github Packages is needed:
224-
```yaml
225-
- name: Create custom Maven Settings.xml
226-
uses: whelk-io/maven-settings-xml-action@v18
227-
with:
228-
output_file: custom_maven_settings.xml
229-
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
230-
```
231-
This basically creates a custom `settings.xml` at location `custom_maven_settings.xml`. This file can be passed to maven in the next step
232-
by using `mvn -s custom_maven_settings.xml` and perhaps some extra parameters you wish for.
233-
234-
For the `servers` part, we again have the `github-packages-compas` ID that needs to be the same. We have an `OWNER` username (this is the default, because
235-
it needs to have a username) and a password which is the GITHUB_TOKEN that's always available.
236-
237-
#### IDEs
238-
If your IDE is supported by sonarlint (both IntelliJ IDEA and the Eclipse IDE are supported), it is recommended to install it. It provides immediate feedback on most sonar issues. Running tests individually is often possible in IDEs without invoking maven. Please consult the documentation of your IDE for setting up the project through maven integration.
239-
240-
##### Intellij IDEA
241-
Import the project using IDEA's maven integration in the GUI. Install SonarLint. Code!
242-
243-
##### Eclipse IDE
244-
Eclipse IDE has two ways to import maven projects: the eclipse GUI component m2e that understands maven or the maven CLI component maven-eclipse-plugin.
245-
246-
Using maven-eclipse-plugin, it is possible to recreate all the necessary eclipse files from scratch. A practical way to use it and get deterministic results is to remove all existing eclipse files, delete all eclipse projects from the workspace, regenerate all the eclipse files and reimport everything into eclipse as "existing eclipse projects". If all your projects are checked out outside of the eclipse workspace on the file system, then deleting all the projects is even simpler because you can just delete the whole workspace. The whole cycle takes only a few seconds.
247-
```
248-
# Ensure that eclipse is not running
249-
# delete the projects in the GUI, or "rm -rf" all eclipse projects from the workspace
250-
# delete all eclipse files from the file system
251-
$ find . -name .project -o .classpath -o -name .settings -exec rm -rf '{}' \;
252-
# regenerate eclipse files
253-
$ mvn package eclipse:eclipse
254-
# import as existing eclipse projects in the GUI (alternatively, use eclim's :ProjectImportDiscover directly from ViM)
255-
```
256-
257-
After importing the projects with either method, install SonarLint for quicker feedback on potential sonar issues.
159+
For all architecture and technology choices (for example frameworks, build tools, database choices, etcetera),
160+
please check the source code (duh!) and our [CoMPAS Architecture Github Pages](https://com-pas.github.io/compas-architecture/).
258161

259162
#### Adding custom badges to your README
260163
Badges are great for quickly checking several status reports of a specific repository.
@@ -282,24 +185,6 @@ Issues and Pull Requests can be moved on both the Project Boards and on the boar
282185

283186
## Styleguides
284187

285-
### Git Commit Messages
286-
287-
As usual, please start the commit message with a short line describing the commit, then leave a blank line, then give more context and explanations. You can use GitHub's integrations, for exemple to link to existing issues. In general, pull requests with more than one commits will be squashed when merged in master.
288-
289-
### Java StyleGuide
290-
291-
- The project uses modern java, feel free to use any new APIs provided by the current java version (currently java 8).
292-
- New API classes and methods should be documented with javadoc. Write higher level documentation for classes and lower level documentation for methods. For example, ...
293-
- User-facing configuration options and general design decisions should be documented (where?)
294-
- We use standard configurations of well known tools like checkstyle and sonarqube to enforce a coherent coding style, please consult those tools for justifications on these rules.
295-
296-
As a simple yet instructive example, consider ...
297-
```java
298-
/**
299-
* Example?
300-
*/
301-
```
302-
303188
### Copyright Guidelines
304189

305190
Contributing to the CoMPAS project also requires to use correct copyright headers in source files.

DEVELOPING.md

Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Developing for CoMPAS
2+
3+
## Tooling
4+
5+
#### GitHub
6+
What's GitHub? It's where you're looking right now! (Joking!).
7+
8+
We are using GitHub for hosting our Git repositories. GitHub is being used for creating issues and creating Pull
9+
Requests to review / merge each others code.
10+
11+
### LFX Security Tool
12+
For checking potential security issues, we use the [LFX Security Tool](https://security.lfx.linuxfoundation.org/#/e8b6fdf9-2686-44c5-bbaa-6965d04ad3e1/licenses).
13+
The LFX Security Tool scans selected repositories for potential security issues in dependencies.
14+
It also scans every license that is being used within a repository and checks if they are compatible within open source projects.
15+
16+
### SonarCloud
17+
CoMPAS is using [SonarCloud](https://sonarcloud.io/organizations/com-pas/projects) for static code analysis.
18+
Every GitHub repository has a GitHub Action which automatically pushes the code to SonarCloud with a frequency of the given
19+
GitHub Action (most of the time on each push).
20+
21+
A Pull Request can't be merged before all SonarCloud issues are being fixed!
22+
23+
#### GitHub Packages
24+
To make artifacts available between the different GIT repositories we are using GitHub Packages to distribute these.
25+
Every GIT repository can build its artifacts and publish these to GitHub Packages.
26+
Other GIT repositories can then add GitHub Packages as Maven repository to their build tool.
27+
See below how to do both action for the specific tools.
28+
29+
To use GitHub Packages a username and token is needed. The username is your GitHub username. The token can be generate
30+
in GitHub by going to your settings, Developer settings, Personal access tokens.
31+
Generate a new token here and make sure that the scope "read:packages" is enabled. Use this token below to configure the build tools.
32+
33+
#### Basic Maven
34+
The project uses Maven to manage the build. Most projects use multi-module structures to build all code. A basic command to run Maven is:
35+
```
36+
$ maven clean verify
37+
```
38+
39+
#### GitHub Packages in Maven
40+
To use GitHub Packages in Maven an extra repository need to be added to the build process.
41+
```xml
42+
<repositories>
43+
<repository>
44+
<id>github-packages-compas</id>
45+
<name>GitHub Packages CoMPAS</name>
46+
<url>https://maven.pkg.github.com/com-pas/*</url>
47+
</repository>
48+
</repositories>
49+
```
50+
Because credentials are needed for GitHub Packages, these will be passed by using the Settings.xml file.
51+
52+
##### Maven Local Settings.xml for GitHub Packages
53+
Edit (or create if not already exists) the `~/.m2/settings.xml` file and add the following content:
54+
```xml
55+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
56+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
57+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
58+
http://maven.apache.org/xsd/settings-1.0.0.xsd">
59+
60+
<servers>
61+
<server>
62+
<id>github-packages-compas</id>
63+
<username>username</username>
64+
<password>password</password>
65+
</server>
66+
</servers>
67+
68+
</settings>
69+
```
70+
71+
Add this server section. The ID of the server must be the same as the ID found in the previous repository ID, it should map.
72+
Username should be your GitHub username, password can both be your own [encrypted password](https://maven.apache.org/guides/mini/guide-encryption.html)
73+
or a [Personal Access Token](https://docs.github.com/en/github/authenticating-to-github/keeping-your-account-and-data-secure/creating-a-personal-access-token).
74+
75+
## Styleguides
76+
77+
### Git Commit Messages
78+
79+
As usual, please start the commit message with a short line describing the commit, then leave a blank line, then give more context and explanations. You can use GitHub's integrations, for exemple to link to existing issues. In general, pull requests with more than one commits will be squashed when merged in master.
80+
81+
### Java StyleGuide
82+
83+
- The project uses modern java, feel free to use any new APIs provided by the current java version (currently java 8).
84+
- New API classes and methods should be documented with javadoc. Write higher level documentation for classes and lower level documentation for methods. For example, ...
85+
- User-facing configuration options and general design decisions should be documented (where?)
86+
- We use standard configurations of well known tools like checkstyle and sonarqube to enforce a coherent coding style, please consult those tools for justifications on these rules.
87+
88+
As a simple yet instructive example, consider ...
89+
```java
90+
/**
91+
* Example?
92+
*/
93+
```
94+
95+
## IDEs
96+
If your IDE is supported by sonarlint (both IntelliJ IDEA and the Eclipse IDE are supported), it is recommended to install it. It provides immediate feedback on most sonar issues. Running tests individually is often possible in IDEs without invoking maven. Please consult the documentation of your IDE for setting up the project through maven integration.
97+
98+
### Intellij IDEA
99+
Import the project using IDEA's maven integration in the GUI. Install SonarLint. Code!
100+
101+
### Eclipse IDE
102+
Eclipse IDE has two ways to import maven projects: the eclipse GUI component m2e that understands maven or the maven CLI component maven-eclipse-plugin.
103+
104+
Using maven-eclipse-plugin, it is possible to recreate all the necessary eclipse files from scratch. A practical way to use it and get deterministic results is to remove all existing eclipse files, delete all eclipse projects from the workspace, regenerate all the eclipse files and reimport everything into eclipse as "existing eclipse projects". If all your projects are checked out outside of the eclipse workspace on the file system, then deleting all the projects is even simpler because you can just delete the whole workspace. The whole cycle takes only a few seconds.
105+
```
106+
# Ensure that eclipse is not running
107+
# delete the projects in the GUI, or "rm -rf" all eclipse projects from the workspace
108+
# delete all eclipse files from the file system
109+
$ find . -name .project -o .classpath -o -name .settings -exec rm -rf '{}' \;
110+
# regenerate eclipse files
111+
$ mvn package eclipse:eclipse
112+
# import as existing eclipse projects in the GUI (alternatively, use eclim's :ProjectImportDiscover directly from ViM)
113+
```
114+
115+
After importing the projects with either method, install SonarLint for quicker feedback on potential sonar issues.
116+
117+
## GitHub Actions
118+
119+
##### Settings.xml during GitHub Action for GitHub Packages
120+
During multiple GitHub Actions (like building and SonarCloud analysis), the custom `settings.xml` file is needed because it needs access to the GitHub Packages
121+
to download certain artifacts. We can do this by adding the following step **before** the GitHub Packages repository is needed.
122+
123+
```yaml
124+
- name: Create custom Maven Settings.xml
125+
uses: whelk-io/maven-settings-xml-action@v18
126+
with:
127+
output_file: custom_maven_settings.xml
128+
servers: '[{ "id": "github-packages-compas", "username": "OWNER", "password": "${{ secrets.GITHUB_TOKEN }}" }]'
129+
```
130+
131+
This basically creates a custom `settings.xml` at location `custom_maven_settings.xml`. This file can be passed to maven in the next step
132+
by using `mvn -s custom_maven_settings.xml` and perhaps some extra parameters you wish for.
133+
134+
For the `servers` part, we again have the `github-packages-compas` ID that needs to be the same. We have an `OWNER` username (this is the default, because
135+
it needs to have a username) and a password which is the GITHUB_TOKEN that's always available.
136+
137+
## Releasing software
138+
139+
### Create a release
140+
141+
To create a release of the software we are using the release functionality of GitHub. Under the tab 'code' there is a section
142+
'Releases'. When selected all current releases will be displayed, and a new release can be created (draft release).
143+
144+
For every repository that creates a software product (artifacts or docker images) a GitHub Action ('release-project.yml')
145+
is defined. This action runs when a release is created.
146+
```yaml
147+
on:
148+
release:
149+
types: [released]
150+
```
151+
152+
Depending on the type of project different steps will be executed.
153+
Common steps are:
154+
- Checking out the source code,
155+
- Extracting the entered version from the Git Tag.
156+
- Set version using Maven
157+
- Setup Maven settings.xml file
158+
159+
Depending on the type of project other steps will be executed. Some examples are:
160+
- Build and publish the software to GitHub Packages using Maven
161+
- Build and publish the docker image to DockerHub using Maven
162+
- Build and publish the docker image to DockerHub using NPM and Docker
163+
164+
### Publish artifacts using Maven
165+
166+
To publish artifacts to GiHub Packages a distribution section needs to be added to pom.xml of the root.
167+
```xml
168+
<distributionManagement>
169+
<repository>
170+
<id>github-packages-compas</id>
171+
<name>GitHub Packages</name>
172+
<url>https://maven.pkg.github.com/com-pas/"repo-name"</url>
173+
</repository>
174+
</distributionManagement>
175+
```
176+
The ID is the same as the ID used for the repository section [above](#github-packages-in-maven).
177+
This way the same credentials will be used to connect to GitHub Packages as described [above](#maven-local-settingsxml-for-github-packages).
178+
Replace "repo-name" with the name of the repository from CoMPAS.

0 commit comments

Comments
 (0)