Skip to content

Commit f0199b9

Browse files
committed
Add coverage for java 2024
1 parent 01ed659 commit f0199b9

File tree

2 files changed

+62
-4
lines changed

2 files changed

+62
-4
lines changed

.github/workflows/build-jvm.yml

+35-4
Original file line numberDiff line numberDiff line change
@@ -28,26 +28,57 @@ jobs:
2828
steps:
2929
- name: Checkout
3030
uses: actions/checkout@v4
31-
3231
- name: Get private repo
3332
uses: actions/checkout@v4
3433
with:
3534
repository: alien11689/advent-of-code
3635
ref: master
3736
token: ${{ secrets.ADVENT_OF_CODE_PAT}}
3837
path: private
39-
4038
- name: Set up Java
4139
uses: actions/setup-java@v4
4240
with:
4341
java-version: '21'
4442
distribution: 'temurin'
45-
46-
- name: Run
43+
- name: Prepare resources
4744
run: |
4845
mkdir -p ${{matrix.year}}/src/main/resources
4946
cp -r private/${{matrix.year}}/src/main/resources/* ${{matrix.year}}/src/main/resources
47+
- name: Run
48+
run: |
5049
echo '```' > out
5150
./runSingle.sh ${{matrix.year}} >> out
5251
echo '```' >> out
5352
cat out >> "$GITHUB_STEP_SUMMARY"
53+
54+
Coverage:
55+
runs-on: ubuntu-latest
56+
strategy:
57+
matrix:
58+
year: [2024]
59+
steps:
60+
- name: Checkout
61+
uses: actions/checkout@v4
62+
- name: Get private repo
63+
uses: actions/checkout@v4
64+
with:
65+
repository: alien11689/advent-of-code
66+
ref: master
67+
token: ${{ secrets.ADVENT_OF_CODE_PAT}}
68+
path: private
69+
- name: Set up Java
70+
uses: actions/setup-java@v4
71+
with:
72+
java-version: '21'
73+
distribution: 'temurin'
74+
- name: Prepare resources
75+
run: |
76+
mkdir -p ${{matrix.year}}/src/main/resources
77+
cp -r private/${{matrix.year}}/src/main/resources/* ${{matrix.year}}/src/main/resources
78+
- name: Run
79+
run: ./mvnw clean test -Pcoverage -am -pl ${{ matrix.year }}
80+
- name: Upload coverage
81+
uses: codecov/codecov-action@v3
82+
with:
83+
fail_ci_if_error: true
84+
token: ${{ secrets.CODECOV_TOKEN }}

2024/pom.xml

+27
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
<native-maven-plugin.version>0.10.4</native-maven-plugin.version>
2222
<imageName>AOC${project.artifactId}</imageName>
2323
<junit5.version>5.11.4</junit5.version>
24+
<jacoco-maven-plugin.version>0.8.12</jacoco-maven-plugin.version>
2425
</properties>
2526

2627
<dependencies>
@@ -126,6 +127,32 @@
126127
</plugins>
127128
</build>
128129
</profile>
130+
<profile>
131+
<id>coverage</id>
132+
<build>
133+
<plugins>
134+
<plugin>
135+
<groupId>org.jacoco</groupId>
136+
<artifactId>jacoco-maven-plugin</artifactId>
137+
<version>${jacoco-maven-plugin.version}</version>
138+
<executions>
139+
<execution>
140+
<goals>
141+
<goal>prepare-agent</goal>
142+
</goals>
143+
</execution>
144+
<execution>
145+
<id>report</id>
146+
<phase>test</phase>
147+
<goals>
148+
<goal>report</goal>
149+
</goals>
150+
</execution>
151+
</executions>
152+
</plugin>
153+
</plugins>
154+
</build>
155+
</profile>
129156
</profiles>
130157

131158
</project>

0 commit comments

Comments
 (0)