1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-03-28 14:56:28 +01:00

Add API Baseline checking to the build

This commit is contained in:
Jonah Graham 2023-08-16 15:22:28 -04:00
parent 2c3aaf89a1
commit fe2d38e7a1
5 changed files with 60 additions and 0 deletions

View file

@ -57,6 +57,10 @@ replace. To do that run with the `baseline-compare-and-replace` profile.
Requires verify phase of maven to run, i.e. will not run with `mvn package` even if profile is specified.
#### api-baseline-check
`api-baseline-check` checks the API of CDT matches the [API policy](https://github.com/eclipse-cdt/cdt/blob/main/POLICY.md#api)
#### production
Runs the production steps of the build. This profile can only be run on the CDT CI machines

1
Jenkinsfile vendored
View file

@ -42,6 +42,7 @@ pipeline {
-Dmaven.test.failure.ignore=true \
-DexcludedGroups=flakyTest,slowTest \
-P baseline-compare-and-replace \
-P api-baseline-check \
-Ddsf.gdb.tests.timeout.multiplier=50 \
-Dindexer.timeout=300 \
-P production \

37
pom.xml
View file

@ -45,6 +45,8 @@
<!-- Some old tests, like CDescriptorOldTests, fail due to reflection access. Therefore we add-opens to make that pass -->
<base.test.vmargs>-Xms256m -Xmx512m -ea --add-opens=java.xml/com.sun.org.apache.xerces.internal.dom=ALL-UNNAMED</base.test.vmargs>
<comparator.repo>https://download.eclipse.org/tools/cdt/releases/11.2/cdt-11.2.0/</comparator.repo>
<api-baseline.repo>https://download.eclipse.org/tools/cdt/releases/latest/</api-baseline.repo>
<api-baseline.repo.simrel>https://download.eclipse.org/releases/latest/</api-baseline.repo.simrel>
<!-- these parameters are to control baseline replace and compare. On a local build you want
to avoid baseline replace and compare, especially if you have different versions of Java than
the baseline was built with. This is the default.
@ -549,6 +551,41 @@
<replace-version-with-baselines.replace>all</replace-version-with-baselines.replace>
</properties>
</profile>
<profile>
<id>api-baseline-check</id>
<build>
<plugins>
<plugin>
<groupId>org.eclipse.tycho</groupId>
<artifactId>tycho-apitools-plugin</artifactId>
<version>${tycho-version}</version>
<configuration>
<skipIfReplaced>false</skipIfReplaced>
<baselines>
<repository>
<url>${api-baseline.repo}</url>
<url>${api-baseline.repo.simrel}</url>
</repository>
</baselines>
</configuration>
<executions>
<execution>
<id>generate</id>
<goals>
<goal>generate</goal>
</goals>
</execution>
<execution>
<id>verify</id>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>production</id>
<build>

View file

@ -29,6 +29,7 @@ ${MVN:-mvn} \
-DskipDoc=true \
-DskipTests=true \
-P baseline-compare-and-replace \
-P api-baseline-check \
2>&1 | tee ${logfile}
if [ $? -eq 0 ]; then

View file

@ -23,6 +23,7 @@ fi
logfile=baseline-compare-and-replace.log
bundles_only_qualifier_changed=$(grep "Only qualifier changed" ${logfile} | sed -e 's/^.*Only qualifier changed for .//' -e 's@/.*@@' | sort)
if [ -n "$bundles_only_qualifier_changed" ]; then
echo
echo "The following bundles are missing a service segment version bump:"
for bundle in $bundles_only_qualifier_changed; do
echo " - $bundle"
@ -35,6 +36,7 @@ fi
bundles_same_version_different_content=$(grep "baseline and build artifacts have same version but different contents" ${logfile} | sed -e 's/^.* on project //' -e 's@: baseline.*@@' | sort)
if [ -n "$bundles_same_version_different_content" ]; then
echo
echo "The following bundles have same version as baseline, but different contents:"
for bundle in $bundles_same_version_different_content; do
echo " - $bundle"
@ -49,6 +51,21 @@ if [ -n "$bundles_same_version_different_content" ]; then
echo
fi
api_errors=$(grep "API ERROR" ${logfile} | grep -v "0 API ERRORS" || true)
if [ -n "$api_errors" ]; then
echo
echo "API Errors were detected when running the build:"
grep "API ERROR" ${logfile} | grep -v "0 API ERRORS" || true
major_version=$(grep "The major version should be incremented" ${logfile})
if [ -n "$major_version" ]; then
echo "WARNING: some of the API errors report as 'major version should be incremented'. Incrementing the"
echo "major version is only allowed on major new versions of CDT. This error indicates that API has been"
echo "broken in some incompatible way. An project committer can help explain what to do if the (lengthy)"
echo "documentation below needs interpreting for this use case.".
fi
echo "See https://github.com/eclipse-cdt/cdt/blob/main/POLICY.md#api for details"
fi
success=$(grep "SUCCESS - Maven check all versions have been bumped appropriately appears to have completed successfully" ${logfile})
if [ -n "$success" ]; then
echo "Maven check all versions have been bumped appropriately appears to have completed successfully"