Skip to content

Commit

Permalink
Merge branch 'release/2023.8.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sfeilmeier committed Aug 2, 2023
2 parents d416466 + ab7d760 commit 993131b
Show file tree
Hide file tree
Showing 297 changed files with 8,314 additions and 3,469 deletions.
52 changes: 16 additions & 36 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,32 +12,14 @@ jobs:
- name: Setup Java 17
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: "17"
java-package: jdk

- name: Setup Cache for Java/Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/native
~/.gradle/notifications
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-

- name: Setup Cache for Java/Maven
uses: actions/cache@v3
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: ${{ runner.os }}-maven-
distribution: 'temurin'
java-version: '17'
cache: gradle

- uses: kiancross/checkstyle-annotations-action@v1

- name: Build all Java packages
run: ./gradlew --build-cache build
run: ./gradlew build

- name: Resolve OpenEMS bundles
run: ./gradlew resolve
Expand All @@ -54,37 +36,35 @@ jobs:
- name: Generate JaCoCo Code-coverage-report
run: ./gradlew jacocoTestReport

- name: Generate JaCoCo Report
- name: Summarize JaCoCo Report
id: jacoco
uses: cicirello/jacoco-badge-generator@v2
with:
jacoco-csv-file: "io.openems.*/generated/reports/jacoco/**/*.csv"
generate-coverage-endpoint: true
generate-summary: true
jacoco-csv-file: 'io.openems.*/generated/reports/jacoco/**/*.csv'
generate-coverage-badge: false

- name: Generate JaCoCo Badge
id: jacoco-badge
- name: Create JaCoCo Badge
env:
PR_NUMBER: ${{ github.event.number }}
run: |
coverage=$(echo "scale=2; ${{ steps.jacoco.outputs.coverage }} * 100" | bc | cut -c1-4);
color=red;
if (( $(echo "$coverage > 95" | bc -l) )); then
if (( $(echo "$coverage > 90" | bc -l) )); then
color=success;
elif (( $(echo "$coverage > 80" | bc -l) )); then
color=green;
elif (( $(echo "$coverage > 95" | bc -l) )); then
elif (( $(echo "$coverage > 60" | bc -l) )); then
color=yellow;
fi;
mkdir -p ./pr
echo 'badge=![Code Coverage]'"(https://img.shields.io/badge/Code%20Coverage-${coverage}%25-${color}?style=flat)" > ./pr/pr_badge
echo $PR_NUMBER > ./pr/pr_number
mkdir -p ./jacoco
echo $PR_NUMBER > ./jacoco/jacoco_report_number
echo '![Code Coverage]'"(https://img.shields.io/badge/Code%20Coverage-${coverage}%25-${color}?style=flat)" > ./jacoco/jacoco_report_badge
- uses: actions/upload-artifact@v3
with:
name: pr_comment
path: pr/
name: jacoco_report
path: jacoco/

#
# Is this a Tag? Prepare release assets
Expand All @@ -110,7 +90,7 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: "16"
node-version: '16'

- name: Setup Cache for Node.js
uses: actions/cache@v3
Expand Down
31 changes: 16 additions & 15 deletions .github/workflows/comment.yml
Original file line number Diff line number Diff line change
@@ -1,46 +1,47 @@
name: Comment Pull_Request
on:
workflow_run:
workflows: [Upload data]
workflows: [Build OpenEMS]
types:
- completed

jobs:
download:
comment_jacoco:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: 'Download artifact'
uses: actions/github-script@v5
uses: actions/github-script@v6
with:
script: |
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
owner: context.repo.owner,
repo: context.repo.repo,
run_id: context.payload.workflow_run.id,
});
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_comment"
return artifact.name == 'jacoco_report'
})[0];
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
owner: context.repo.owner,
repo: context.repo.repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
let fs = require('fs');
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_number.zip`, Buffer.from(download.data));
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/jacoco_report.zip`, Buffer.from(download.data));
- name: 'Unzip artifact'
run: unzip pr_comment.zip
run: unzip jacoco_report.zip

- name: 'Comment on PR'
uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
let fs = require('fs');
let comment = fs.readFileSync('./pr_badge');
let issue_number = Number(fs.readFileSync('./pr_number'));
let comment = fs.readFileSync('./jacoco_report_badge', { encoding: 'utf8', flag: 'r' });
let issue_number = Number(fs.readFileSync('./jacoco_report_number'));
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
13 changes: 1 addition & 12 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,7 @@ jobs:
with:
distribution: 'temurin'
java-version: '17'
java-package: jdk

- name: Setup Cache for Java/Gradle
uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
~/.gradle/native
~/.gradle/notifications
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle-
cache: gradle

- name: Build Javadocs
run: ./gradlew buildAggregatedJavadocs --continue
Expand Down
Loading

0 comments on commit 993131b

Please sign in to comment.