-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #228 from cnescatlab/develop
Hotfix add action ci (#227)
- Loading branch information
Showing
20 changed files
with
210 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
# 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 "<version>.*</version>" | 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: | ||
- "icode-app/target/icode-*.zip" | ||
- "icode-ide/fr.cnes.icode.repository/target/products/icode-ide.product-*.zip" | ||
- "icode-ide/fr.cnes.icode.repository/target/fr.cnes.icode.repository-*.zip" | ||
tag: ${{ env.tag }} | ||
name: ${{ env.project }} ${{ env.tag }} | ||
bodyFile: "temp_release_notes/release_file.md" | ||
draft: true | ||
token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
# 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] | ||
|
||
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 | ||
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 |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.