Skip to content

Commit

Permalink
Finishing
Browse files Browse the repository at this point in the history
  • Loading branch information
javiertuya committed Jun 7, 2023
1 parent abdc785 commit a01998c
Show file tree
Hide file tree
Showing 10 changed files with 86 additions and 19 deletions.
19 changes: 19 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: 2
updates:
- package-ecosystem: maven
directory: "/java"
schedule:
interval: weekly
day: "friday"
assignees:
- "javiertuya"
open-pull-requests-limit: 20

- package-ecosystem: github-actions
directory: "/"
schedule:
interval: weekly
day: "friday"
open-pull-requests-limit: 20
assignees:
- "javiertuya"
42 changes: 42 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Publish to Maven and NuGet
on:
release:
types: [created]
jobs:
release-java:
#if: ${{ false }} # disable for now
runs-on: ubuntu-latest

steps:
- name: Checkout GitHub repo
uses: actions/checkout@v3

#Official documentation seems incomplete. To avoid failure when importing key:
#https://stackoverflow.com/questions/61096521/how-to-use-gpg-key-in-github-actions
#It requires export the private key with the armor option: gpg --output private.pgm --armor --export-secret-key <email>
- name: Import GPG Key
uses: crazy-max/[email protected]
with:
gpg_private_key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
passphrase: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

# uncomment to activate publish
# - name: Set up Apache Maven Central
# uses: actions/setup-java@v3
# with: # running setup-java again overwrites the settings.xml
# distribution: 'temurin'
# java-version: '8'
# server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
# server-username: MAVEN_USERNAME # env variable for username in deploy
# server-password: MAVEN_CENTRAL_TOKEN # env variable for token in deploy
# gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
# gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase

# uncomment to activate publish
# - name: Publish to Apache Maven Central
# run: mvn deploy -P publish-maven -DskipTests=true -Dmaven.test.failure.ignore=true -U --no-transfer-progress
# env:
# MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
# MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
# MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}

8 changes: 3 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- 'dependabot/**' #avoid duplicates: only run the PR, not the commit
- 'gh-pages' #github pages do not trigger all tests
tags-ignore:
- 'v*' #avoids rerun existing commit on release
- 'v*' #avoid rerun existing commit on release
pull_request:
branches:
- 'main'
Expand Down Expand Up @@ -50,9 +50,8 @@ jobs:
sonarqube:
needs: [test-java]
#if: ${{ false }} # disable for now
#this job fails when comming from a dependabot PR (can't read the sonarqube token). Discussion and workarounds:
#https://community.sonarsource.com/t/youre-not-authorized-to-run-analysis-and-github-bots/41994/4
#https://github.com/dependabot/dependabot-core/issues/3253#issuecomment-797125425
#This job fails when comming from a dependabot PR (can't read the sonarqube token for security reasons).
#Links to discussions and workaround at: https://github.com/giis-uniovi/samples-giis-template/issues/4
if: ${{ github.actor != 'dependabot[bot]' }}
runs-on: ubuntu-latest
steps: #Recommended Sonarcloud configuration
Expand Down Expand Up @@ -132,7 +131,6 @@ jobs:
# manage package versions shows the date in which branch was created, not executed
# if no changing version number, this will keep latest 2 branches BY BRANCH CREATION
# because of this, deletion must be done BEFORE deploy (if not, a version of old branch can be deleted after being updated)
# TODO check how to exclude current branch
# NOTE at least one package must exist, if not the build fails (comment for the first build)
- name: Cleanup old packages
#if: ${{ false }} # disable for now
Expand Down
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
target
pom.xml.versionsBackup
TESTS-TestSuites.xml
*/dat/out
*.db
#para que cada uno personalice su sonarlint
*/dat/out
# to allow each developer customize sonarlint
org.sonarlint.eclipse.core.prefs

8 changes: 5 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,10 @@

Template project, includes:
- Configuration of a maven multimodule java project
- Aggregate test reports (surefire and junit formats)
- Aggregated test reports (surefire and junit style)
- SonarQube static test (includes coverage results)
- Generate snapshots for each branch (published to GitHub Packages)
- Publish a snapshot for each branch to GitHub Packages
- Publish releases to Maven Central (deactivated)

See the general contribution policies and guidelines for giis-uniovi at [CONTRIBUTING.md](https://github.com/giis-uniovi/.github/blob/main/profile/CONTRIBUTING.md).
See the general contribution policies and guidelines for **giis-uniovi* at
[CONTRIBUTING.md](https://github.com/giis-uniovi/.github/blob/main/profile/CONTRIBUTING.md).
7 changes: 3 additions & 4 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<version>0.0.1-SNAPSHOT</version>
<packaging>pom</packaging>
<name>samples-giis-template</name>
<description>Multimodule maven template project</description>
<description>Multimodule maven project template</description>
<url>http://github.com/giis-uniovi/samples-giis-template</url>
<organization>
<name>Grupo de Investigacion en Ingenieria del Software - Universidad de Oviedo</name>
<name>Software Engineering Research Group (GIIS) - Universidad de Oviedo, ES</name>
<url>http://giis.uniovi.es/</url>
</organization>
<properties>
Expand Down Expand Up @@ -107,7 +107,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<version>3.1.0</version>
<executions>
<!-- Consolida reports formato junit en el proyecto principal para ser mostrados en jenkins -->
<!-- Aggregate junit style reports -->
<execution>
<id>junit-reports</id>
<phase>test</phase>
Expand Down Expand Up @@ -176,7 +176,6 @@
</build>
<developers>
<developer>
<id>javiertuya</id>
<name>Javier Tuya</name>
<url>http://giis.uniovi.es</url>
</developer>
Expand Down
5 changes: 4 additions & 1 deletion samples-giis-template-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
</parent>
<artifactId>samples-giis-template-bom</artifactId>
<packaging>pom</packaging>
<name>samples-giis-template-bom</name>
<description>Multimodule maven project template, bill of materials</description>
<url>http://github.com/giis-uniovi/samples-giis-template</url>
<organization>
<name>Software Engineering Research Group - Universidad de Oviedo</name>
<name>Software Engineering Research Group (GIIS) - Universidad de Oviedo, ES</name>
<url>http://giis.uniovi.es/</url>
</organization>
<dependencyManagement>
Expand Down
5 changes: 4 additions & 1 deletion samples-giis-template-m1/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
</parent>
<artifactId>samples-giis-template-m1</artifactId>
<packaging>jar</packaging>
<name>samples-giis-template-m1</name>
<description>Multimodule maven project template, module without dependencies</description>
<url>http://github.com/giis-uniovi/samples-giis-template</url>
<organization>
<name>Software Engineering Research Group - Universidad de Oviedo</name>
<name>Software Engineering Research Group (GIIS) - Universidad de Oviedo, ES</name>
<url>http://giis.uniovi.es/</url>
</organization>
<dependencies>
Expand Down
5 changes: 4 additions & 1 deletion samples-giis-template-m2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,11 @@
</parent>
<artifactId>samples-giis-template-m2</artifactId>
<packaging>jar</packaging>
<name>samples-giis-template-m2</name>
<description>Multimodule maven project template, module with dependencies</description>
<url>http://github.com/giis-uniovi/samples-giis-template</url>
<organization>
<name>Software Engineering Research Group - Universidad de Oviedo</name>
<name>Software Engineering Research Group (GIIS) - Universidad de Oviedo, ES</name>
<url>http://giis.uniovi.es/</url>
</organization>
<dependencies>
Expand Down
1 change: 0 additions & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ sonar.projectKey=my:samples-giis-template
sonar.projectName=samples-giis-template
sonar.projectVersion=1.0
sonar.java.source=1.8
#excluye app, runner, xml, ui, se consideran deprecated
sonar.modules=samples-giis-template-m1,samples-giis-template-m2
sonar.sources=src/main/java
sonar.sourceEncoding=UTF-8
Expand Down

0 comments on commit a01998c

Please sign in to comment.