diff --git a/.github/workflows/close-milestone.yml b/.github/workflows/close-milestone.yml
new file mode 100644
index 00000000..7d40075d
--- /dev/null
+++ b/.github/workflows/close-milestone.yml
@@ -0,0 +1,39 @@
+# Description
+# ===========
+# This workflow is triggered each time the Java CI workflow succeeds
+# on master.
+# It looks for a milestone that is completed and close it.
+---
+name: Close Milestone
+
+on:
+ workflow_run:
+ workflows: ["Java CI"]
+ branches: [master]
+ types:
+ - completed
+
+jobs:
+ close:
+ name: Close completed milestone
+ runs-on: ubuntu-latest
+ if: ${{ github.event.workflow_run.conclusion == 'success' }}
+ steps:
+ - name: Close a milestone if completed
+ run: |
+ milestones=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
+ https://api.github.com/repos/${{ github.repository }}/milestones \
+ | jq -r '. | map(select(.open_issues == 0 and .closed_issues > 0 and .state == "open"))')
+ if [ "$milestones" != "[]" ]
+ then
+ milestone_number=$(echo "$milestones" | jq -r '.[0].number')
+ curl -s \
+ -X PATCH \
+ -H "Authorization: token ${GITHUB_TOKEN}" \
+ -H "Accept: application/vnd.github.v3+json" \
+ https://api.github.com/repos/${{ github.repository }}/milestones/${milestone_number} \
+ -d '{"state":"closed"}'
+ fi
+ env:
+ # Personal access tokens should be generated from https://github.com/settings/tokens with repository scope
+ GITHUB_TOKEN: ${{ secrets.REPO_SCOPED_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml
new file mode 100644
index 00000000..5c1acaeb
--- /dev/null
+++ b/.github/workflows/draft-release.yml
@@ -0,0 +1,57 @@
+# Description
+# ===========
+# This workflow is triggered each time a milestone is closed
+# It builds the jar, generates release notes, pushes a new tag
+# and makes a draft release with these elements.
+---
+name: Draft Release
+
+on:
+ milestone:
+ types: [closed]
+
+jobs:
+ release:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout@v2
+ - name: Setup java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'adopt'
+ java-version: '11'
+ - name: Cache Maven packages
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Build with Maven
+ run: mvn -B clean package
+ - name: Create Release Notes
+ uses: docker://decathlon/release-notes-generator-action:2.0.1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ OUTPUT_FOLDER: temp_release_notes
+ - name: Set tag and project values
+ run: |
+ echo "tag=$(cat pom.xml | grep ".*" | head -1 |awk -F'[><]' '{print $3}')" >> $GITHUB_ENV
+ echo "project=$(echo ${{ github.repository }} | awk -F '/' '{print $2}')" >> $GITHUB_ENV
+ - name: Create a tag for the release
+ run: |
+ git config --global user.name "GitHub Actions"
+ git config --global user.email catlab@cnes.fr
+ git tag -a ${{ env.tag }} -m "Release ${{ env.tag }}"
+ git push origin ${{ env.tag }}
+ - name: Create GitHub Release
+ uses: ncipollo/release-action@v1
+ env:
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ with:
+ artifacts: "target/${{ env.project }}-${{ env.tag }}.jar"
+ tag: ${{ env.tag }}
+ name: ${{ env.project }} ${{ env.tag }}
+ bodyFile: "temp_release_notes/release_file.md"
+ draft: true
+ token: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
diff --git a/.github/workflows/java-continuous-integration.yml b/.github/workflows/java-continuous-integration.yml
new file mode 100644
index 00000000..daa036e3
--- /dev/null
+++ b/.github/workflows/java-continuous-integration.yml
@@ -0,0 +1,128 @@
+# Description
+# ===========
+# This workflow is triggered each time
+# commits are pushed to GitHub or a pull request is opened.
+# It launches three jobs in parallel : a build with java 8,
+# a build with java 11 and a SonarCloud analysis.
+---
+name: Java CI
+
+on: [push, pull_request]
+
+env:
+ SONARQUBE_VERSION: 8.9.0-community
+
+jobs:
+
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ matrix:
+ java: [ '8', '11' ]
+ name: Java ${{ matrix.Java }} CI
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0
+ - name: Setup java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'adopt'
+ java-version: ${{ matrix.java }}
+ - name: Cache Maven packages
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Cache node_modules
+ uses: actions/cache@v2
+ with:
+ path: node_modules
+ key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
+ restore-keys: ${{ runner.os }}-yarn-
+ - name: Build with Maven
+ run: mvn -B clean package
+ - name: Test cnes-report
+ env:
+ SONARQUBE_VERSION: 8.9.0-community
+ run: |
+ version=$(cat pom.xml | grep ".*" | head -1 |awk -F'[><]' '{print $3}');
+ echo "Starting docker";
+ docker run --name sonarqube_${SONARQUBE_VERSION} -d -p 9000:9000 sonarqube:${SONARQUBE_VERSION};
+ echo "Inject plugin";
+ docker cp target/sonar-cnes-report-${version}.jar sonarqube_${SONARQUBE_VERSION}:/opt/sonarqube/extensions/plugins/;
+ docker exec -u root sonarqube_${SONARQUBE_VERSION} chown sonarqube:sonarqube /opt/sonarqube/extensions/plugins/sonar-cnes-report-${version}.jar;
+ docker restart sonarqube_${SONARQUBE_VERSION};
+ echo "Waiting up to 5 minutes for SonarQube...";
+ counter=0;
+ limit=300;
+ status_sonar=$(curl -s "http://localhost:9000/api/system/status" | grep "\"status\":\"UP\"" > /dev/null; echo $?);
+ while [[ 0 -ne $status_sonar && $counter -le $limit ]]; do
+ sleep 1;
+ counter=$(( $counter + 1 ));
+ status_sonar=$(curl -s "http://localhost:9000/api/system/status" | grep "\"status\":\"UP\"" > /dev/null; echo $?);
+ done;
+ mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.login=admin -Dsonar.password=admin -Dsonar.organization=default-organization;
+ echo "Waiting for the SonarQube Compute Engine task to be completed...";
+ ce=$(grep ceTaskUrl= target/sonar/report-task.txt);
+ ceTaskUrl=${ce:10};
+ continue=true;
+ while [ $continue = true ]; do
+ status=$(curl -s -u admin:admin ${ceTaskUrl} | jq -r '.task.status');
+ if [ $status = SUCCESS ]
+ then
+ continue=false;
+ elif [ $status = FAILED ] || [ $status = CANCELED ]
+ then
+ exit 1;
+ else
+ sleep 1;
+ fi
+ done;
+ token_sonarqube=$(curl -s -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "name=admin_token" -u admin:admin http://localhost:9000/api/user_tokens/generate | jq -r '.token');
+ java -jar target/sonar-cnes-report-${version}.jar -t ${token_sonarqube} -p fr.cnes.sonar:cnesreport -s http://localhost:9000;
+ url_cnesreport="http://localhost:9000/api/cnesreport/report?key=fr.cnes.sonar%3Acnesreport&author=github-actions&token=${token_sonarqube}";
+ curl -u admin:admin ${url_cnesreport} -O -J;
+
+ code-analysis:
+ runs-on: ubuntu-latest
+ name: SonarCloud Code Analysis
+ # It's not possible to launch an analysis on external pull requests
+ if: ${{ github.repository_owner == 'cnescatlab' }}
+ steps:
+ - name: Check out repository code
+ uses: actions/checkout@v2
+ with:
+ fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
+ - name: Setup java
+ uses: actions/setup-java@v2
+ with:
+ distribution: 'adopt'
+ java-version: '11'
+ - name: Cache Maven packages
+ uses: actions/cache@v2
+ with:
+ path: ~/.m2
+ key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
+ restore-keys: ${{ runner.os }}-m2
+ - name: Cache node_modules
+ uses: actions/cache@v2
+ with:
+ path: node_modules
+ key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
+ restore-keys: ${{ runner.os }}-yarn-
+ - name: Cache SonarCloud packages
+ uses: actions/cache@v2
+ with:
+ path: ~/.sonar/cache
+ key: ${{ runner.os }}-sonar
+ restore-keys: ${{ runner.os }}-sonar
+ - name: Build and analyze
+ env:
+ # Needed to get some information about the pull request, if any
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ # SonarCloud access token should be generated from https://sonarcloud.io/account/security/
+ SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
+ run: mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar -Dsonar.organization=lequal -Dsonar.host.url=https://sonarcloud.io -Dsonar.login=$SONAR_TOKEN
\ No newline at end of file
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 70125430..00000000
--- a/.travis.yml
+++ /dev/null
@@ -1,73 +0,0 @@
-dist: bionic
-language: java
-install: true
-
-services:
- - docker
-
-addons:
- sonarcloud:
- organization: "lequal"
- token:
- secure: "alIypi5kcdqBeX8z1z82iFHwUrNZ1ICke2rUn6eZNyiBxnOBXMqWGUtTZYtkmYMBLZK06pTJ/jtgdyWOwfdw5zZ59cQwylOhWhXK9QRmPJzdeQWPxbRDVbd+c7LWTXOA0WBh96Htzjoz1kd6SaheozsAfxEhhiekvE6gaMMk0ac+hufeUFF80KUDaoY92cu/xqHmWYn4srVvLpSO6WYzAAlCaPu6ugv009qHai0CyURSNqV8KQO+lBiNNrYUf3v1/LffelMA92w0/hqID89l2mWH4rOa5jx97wfc3Ae7pB3MFvG+qTKk24enYAJG8U+HkDkIt8R13w0Cj55wKno9S0LAKIND59BiayiWyhrCjOd2M/KUYwtF/VkqZwZNepoYQe7AY7bHNkZ52Npum/+6c79fMMn4mxDsSjt6PFcBWd0bVpkpDKlimRe7NZ3mh7plobPU8mwzeCE2Rrsw6aKaU0MHR9EFEsI1pfgrjCDdHjnIgrPOYXHY5dkwUkybXin2QJu4pCYWuTg57MAdvnvaydoZxDcChm6VLmQrKUpRFvzyOyWlbRtq/SVWc6mLPzrCucaIB4zK1GKTeDCku+OAfznuA0w4OrDAF/U9DWQl+/mR7MZuD2NMjYO4zk9R5prDqDbvYgh/vvKygnk3oHo2eUDvknw6CbvRueDpplfgIwE="
-
-
-jdk:
- - openjdk8
- - openjdk11
-
-env:
- - sonarqube: none
- - sonarqube: 8.9.0-community
-
-script:
- - if [ $sonarqube != "none" ]; then
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package;
- mvn clean package;
- echo "Starting docker";
- docker run --name sonarqube_${sonarqube} -d -p 9000:9000 sonarqube:${sonarqube};
- echo "Inject plugin";
- docker cp target/sonar-cnes-report.jar sonarqube_${sonarqube}:/opt/sonarqube/extensions/plugins/;
- docker exec -u root sonarqube_${sonarqube} chown sonarqube:sonarqube /opt/sonarqube/extensions/plugins/sonar-cnes-report.jar;
- docker restart sonarqube_${sonarqube};
- echo "Waiting up to 5 minutes for SonarQube...";
- counter=0;
- limit=300;
- status_sonar=$(curl -s "http://localhost:9000/api/system/status" | grep "\"status\":\"UP\"" > /dev/null; echo $?);
- while [[ 0 -ne $status_sonar && $counter -le $limit ]]; do
- sleep 1;
- counter=$(( $counter + 1 ));
- status_sonar=$(curl -s "http://localhost:9000/api/system/status" | grep "\"status\":\"UP\"" > /dev/null; echo $?);
- done;
- mvn sonar:sonar -Dsonar.host.url=http://localhost:9000 -Dsonar.login=admin -Dsonar.password=admin -Dsonar.organization=default-organization -Dsonar.branch.name= ;
- token_sonarqube=$(curl -X POST -H "Content-Type: application/x-www-form-urlencoded" -d "name=admin_token" -u admin:admin http://localhost:9000/api/user_tokens/generate | jq -r '.token');
- cd target;
- java -jar sonar-cnes-report.jar -t ${token_sonarqube} -p fr.cnes.sonar:cnesreport -s http://localhost:9000;
- url_cnesreport="http://localhost:9000/api/cnesreport/report?key=fr.cnes.sonar%3Acnesreport&author=travis-ci&token=${token_sonarqube}";
- curl -u admin:admin ${url_cnesreport} -O -J;
- elif [ "$TRAVIS_JDK_VERSION" = "openjdk11" ]; then
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar;
- fi
-
-cache:
- directories:
- - '$HOME/.m2/repository'
- - '$HOME/.sonar/cache'
- - 'node'
- - 'node_modules'
-
-notifications:
- email: false
-
-deploy:
- provider: releases
- api_key:
- secure: DZXCeGatbBOQ6dyUYAAZOAVd/ORttOq8v8rRjgcfOFk7JcR2DGTu5ICpDriDOadUp24PylLZ8SHEZHJu+JshFXuABP5xIc/Fs+kr2OeFDw/qOPNzwZFWU/WwmlidLzt0O2i1wat7+9fnKEdcBikdC+qayhunT6mdozjhlw8Y+e3USuB/7KECbxPcHs2xf7Ek0eUVjX5Hmp+gi3ryO0Jxk/aHZb+QPdYGvyf8dUcFx/GTrIqfkRu/MbXmU7dnZ9Zp7cFMbC8M2uDSNmGcVgHfXyci5mL4b30JKSHU3kpqZDvb5RVhd1W/WqRErAR1tnp2hlhg4f1fEbYiC0GUZkdfedXnK2cAFYz7ar9g49bS9LjWsWUATtKtSKZf4JZimNn0w/pVI1hUaDhrUdIpA8+Ok8gOSTG6rL3Y1eh54s9JO4EUsX3bWJ/BrZjkkR/TlYIlIN5ejXswZId6ItzchJ6nq/S5XZ5dX2ocZ1d9xVQBlqrFW8U5v5BALVYMjWRjwLaXfumQMYiuCrL9TMggMkJaheWSuQNEY5WDbEnH656v6EmpB9n3/nonxLnF0/37AKerqR+RyPwEOWEApTn0fRyYB/7HfMUJi44MXxGTXuflJWjNXT3bXVt3pUudPGKMPQJ5xJ+9pAwbJZWhhTEq+yfHa1UNOC09dQAVVaZJ8egvMdk=
- file: target/sonar-cnes-report.jar
- skip_cleanup: true
- draft: true
- on:
- branch: master
- condition: $sonarqube = none
- tags: true
- jdk: 'openjdk11'
diff --git a/.workflow b/.workflow
deleted file mode 100644
index bacc081d..00000000
--- a/.workflow
+++ /dev/null
@@ -1,3 +0,0 @@
-action "SonarCloud Scan" {
- uses = "SonarSource/sonarcloud-github-action@v1.1"
-}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index a8ca1726..32541bd7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -210,7 +210,7 @@
${sonar-packaging-maven-plugin.version}
true
- sonar-cnes-report
+ sonar-cnes-report-${project.version}
diff --git a/yarn.lock b/yarn.lock
index d717d8a2..c15d20d0 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -4608,12 +4608,7 @@ lodash.topath@4.5.2:
resolved "https://registry.yarnpkg.com/lodash.topath/-/lodash.topath-4.5.2.tgz#3616351f3bba61994a0931989660bd03254fd009"
integrity sha1-NhY1Hzu6YZlKCTGYlmC9AyVP0Ak=
-lodash@4.17.21:
- version "4.17.21"
- resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
- integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
-
-lodash@^4.17.19, lodash@^4.17.4, lodash@^4.2.0, lodash@^4.6.1:
+lodash@4.17.21, lodash@^4.17.19, lodash@^4.17.4, lodash@^4.2.0:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==