Skip to content

Commit fc8b752

Browse files
committed
Merge branch 'main' into default_label_provider_factory
Signed-off-by: Florian Dupuy <florian.dupuy@rte-france.com>
2 parents 52d0801 + b3aec3f commit fc8b752

File tree

533 files changed

+102802
-4993
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

533 files changed

+102802
-4993
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI on forks - build and tests
2+
3+
on:
4+
pull_request:
5+
6+
permissions: {}
7+
8+
jobs:
9+
build:
10+
name: Build OS ${{ matrix.os }}
11+
runs-on: ${{ matrix.os }}
12+
if: github.event.pull_request.head.repo.fork == true
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest, windows-latest, macos-latest]
16+
17+
steps:
18+
- name: Checkout sources
19+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
20+
21+
- name: Set up JDK 21
22+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
23+
with:
24+
distribution: 'temurin'
25+
java-version: '21'
26+
cache: 'maven'
27+
28+
- name: Build with Maven (Ubuntu)
29+
if: matrix.os == 'ubuntu-latest'
30+
run: ./mvnw -B -ntp -Pjacoco install
31+
32+
- name: Build with Maven (Windows)
33+
if: matrix.os == 'windows-latest'
34+
run: mvnw.cmd -B -ntp verify -Dpowsybl.checks.skip=true
35+
shell: cmd
36+
37+
- name: Build with Maven (MacOS)
38+
if: matrix.os == 'macos-latest'
39+
run: ./mvnw -B -ntp verify -Dpowsybl.checks.skip=true
40+
41+
- name: Regroup dependencies in target folders
42+
if: matrix.os == 'ubuntu-latest'
43+
run: ./mvnw dependency:copy-dependencies
44+
45+
- name: Save classes and Jacoco report
46+
if: matrix.os == 'ubuntu-latest'
47+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
48+
with:
49+
name: data-for-sonar-analysis-${{ github.event.pull_request.number }}
50+
retention-days: 1
51+
path: |
52+
*/target/classes
53+
*/*/target/classes
54+
*/*/*/target/classes
55+
*/target/generated-sources
56+
*/*/target/generated-sources
57+
*/*/*/target/generated-sources
58+
distribution-diagram/target/dependency
59+
distribution-diagram/target/site/jacoco-aggregate/jacoco.xml
60+
61+
- name: Save PR Information
62+
if: matrix.os == 'ubuntu-latest'
63+
env:
64+
REPO_NAME: ${{ github.event.pull_request.head.repo.full_name }}
65+
HEAD_REF: ${{ github.event.pull_request.head.ref }}
66+
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
67+
PR_NUMBER: ${{ github.event.pull_request.number }}
68+
BASE_REF: ${{ github.event.pull_request.base.ref }}
69+
run: |
70+
mkdir -p pr-info
71+
echo "$REPO_NAME" > pr-info/repo-name
72+
echo "$HEAD_REF" > pr-info/head-ref
73+
echo "$HEAD_SHA" > pr-info/head-sha
74+
echo "$PR_NUMBER" > pr-info/pr-number
75+
echo "$BASE_REF" > pr-info/base-ref
76+
77+
- name: Upload PR Information
78+
if: matrix.os == 'ubuntu-latest'
79+
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
80+
with:
81+
name: pr-info-${{ github.event.pull_request.number }}
82+
path: pr-info/
83+
retention-days: 1

.github/workflows/fork-sonar.yml

Lines changed: 223 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,223 @@
1+
name: CI on forks - Sonar analysis
2+
3+
on:
4+
workflow_run:
5+
workflows: [CI on forks - build and tests]
6+
types:
7+
- completed
8+
9+
permissions: {}
10+
11+
jobs:
12+
sonar:
13+
name: Run Sonar Analysis for forks
14+
runs-on: ubuntu-latest
15+
if: >
16+
github.event.workflow_run.event == 'pull_request' &&
17+
github.event.workflow_run.conclusion == 'success'
18+
permissions:
19+
actions: write
20+
checks: write
21+
contents: read
22+
issues: read
23+
pull-requests: write
24+
statuses: write
25+
steps:
26+
- name: Download PR information
27+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
28+
with:
29+
script: |
30+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
31+
owner: context.repo.owner,
32+
repo: context.repo.repo,
33+
run_id: context.payload.workflow_run.id,
34+
});
35+
let prInfoArtifact = allArtifacts.data.artifacts.filter((artifact) => {
36+
return artifact.name.startsWith("pr-info-")
37+
})[0];
38+
if (!prInfoArtifact) {
39+
core.setFailed("❌ No PR info artifact found");
40+
return;
41+
}
42+
let download = await github.rest.actions.downloadArtifact({
43+
owner: context.repo.owner,
44+
repo: context.repo.repo,
45+
artifact_id: prInfoArtifact.id,
46+
archive_format: 'zip',
47+
});
48+
const fs = require('fs');
49+
const path = require('path');
50+
const temp = '${{ runner.temp }}/pr-info';
51+
if (!fs.existsSync(temp)){
52+
fs.mkdirSync(temp, { recursive: true });
53+
}
54+
fs.writeFileSync(path.join(temp, 'pr-info.zip'), Buffer.from(download.data));
55+
console.log("PR information downloaded");
56+
57+
- name: Extract PR Information
58+
run: |
59+
mkdir -p ${{ runner.temp }}/pr-info-extracted
60+
unzip -q ${{ runner.temp }}/pr-info/pr-info.zip -d ${{ runner.temp }}/pr-info-extracted
61+
REPO_NAME=$(cat ${{ runner.temp }}/pr-info-extracted/repo-name)
62+
HEAD_REF=$(cat ${{ runner.temp }}/pr-info-extracted/head-ref)
63+
HEAD_SHA=$(cat ${{ runner.temp }}/pr-info-extracted/head-sha)
64+
PR_NUMBER=$(cat ${{ runner.temp }}/pr-info-extracted/pr-number)
65+
BASE_REF=$(cat ${{ runner.temp }}/pr-info-extracted/base-ref)
66+
echo "REPO_NAME=$REPO_NAME" >> $GITHUB_ENV
67+
echo "HEAD_REF=$HEAD_REF" >> $GITHUB_ENV
68+
echo "HEAD_SHA=$HEAD_SHA" >> $GITHUB_ENV
69+
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
70+
echo "BASE_REF=$BASE_REF" >> $GITHUB_ENV
71+
echo "PR information extracted: $REPO_NAME $HEAD_REF $HEAD_SHA $PR_NUMBER $BASE_REF"
72+
73+
- name: Checkout sources
74+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
75+
with:
76+
ref: ${{ env.HEAD_REF }}
77+
repository: ${{ env.REPO_NAME }}
78+
fetch-depth: 0
79+
80+
- name: Set up JDK 21
81+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
82+
with:
83+
distribution: 'temurin'
84+
java-version: '21'
85+
cache: 'maven'
86+
87+
- name: Download artifact
88+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
89+
with:
90+
script: |
91+
let allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
92+
owner: context.repo.owner,
93+
repo: context.repo.repo,
94+
run_id: context.payload.workflow_run.id,
95+
});
96+
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
97+
return artifact.name.startsWith("data-for-sonar-analysis-")
98+
})[0];
99+
if (!matchArtifact) {
100+
core.setFailed("❌ No matching artifact found");
101+
return;
102+
}
103+
const prNumber = matchArtifact.name.replace("data-for-sonar-analysis-", "");
104+
console.log(`PR number: ${prNumber}`);
105+
core.exportVariable('PR_NUMBER', prNumber);
106+
let download = await github.rest.actions.downloadArtifact({
107+
owner: context.repo.owner,
108+
repo: context.repo.repo,
109+
artifact_id: matchArtifact.id,
110+
archive_format: 'zip',
111+
});
112+
const fs = require('fs');
113+
const path = require('path');
114+
const temp = '${{ runner.temp }}/artifacts';
115+
if (!fs.existsSync(temp)){
116+
fs.mkdirSync(temp);
117+
}
118+
fs.writeFileSync(path.join(temp, 'sonar-data.zip'), Buffer.from(download.data));
119+
120+
- name: Extract Sonar Analysis Data
121+
run: |
122+
mkdir -p ${{ runner.temp }}/extracted
123+
unzip -q ${{ runner.temp }}/artifacts/sonar-data.zip -d ${{ runner.temp }}/extracted
124+
cp -r ${{ runner.temp }}/extracted/* .
125+
ls -la distribution-diagram/target/site/jacoco-aggregate/ || echo "Jacoco report directory not found"
126+
127+
- name: Prepare Sonar Analysis
128+
run: |
129+
echo "Checking required directories..."
130+
if [ -f "distribution-diagram/target/site/jacoco-aggregate/jacoco.xml" ]; then
131+
echo "Jacoco report found"
132+
else
133+
echo "Warning: Jacoco report not found at expected location"
134+
fi
135+
echo "Finding sources and binaries..."
136+
SOURCES=$(find . -type d -path "*/main/java" | sort -u | paste -sd "," -)
137+
if [ -z "$SOURCES" ]; then
138+
echo "Warning: No source directories found!"
139+
else
140+
echo "SOURCES : $SOURCES"
141+
echo "SOURCES=$SOURCES" >> $GITHUB_ENV
142+
fi
143+
GENERATED=$(find . -type d -path "*/target/generated-sources" | sort -u | paste -sd "," -)
144+
if [ -z "$GENERATED" ]; then
145+
echo "Warning: No generated source directories found!"
146+
else
147+
echo "GENERATED : $GENERATED"
148+
echo "GENERATED=$GENERATED" >> $GITHUB_ENV
149+
fi
150+
TESTS=$(find . -type d -path "*/test/java" | sort -u | paste -sd "," -)
151+
if [ -z "$TESTS" ]; then
152+
echo "Warning: No test directories found!"
153+
else
154+
echo "TESTS : $TESTS"
155+
echo "TESTS=$TESTS" >> $GITHUB_ENV
156+
fi
157+
BINARIES=$(find . -type d -path "*/target/classes" | sort -u | paste -sd "," -)
158+
if [ -z "$BINARIES" ]; then
159+
echo "Warning: No binaries directories found!"
160+
else
161+
echo "BINARIES : $BINARIES"
162+
echo "BINARIES=$BINARIES" >> $GITHUB_ENV
163+
fi
164+
LIBRARIES="distribution-diagram/target/dependency"
165+
if [ -z "$LIBRARIES" ]; then
166+
echo "Warning: No libraries directory found!"
167+
else
168+
echo "LIBRARIES : $LIBRARIES"
169+
echo "LIBRARIES=$LIBRARIES" >> $GITHUB_ENV
170+
fi
171+
172+
# This sonar action should NOT be replaced by a direct use of the mvn verify command since we don't want external
173+
# code to run in a workflow_run workflow (it may lead to security issues).
174+
- name: Run Sonar Analysis
175+
uses: SonarSource/sonarqube-scan-action@a31c9398be7ace6bbfaf30c0bd5d415f843d45e9 # v7.0.0
176+
env:
177+
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
178+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
179+
with:
180+
args: >
181+
-Dsonar.projectKey=com.powsybl:powsybl-diagram
182+
-Dsonar.organization=powsybl-ci-github
183+
-Dsonar.sources=${{ env.SOURCES }}
184+
-Dsonar.generatedSources=${{ env.GENERATED }}
185+
-Dsonar.tests=${{ env.TESTS }}
186+
-Dsonar.java.binaries=${{ env.BINARIES }}
187+
-Dsonar.java.libraries=${{ env.LIBRARIES }}
188+
-Dsonar.java.test.libraries=${{ env.LIBRARIES }}
189+
-Dsonar.coverage.jacoco.xmlReportPaths="distribution-diagram/target/site/jacoco-aggregate/jacoco.xml"
190+
-Dsonar.pullrequest.key=${{ env.PR_NUMBER }}
191+
-Dsonar.pullrequest.branch=${{ env.HEAD_REF }}
192+
-Dsonar.pullrequest.base=${{ env.BASE_REF }}
193+
-Dsonar.pullrequest.provider=github
194+
-Dsonar.pullrequest.github.repository=${{ github.repository }}
195+
-Dsonar.host.url=https://sonarcloud.io
196+
-Dsonar.scm.provider=git
197+
-Dsonar.qualitygate.wait=true
198+
-Dsonar.scm.revision=${{ env.HEAD_SHA }}
199+
200+
- name: Delete artifacts used in analysis
201+
if: always()
202+
uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8.0.0
203+
with:
204+
github-token: ${{ secrets.GITHUB_TOKEN }}
205+
script: |
206+
let artifacts = await github.rest.actions.listWorkflowRunArtifacts({
207+
owner: context.repo.owner,
208+
repo: context.repo.repo,
209+
run_id: context.payload.workflow_run.id,
210+
});
211+
for (const artifact of artifacts.data.artifacts) {
212+
if (
213+
artifact.name.startsWith("data-for-sonar-analysis-") ||
214+
artifact.name.startsWith("pr-info-")
215+
) {
216+
console.log(`Deleting artifact: ${artifact.name} (ID: ${artifact.id})`);
217+
await github.rest.actions.deleteArtifact({
218+
owner: context.repo.owner,
219+
repo: context.repo.repo,
220+
artifact_id: artifact.id
221+
});
222+
}
223+
}

.github/workflows/maven.yml

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,53 @@ on:
66
- 'main'
77
- 'release-v**'
88
- 'full-sonar-analysis-**'
9+
tags:
10+
- 'v[0-9]+.[0-9]+.[0-9]+*'
911
pull_request:
1012

13+
permissions: {}
14+
1115
jobs:
1216
build:
1317
name: Build OS ${{ matrix.os }}
1418
runs-on: ${{ matrix.os }}
19+
if: github.event.pull_request.head.repo.fork == false
1520
strategy:
1621
matrix:
1722
os: [ubuntu-latest, windows-latest, macos-latest]
1823

1924
steps:
2025
- name: Checkout sources
21-
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
26+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
27+
with:
28+
fetch-depth: 0
2229

2330
- name: Set up JDK 21
24-
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 # v4.0.0
31+
uses: actions/setup-java@be666c2fcd27ec809703dec50e508c2fdc7f6654 # v5.2.0
2532
with:
2633
distribution: 'temurin'
27-
java-version: 21
34+
java-version: '21'
35+
cache: 'maven'
2836

2937
- name: Build with Maven (Ubuntu)
3038
if: matrix.os == 'ubuntu-latest'
31-
run: ./mvnw --batch-mode -P jacoco,checks install
39+
run: ./mvnw -B -ntp -Pjacoco install
3240

3341
- name: Build with Maven (Windows)
3442
if: matrix.os == 'windows-latest'
35-
run: mvnw.cmd --batch-mode install
43+
run: mvnw.cmd -B -ntp verify -Dpowsybl.checks.skip=true
3644
shell: cmd
3745

3846
- name: Build with Maven (MacOS)
3947
if: matrix.os == 'macos-latest'
40-
run: ./mvnw --batch-mode install
48+
run: ./mvnw -B -ntp verify -Dpowsybl.checks.skip=true
4149

4250
- name: Run SonarCloud analysis
4351
if: matrix.os == 'ubuntu-latest'
4452
run: >
45-
./mvnw --batch-mode -Pjacoco verify sonar:sonar
53+
./mvnw -B -ntp -DskipTests sonar:sonar
4654
-Dsonar.host.url=https://sonarcloud.io
4755
-Dsonar.organization=powsybl-ci-github
4856
-Dsonar.projectKey=com.powsybl:powsybl-diagram
4957
env:
50-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5158
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
52-

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ org.eclipse.jdt.groovy.core.prefs
2020

2121
# Generated readthedocs pages
2222
build-docs/
23+
docs/_build
2324

2425
# Maven wrapper jar
2526
.mvn/wrapper/*.jar

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The main features are:
4040
- Highly customizable rendering using CSS and configurable labels.
4141
- Built-in force-layout to place the voltage level nodes.
4242
- Displaying electrical nodes within a voltage level as concentric rings, and voltage / angle values for each electrical node is displayed by default.
43-
- Displaying lines, two- and three-winding transformers, converter stations and dangling lines with separate designs.
43+
- Displaying lines, two- and three-winding transformers, converter stations and boundary lines with separate designs.
4444
- Displaying active (visible by default) or reactive (hidden by default) powers on each edge.
4545

4646
## PowSyBl Single Line Diagram

THIRD-PARTY.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
net.jcip--jcip-annotations--1.0=Creative Commons Attribution 2.5 Generic License

0 commit comments

Comments
 (0)