Skip to content

Commit

Permalink
Fix CHANGELOG and improve CI and tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dvacca-onfido committed Jun 13, 2024
1 parent 37b0613 commit cbfbd93
Showing 3 changed files with 34 additions and 7 deletions.
34 changes: 33 additions & 1 deletion .github/workflows/maven.yml
Original file line number Diff line number Diff line change
@@ -31,7 +31,7 @@ jobs:
npm install google-java-format
npx google-java-format --set-exit-if-changed -i $(git ls-files src/test/\*.java)
- name: Cache local Maven repository
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
@@ -40,6 +40,7 @@ jobs:
- name: Build with Maven
run: mvn -B package --file pom.xml -Dmaven.test.skip
- name: Run integration tests with Maven
if: ${{ github.repository_owner == 'onfido' }}
run: mvn test
env:
ONFIDO_API_TOKEN: ${{ secrets.ONFIDO_API_TOKEN }}
@@ -52,9 +53,12 @@ jobs:
publish:
runs-on: ubuntu-latest
needs: integration-tests
environment: delivery
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_ACTION_ACCESS_TOKEN }}
- name: Set up Maven Central Repository
uses: actions/setup-java@v4
with:
@@ -79,3 +83,31 @@ jobs:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
- name: Update CHANGELOG.md
run: |
TMP_FILE=$(mktemp)
RELEASE_VERSION=$(jq -r '.release' .release.json)
RELEASE_DATE=`date +'%dth %B %Y' | sed -E 's/^0//;s/^([2,3]?)1th/\11st/;s/^([2]?)2th/\12nd/;s/^([2]?)3th/\13rd/'`
SPEC_COMMIT_SHA=$(jq -r '.source.short_sha' .release.json)
SPEC_COMMIT_URL=$(jq -r '.source.repo_url + "/commit/" + .source.long_sha' .release.json)
SPEC_RELEASE_VERSION=$(jq -r '.source.version' .release.json)
SPEC_RELEASE_URL=$(jq -r '.source.repo_url + "/releases/tag/" + .source.version' .release.json)
echo -e "# Changelog\n\n## $RELEASE_VERSION $RELEASE_DATE\n\n" >| $TMP_FILE
echo -en "${{ github.event.release.body }}\nBased on Onfido OpenAPI spec " >> $TMP_FILE
if [ -z $SPEC_RELEASE_VERSION ]; then
echo "up to commit [$SPEC_COMMIT_SHA](${SPEC_COMMIT_URL})." >> $TMP_FILE
else
echo "version [$SPEC_RELEASE_VERSION](${SPEC_RELEASE_URL})." >> $TMP_FILE
fi
grep -v "^# Changelog" CHANGELOG.md >> $TMP_FILE
mv $TMP_FILE CHANGELOG.md
git config user.name "GitHub Actions Bot"
git config user.email "<>"
git commit -m "Update CHANGELOG.md after library release" CHANGELOG.md
git push
4 changes: 0 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Changelog

## v4.0.0 11th Jun 2024

- Refresh library up to commit: [62dc554](https://github.com/onfido/onfido-openapi-spec/commit/62dc5541a4a51e8de313fc99fb3dec496033a23e)

## v3.1.0 13th May 2024 (pre-release)

- Include `nexus-staging-maven-plugin` only when necessary
3 changes: 1 addition & 2 deletions src/test/java/com/onfido/integration/ReportSchemasTest.java
Original file line number Diff line number Diff line change
@@ -63,7 +63,6 @@ public void schemaOfFacialSimilarityPhotoReportIsValid() throws Exception {
Assertions.assertEquals(check.getId(), facialSimilarityPhotoFullyAutoReport.getCheckId());
Assertions.assertNotNull(facialSimilarityPhotoFullyAutoReport.getBreakdown());
Assertions.assertNotNull(facialSimilarityPhotoFullyAutoReport.getResult());
Assertions.assertNotNull(
facialSimilarityPhotoFullyAutoReport.getAdditionalProperties().get("properties"));
Assertions.assertNotNull(facialSimilarityPhotoFullyAutoReport.getProperties());
}
}

0 comments on commit cbfbd93

Please sign in to comment.