mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Add API Baseline checking to the build
This commit is contained in:
parent
2c3aaf89a1
commit
fe2d38e7a1
5 changed files with 60 additions and 0 deletions
|
@ -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.
|
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
|
#### production
|
||||||
|
|
||||||
Runs the production steps of the build. This profile can only be run on the CDT CI machines
|
Runs the production steps of the build. This profile can only be run on the CDT CI machines
|
||||||
|
|
1
Jenkinsfile
vendored
1
Jenkinsfile
vendored
|
@ -42,6 +42,7 @@ pipeline {
|
||||||
-Dmaven.test.failure.ignore=true \
|
-Dmaven.test.failure.ignore=true \
|
||||||
-DexcludedGroups=flakyTest,slowTest \
|
-DexcludedGroups=flakyTest,slowTest \
|
||||||
-P baseline-compare-and-replace \
|
-P baseline-compare-and-replace \
|
||||||
|
-P api-baseline-check \
|
||||||
-Ddsf.gdb.tests.timeout.multiplier=50 \
|
-Ddsf.gdb.tests.timeout.multiplier=50 \
|
||||||
-Dindexer.timeout=300 \
|
-Dindexer.timeout=300 \
|
||||||
-P production \
|
-P production \
|
||||||
|
|
37
pom.xml
37
pom.xml
|
@ -45,6 +45,8 @@
|
||||||
<!-- Some old tests, like CDescriptorOldTests, fail due to reflection access. Therefore we add-opens to make that pass -->
|
<!-- 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>
|
<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>
|
<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
|
<!-- 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
|
to avoid baseline replace and compare, especially if you have different versions of Java than
|
||||||
the baseline was built with. This is the default.
|
the baseline was built with. This is the default.
|
||||||
|
@ -549,6 +551,41 @@
|
||||||
<replace-version-with-baselines.replace>all</replace-version-with-baselines.replace>
|
<replace-version-with-baselines.replace>all</replace-version-with-baselines.replace>
|
||||||
</properties>
|
</properties>
|
||||||
</profile>
|
</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>
|
<profile>
|
||||||
<id>production</id>
|
<id>production</id>
|
||||||
<build>
|
<build>
|
||||||
|
|
|
@ -29,6 +29,7 @@ ${MVN:-mvn} \
|
||||||
-DskipDoc=true \
|
-DskipDoc=true \
|
||||||
-DskipTests=true \
|
-DskipTests=true \
|
||||||
-P baseline-compare-and-replace \
|
-P baseline-compare-and-replace \
|
||||||
|
-P api-baseline-check \
|
||||||
2>&1 | tee ${logfile}
|
2>&1 | tee ${logfile}
|
||||||
|
|
||||||
if [ $? -eq 0 ]; then
|
if [ $? -eq 0 ]; then
|
||||||
|
|
|
@ -23,6 +23,7 @@ fi
|
||||||
logfile=baseline-compare-and-replace.log
|
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)
|
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
|
if [ -n "$bundles_only_qualifier_changed" ]; then
|
||||||
|
echo
|
||||||
echo "The following bundles are missing a service segment version bump:"
|
echo "The following bundles are missing a service segment version bump:"
|
||||||
for bundle in $bundles_only_qualifier_changed; do
|
for bundle in $bundles_only_qualifier_changed; do
|
||||||
echo " - $bundle"
|
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)
|
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
|
if [ -n "$bundles_same_version_different_content" ]; then
|
||||||
|
echo
|
||||||
echo "The following bundles have same version as baseline, but different contents:"
|
echo "The following bundles have same version as baseline, but different contents:"
|
||||||
for bundle in $bundles_same_version_different_content; do
|
for bundle in $bundles_same_version_different_content; do
|
||||||
echo " - $bundle"
|
echo " - $bundle"
|
||||||
|
@ -49,6 +51,21 @@ if [ -n "$bundles_same_version_different_content" ]; then
|
||||||
echo
|
echo
|
||||||
fi
|
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})
|
success=$(grep "SUCCESS - Maven check all versions have been bumped appropriately appears to have completed successfully" ${logfile})
|
||||||
if [ -n "$success" ]; then
|
if [ -n "$success" ]; then
|
||||||
echo "Maven check all versions have been bumped appropriately appears to have completed successfully"
|
echo "Maven check all versions have been bumped appropriately appears to have completed successfully"
|
||||||
|
|
Loading…
Add table
Reference in a new issue