Skip to content

Commit d29533b

Browse files
Diego Verallidiegov
authored andcommitted
Add revapi binary and source backwards compatibility check to build.
1 parent 3a4e0fb commit d29533b

File tree

4 files changed

+45
-0
lines changed

4 files changed

+45
-0
lines changed

.github/fetch_to_tag.sh

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
#!/usr/bin/env bash
2+
3+
set -e
4+
5+
# Github actions will do shallow clones which is great for performance, but some of our
6+
# tasks require a history going back to the most recent tag, so this script achieves
7+
# that, without pulling the full history
8+
9+
function fetch_to_tag() {
10+
n="$1"
11+
if [ "$n" == "" ]; then
12+
n=2
13+
fi
14+
15+
echo "Fetching commits with depth ${n}"
16+
17+
rev=$(git rev-list -n 1 HEAD)
18+
19+
git fetch origin --depth "$n" "$rev"
20+
21+
if ! git describe --tags --abbrev=0 HEAD^ 1>/dev/null 2>&1; then
22+
fetch_to_tag "$(expr "$n" \* 2)"
23+
fi
24+
}
25+
26+
git fetch origin 'refs/tags/*:refs/tags/*'
27+
28+
fetch_to_tag

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
java: [8, 11]
1515
steps:
1616
- uses: actions/checkout@v2
17+
18+
- name: Fetch git tags
19+
run: ./.github/fetch_to_tag.sh
20+
1721
# Our build uses JDK7's rt.jar to make sure the artifact is fully
1822
# compatible with Java 7, so we let this action set Java 7 up for us
1923
# and we store its JAVA_HOME

build.gradle

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ buildscript {
88
classpath "de.marcphilipp.gradle:nexus-publish-plugin:0.4.0"
99
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.21.2"
1010
classpath "gradle.plugin.com.github.spotbugs.snom:spotbugs-gradle-plugin:4.2.4"
11+
classpath "com.palantir.gradle.revapi:gradle-revapi:1.4.4"
1112
}
1213
}
1314

@@ -37,6 +38,8 @@ subprojects { project ->
3738
apply from: "$rootDir/gradle/release.gradle"
3839

3940
apply from: "$rootDir/gradle/quality.gradle"
41+
42+
apply from: "$rootDir/gradle/compatibility.gradle"
4043

4144
repositories {
4245
mavenCentral()

gradle/compatibility.gradle

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apply plugin: 'com.palantir.revapi'
2+
3+
revapi {
4+
oldGroup = GROUP
5+
// By default, revapi will check against the version matching the most recent
6+
// git tag, so we don't need to specify anything else here.
7+
// If an artifact with the given version doesn't exist on maven, it will skip
8+
// the check, so new projects won't cause any failures, and after the first
9+
// version of a project is published it will start checking it.
10+
}

0 commit comments

Comments
 (0)