From bde2ce4b6b34a9b4a43c82db129c538c71088dd6 Mon Sep 17 00:00:00 2001
From: Mathieu Soysal <43273304+MathieuSoysal@users.noreply.github.com>
Date: Sat, 30 Dec 2023 19:38:17 +0000
Subject: [PATCH 1/2] Remove unused GitHub Actions workflows
---
.github/workflows/codeql-analysis.yml | 48 ------------------
.github/workflows/javadoc-publish.yml | 28 -----------
.github/workflows/javadoc-tester.yml | 23 ---------
.github/workflows/maven-library-publish.yml | 55 ---------------------
.github/workflows/maven.yml | 26 ----------
.github/workflows/sonar.yml | 37 --------------
6 files changed, 217 deletions(-)
delete mode 100644 .github/workflows/codeql-analysis.yml
delete mode 100644 .github/workflows/javadoc-publish.yml
delete mode 100644 .github/workflows/javadoc-tester.yml
delete mode 100644 .github/workflows/maven-library-publish.yml
delete mode 100644 .github/workflows/maven.yml
delete mode 100644 .github/workflows/sonar.yml
diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
deleted file mode 100644
index 034e3fe90..000000000
--- a/.github/workflows/codeql-analysis.yml
+++ /dev/null
@@ -1,48 +0,0 @@
-name: "CodeQL"
-
-on:
- push:
- branches: [ master ]
- pull_request:
- # The branches below must be a subset of the branches above
- branches: [ master ]
- schedule:
- - cron: '41 14 * * 4'
-
-jobs:
- analyze:
- name: Analyze
- runs-on: ubuntu-latest
- permissions:
- actions: read
- contents: read
- security-events: write
-
- strategy:
- fail-fast: false
- matrix:
- language: [ 'java' ]
- # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
- # Learn more about CodeQL language support at https://git.io/codeql-language-support
-
- steps:
- - name: Checkout repository
- uses: actions/checkout@v2
-
- # Initializes the CodeQL tools for scanning.
- - name: Initialize CodeQL
- uses: github/codeql-action/init@v1
- with:
- languages: ${{ matrix.language }}
-
- - name: setup-java
- uses: actions/setup-java@v2
- with:
- distribution: 'adopt'
- java-version: 17
-
- - name: mvn-clean-install
- run: mvn clean install
-
- - name: Perform CodeQL Analysis
- uses: github/codeql-action/analyze@v1
diff --git a/.github/workflows/javadoc-publish.yml b/.github/workflows/javadoc-publish.yml
deleted file mode 100644
index 2d48f3557..000000000
--- a/.github/workflows/javadoc-publish.yml
+++ /dev/null
@@ -1,28 +0,0 @@
-name: Deploy Javadoc
-
-on:
- push:
- branches:
- - master
-
-jobs:
- publish:
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 0
- - uses: actions/setup-java@v2
- with:
- java-version: 17
- distribution: 'adopt'
- - name: Generate Javadoc
- run: mvn org.apache.maven.plugins:maven-javadoc-plugin:3.3.1:aggregate
- - name: Deploy 🚀
- uses: JamesIves/github-pages-deploy-action@4.1.8
- with:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- BRANCH: javadoc
- CLEAN: true
- FOLDER: target/site/apidocs
- TARGET_FOLDER: javadoc
diff --git a/.github/workflows/javadoc-tester.yml b/.github/workflows/javadoc-tester.yml
deleted file mode 100644
index 8cb057c1a..000000000
--- a/.github/workflows/javadoc-tester.yml
+++ /dev/null
@@ -1,23 +0,0 @@
-name: JavaDoc tester
-
-on:
- push:
- branches: [ master, main ]
- pull_request:
- branches: [ master, main ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- java-version: '17'
- distribution: 'adopt'
- cache: maven
- - name: Javadoc with Maven
- run: mvn -PossrhDeploy javadoc:javadoc
\ No newline at end of file
diff --git a/.github/workflows/maven-library-publish.yml b/.github/workflows/maven-library-publish.yml
deleted file mode 100644
index 492140e10..000000000
--- a/.github/workflows/maven-library-publish.yml
+++ /dev/null
@@ -1,55 +0,0 @@
-name: Maven Library Publish
-
-on:
- release:
- types: [created]
-
-jobs:
- publish:
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
-
- - name: Get the release version
- id: get_version
- run: echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
-
- - name: Set up JDK 17 for deploy to OSSRH
- uses: actions/setup-java@v2
- with:
- distribution: 'adopt'
- java-version: 17
- server-id: ossrh
- server-username: MAVEN_USERNAME
- server-password: MAVEN_CENTRAL_TOKEN
- gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}
- gpg-passphrase: MAVEN_GPG_PASSPHRASE
-
- - name: Build with Maven
- run: mvn -B package --file pom.xml
-
- - name: Update package version
- run: mvn versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
-
- - name: Prepare Maven environnement with Java 17 for deployment to OSSRH
- run: export MAVEN_OPTS="--add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.base/java.text=ALL-UNNAMED --add-opens=java.desktop/java.awt.font=ALL-UNNAMED"
-
- - name: Publish to Apache Maven Central
- run: mvn deploy -PossrhDeploy
- env:
- MAVEN_USERNAME: ${{ secrets.NEXUS_USERNAME }}
- MAVEN_CENTRAL_TOKEN: ${{ secrets.NEXUS_PASSWORD }}
- MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
-
- - name: Set up JDK 17 for deploy to github packages
- uses: actions/setup-java@v2
- with:
- distribution: 'adopt'
- java-version: 17
- server-id: github
-
- - name: Publish to GitHub Packages Apache Maven
- run: mvn deploy -PgithubDeploy
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
deleted file mode 100644
index bc27c8dbf..000000000
--- a/.github/workflows/maven.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
-# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven
-
-name: Java CI with Maven
-
-on:
- push:
- branches: [ master ]
- pull_request:
- branches: [ master ]
-
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v2
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- java-version: '17'
- distribution: 'adopt'
- cache: maven
- - name: Build with Maven
- run: mvn -B package --file pom.xml
diff --git a/.github/workflows/sonar.yml b/.github/workflows/sonar.yml
deleted file mode 100644
index 9113a2773..000000000
--- a/.github/workflows/sonar.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-name: Build
-on:
- push:
- branches:
- - master
- pull_request:
- types: [opened, synchronize, reopened]
-jobs:
- build:
- name: Build
- runs-on: ubuntu-latest
- steps:
- - uses: actions/checkout@v2
- with:
- fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- - name: Set up JDK 17
- uses: actions/setup-java@v2
- with:
- distribution: 'adopt'
- java-version: 17
- - name: Cache SonarCloud packages
- uses: actions/cache@v1
- with:
- path: ~/.sonar/cache
- key: ${{ runner.os }}-sonar
- restore-keys: ${{ runner.os }}-sonar
- - name: Cache Maven packages
- uses: actions/cache@v1
- with:
- path: ~/.m2
- key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
- restore-keys: ${{ runner.os }}-m2
- - name: Build and analyze
- env:
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
- SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- run: mvn -B verify org.sonarsource.scanner.maven:sonar-maven-plugin:sonar -Dsonar.projectKey=MathieuSoysal_Java-Maven-library-template
From 401ee740eaea97035903451c3190fecafe91cd71 Mon Sep 17 00:00:00 2001
From: Mathieu Soysal <43273304+MathieuSoysal@users.noreply.github.com>
Date: Sat, 30 Dec 2023 19:38:39 +0000
Subject: [PATCH 2/2] Add release workflow for building and testing the project
---
.github/workflows/release.yml | 29 +++++++++++++++++++++++++++++
pom.xml | 2 +-
2 files changed, 30 insertions(+), 1 deletion(-)
create mode 100644 .github/workflows/release.yml
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 000000000..cdf7a2054
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,29 @@
+name: Release
+on:
+ release:
+ types:
+ - created
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - uses: actions/setup-java@v3
+ with:
+ distribution: 'temurin'
+ java-version: '17'
+ - name: Build & Install
+ run: mvn -B install -D skipTests --no-transfer-progress
+ - name: Install Playwright
+ run: mvn exec:java -e -D exec.mainClass=com.microsoft.playwright.CLI -D exec.args="install --with-deps"
+ - name: Run tests
+ run: mvn clean install -D skipTests --no-transfer-progress
+ env:
+ MAIL : ${{ secrets.TEST_MAIL }}
+ PASSWORD : ${{ secrets.TEST_PASSWORD }}
+
+ - uses: shogo82148/actions-upload-release-asset@v1
+ with:
+ upload_url: ${{ github.event.release.upload_url }}
+ asset_path: target/logement-crous-1.0.jar
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 0bac4f10e..bf5a5c8f5 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
io.github.mathieusoysal
logement-crous
- 1.0-SNAPSHOT
+ 1.0
jar