Skip to content

Commit 2e3badd

Browse files
Merge pull request #161 from velocitycareerlabs/VL-8685-jreleaser
(VL-8685) migration to use `jreleaser`
2 parents 673c874 + 989d65c commit 2e3badd

14 files changed

+573
-484
lines changed
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Android SDK Reusable Tests
2+
3+
on:
4+
workflow_call:
5+
6+
env:
7+
JAVA_VERSION: "17"
8+
9+
jobs:
10+
run-tests:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Checkout repository
14+
uses: actions/checkout@v4
15+
16+
- name: Set up Java
17+
uses: actions/setup-java@v4
18+
with:
19+
distribution: temurin
20+
java-version: ${{ env.JAVA_VERSION }}
21+
22+
# Will be implemented in the future
23+
# - name: Lint (ktlint)
24+
# run: ./gradlew ktlintCheck
25+
26+
- name: Run Unit Tests
27+
run: ./gradlew test
28+
29+
- name: Archive Test Results
30+
if: always()
31+
uses: actions/upload-artifact@v4
32+
with:
33+
name: test-results
34+
path: '**/build/test-results/test/*.xml'

.github/workflows/android-sdk-tests.yml

Lines changed: 3 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,7 @@ on:
66
- main
77
- release/**
88

9-
env:
10-
PACKAGE_TYPE: "aar"
11-
GRADLE_VERSION: "8.8.2"
12-
JAVA_VERSION: "17"
13-
ARTIFACT_PATH: "VCL/build/outputs"
14-
MAVEN_CENTRAL_TOKEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
15-
MAVEN_CENTRAL_TOKEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
16-
MAVEN_CENTRAL_SIGNING_KEY_ID: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_ID }}
17-
MAVEN_CENTRAL_SIGNING_PASSWORD: ${{ secrets.MAVEN_CENTRAL_SIGNING_PASSWORD }}
18-
MAVEN_CENTRAL_PRIVATE_KEY_B64: ${{ secrets.MAVEN_CENTRAL_PRIVATE_KEY_B64 }}
199
jobs:
20-
test-android-sdk:
21-
runs-on: ubuntu-latest
22-
steps:
23-
- name: Git clone repository
24-
uses: actions/checkout@v4
25-
# Setup java
26-
- uses: actions/setup-java@v4
27-
with:
28-
distribution: temurin
29-
java-version: ${{ env.JAVA_VERSION }}
30-
# Run test
31-
- name: Run Test
32-
run: ./gradlew test
10+
test-on-pr:
11+
uses: ./.github/workflows/android-sdk-reusable-tests.yml
12+
secrets: inherit

.github/workflows/android-sdk.yml

Lines changed: 66 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,92 @@
1-
name: WalletAndroid-SDK
1+
name: WalletAndroid-SDK-Publish
22

33
on:
4-
push:
5-
branches:
6-
- main
74
workflow_dispatch:
85
inputs:
96
environment:
10-
description: Configuration environment
7+
description: 'Environment to deploy to'
118
required: true
12-
default: 'dev'
139
type: choice
1410
options:
1511
- dev
1612
- rc
1713
- prod
1814

19-
env:
20-
PACKAGE_TYPE: "aar"
21-
GRADLE_VERSION: "8.8.2"
22-
JAVA_VERSION: "17"
23-
ARTIFACT_PATH: "VCL/build/outputs"
24-
GLOBAL_ENV: ${{ github.event_name == 'push' && format('{0}', 'dev') || inputs.environment }}
25-
2615
jobs:
27-
test-android-sdk:
16+
release-android-sdk:
2817
runs-on: ubuntu-latest
18+
2919
steps:
30-
- name: Git clone repository
20+
- name: 🧾 Checkout code
3121
uses: actions/checkout@v4
32-
# Setup java
33-
- uses: actions/setup-java@v4
34-
with:
35-
distribution: temurin
36-
java-version: ${{ env.JAVA_VERSION }}
37-
# Run test
38-
- name: Run Test
39-
run: ./gradlew test
4022

41-
build-and-publish-android-sdk:
42-
runs-on: ubuntu-latest
43-
needs:
44-
- test-android-sdk
45-
steps:
46-
- name: Git clone repository
47-
uses: actions/checkout@v4
48-
# Setup java
49-
- uses: actions/setup-java@v4
23+
- name: ☕ Set up Java 17
24+
uses: actions/setup-java@v4
5025
with:
26+
java-version: 17
5127
distribution: temurin
52-
java-version: ${{ env.JAVA_VERSION }}
53-
# Gradle Assemble
54-
- name: Gradle Assemble
55-
run: ./gradlew assemble${{ env.RELEASE_TAG }}
56-
env:
57-
RELEASE_TAG: ${{ env.GLOBAL_ENV == 'prod' && format('{0}', 'Release' ) || 'Rc' }}
58-
# Convert artifact to lowercase
59-
- name: Rename artifact to lowercase
60-
run: mv ${{ env.ARTIFACT_PATH}}/${{ env.PACKAGE_TYPE }}/VCL-${{ env.RELEASE_TAG }}.${{ env.PACKAGE_TYPE }} ${{ env.ARTIFACT_PATH }}/${{ env.PACKAGE_TYPE }}/vcl-${{ env.RELEASE_TAG }}.${{ env.PACKAGE_TYPE }}
61-
env:
62-
RELEASE_TAG: ${{ env.GLOBAL_ENV == 'prod' && format('{0}', 'release' ) || 'rc' }}
63-
# Show Me Built packages
64-
- name: Show Me Built packages
65-
run: ls -al ${{ env.ARTIFACT_PATH}}/${{ env.PACKAGE_TYPE }}/
66-
- name: Export Nexus Private Key
67-
run: echo "signingPrivateKey=${{ secrets.ANDROID_NEXUS_PRIVATE_KEY }}" >> nexus.properties
68-
# Publish Prod/Rc
69-
- name: Publish Prod/Rc
70-
if: ${{ env.GLOBAL_ENV == 'prod' || env.GLOBAL_ENV == 'rc' }}
71-
run: ./gradlew publish${{ env.RELEASE_TAG }}
72-
env:
73-
RELEASE_TAG: ${{ env.GLOBAL_ENV == 'prod' && format('{0}', 'Release' ) || 'Rc' }}
74-
MAVEN_CENTRAL_TOKEN_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
75-
MAVEN_CENTRAL_TOKEN_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
76-
MAVEN_CENTRAL_SIGNING_KEY_ID: ${{ secrets.MAVEN_CENTRAL_SIGNING_KEY_ID }}
77-
MAVEN_CENTRAL_SIGNING_PASSWORD: ${{ secrets.MAVEN_CENTRAL_SIGNING_PASSWORD }}
78-
MAVEN_CENTRAL_PRIVATE_KEY_B64: ${{ secrets.MAVEN_CENTRAL_PRIVATE_KEY_B64 }}
79-
# Upload Artifacts
80-
- name: Upload Artifact
81-
if: success()
82-
uses: actions/upload-artifact@v4
83-
with:
84-
name: vcl-${{ env.RELEASE_TAG }}.${{ env.PACKAGE_TYPE }}
85-
path: ${{ env.ARTIFACT_PATH }}/${{ env.PACKAGE_TYPE }}
86-
if-no-files-found: error
87-
retention-days: 1
88-
env:
89-
RELEASE_TAG: ${{ env.GLOBAL_ENV == 'prod' && format('{0}', 'release' ) || 'rc' }}
9028

29+
- name: 🛠️ Set up Gradle
30+
uses: gradle/actions/setup-gradle@v3
31+
32+
- name: 📝 Get version from build.gradle
33+
run: |
34+
VERSION=$(grep 'publishVersion *= *".*"' VCL/build.gradle | sed -n 's/.*publishVersion *= *"\([^"]*\)".*/\1/p')
35+
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
36+
echo "Found version: $VERSION"
9137
38+
- name: 🔧 Set publication name and POM file name
39+
run: |
40+
PUB_NAME=
41+
echo "PUBLICATION_NAME=${{ github.event.inputs.environment == 'rc' && 'rc' || 'release' }}" >> $GITHUB_ENV
42+
echo "POM_FILE_NAME=vcl-${{ github.event.inputs.environment == 'rc' && 'rc-' || '' }}${RELEASE_VERSION}.pom" >> $GITHUB_ENV
9243
44+
- name: 🧪 Build AAR + Sources + Javadoc
45+
run: |
46+
./gradlew clean \
47+
:VCL:assembleAll${{ github.event.inputs.environment == 'rc' && 'Rc' || 'Release' }} \
48+
-PprojectVersion=${RELEASE_VERSION} \
49+
-Pprerelease=${{ github.event.inputs.environment == 'rc' }} \
50+
--stacktrace
9351
52+
- name: ✅ Verify expected artifacts exist
53+
run: |
54+
./gradlew \
55+
:VCL:verifyExpectedArtifactsExist
9456
57+
- name: 📦 Stage Artifacts
58+
run: |
59+
./gradlew :VCL:stageArtifacts
9560
61+
- name: 🧪 Generate POM File
62+
run: |
63+
./gradlew :VCL:generatePomFileFor${{ env.PUBLICATION_NAME }}Publication
64+
cp VCL/build/publications/${{ env.PUBLICATION_NAME }}/pom-default.xml VCL/target/staging-deploy/io/velocitycareerlabs/vcl/$RELEASE_VERSION/${{ env.POM_FILE_NAME }}
9665
66+
- name: 📂 List staged artifacts
67+
run: |
68+
ls -R VCL/target/staging-deploy
69+
70+
- name: 🚀 Run JReleaser full-release
71+
if: github.event.inputs.environment != 'dev'
72+
uses: jreleaser/release-action@v2
73+
with:
74+
version: 1.18.0
75+
arguments: >
76+
full-release
77+
--config-file=jreleaser.template.yml
78+
--debug
79+
env:
80+
JRELEASER_PROJECT_JAVA_ARTIFACT_ID: ${{ github.event.inputs.environment == 'rc' && 'vcl-rc' || 'vcl' }}
81+
JRELEASER_MAVENCENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_TOKEN_USERNAME }}
82+
JRELEASER_MAVENCENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_TOKEN_PASSWORD }}
83+
JRELEASER_MAVENCENTRAL_STAGE: ${{ secrets.MAVEN_CENTRAL_STAGING_PROFILE_ID }}
84+
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85+
JRELEASER_PROJECT_VERSION: ${{ env.RELEASE_VERSION }}
86+
JRELEASER_GPG_PUBLIC_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PUBLIC_KEY }}
87+
JRELEASER_GPG_SECRET_KEY: ${{ secrets.MAVEN_CENTRAL_GPG_PRIVATE_KEY }}
88+
JRELEASER_GPG_PASSPHRASE: ${{ secrets.MAVEN_CENTRAL_SIGNING_PASSWORD }}
89+
JRELEASER_TAG_NAME: ${{ github.event.inputs.environment == 'rc' && 'rc-' || '' }}${{ env.RELEASE_VERSION }}
90+
JRELEASER_RELEASE_NAME: ${{ github.event.inputs.environment == 'rc' && 'Release Candidate ' || '' }}${{ env.RELEASE_VERSION }}
91+
JRELEASER_PRERELEASE_PATTERN: ${{ github.event.inputs.environment == 'rc' && env.RELEASE_VERSION || 'OFF' }}
92+

.gitignore

Lines changed: 65 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,88 +1,76 @@
1-
# Built application files
2-
*.apk
3-
*.aar
4-
*.ap_
5-
*.aab
6-
7-
# Files for the ART/Dalvik VM
8-
*.dex
1+
# ========== OS-LEVEL METADATA ==========
2+
.DS_Store
3+
Thumbs.db
94

10-
# Java class files
11-
*.class
5+
# ========== IDE FILES ==========
6+
.idea/
7+
*.iml
8+
.vscode/
9+
*.code-workspace
1210

13-
# Generated files
14-
bin/
15-
gen/
11+
# ========== BUILD OUTPUT ==========
12+
build/
1613
out/
17-
# Uncomment the following line in case you need and you don't have the release build type files in your app
18-
# release/
14+
**/build/
15+
**/out/
1916

20-
# Gradle files
17+
# ========== JAVA & GRADLE ==========
2118
.gradle/
22-
build/
23-
24-
# Local configuration file (sdk path, etc)
25-
local.properties
26-
27-
# Proguard folder generated by Eclipse
28-
proguard/
19+
.gradle-cache/
20+
!gradle/wrapper/gradle-wrapper.jar
21+
**/target/
22+
*.class
23+
*.jar
24+
*.war
25+
*.ear
2926

30-
# Log Files
27+
# ========== LOGS & REPORTS ==========
3128
*.log
29+
test-results/
30+
*.hprof
3231

33-
# Android Studio Navigation editor temp files
34-
.navigation/
35-
36-
# Android Studio captures folder
32+
# ========== ANDROID ==========
33+
*.apk
34+
*.ap_ # Android Asset Packaging Tool output
3735
captures/
38-
39-
# IntelliJ
40-
*.iml
41-
.idea/workspace.xml
42-
.idea/tasks.xml
43-
.idea/gradle.xml
44-
.idea/assetWizardSettings.xml
45-
.idea/dictionaries
46-
.idea/libraries
47-
# Android Studio 3 in .gitignore file.
48-
.idea/caches
49-
.idea/modules.xml
50-
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
51-
.idea/navEditor.xml
52-
53-
# Keystore files
54-
# Uncomment the following lines if you do not want to check your keystore files in.
55-
#*.jks
56-
#*.keystore
57-
58-
# External native build folder generated in Android Studio 2.2 and later
59-
.externalNativeBuild
36+
.externalNativeBuild/
6037
.cxx/
38+
local.properties
6139

62-
# Google Services (e.g. APIs or Firebase)
63-
# google-services.json
64-
65-
# Freeline
66-
freeline.py
67-
freeline/
68-
freeline_project_description.json
69-
70-
# fastlane
71-
fastlane/report.xml
72-
fastlane/Preview.html
73-
fastlane/screenshots
74-
fastlane/test_output
75-
fastlane/readme.md
76-
77-
# Version control
78-
vcs.xml
79-
80-
# lint
81-
lint/intermediates/
82-
lint/generated/
83-
lint/outputs/
84-
lint/tmp/
85-
# lint/reports/
86-
app/.DS_Store
87-
.DS_Store
88-
.idea/*
40+
# ========== JRELEASER ==========
41+
.github/jreleaser.yml
42+
43+
# ========== GPG & SECRETS ==========
44+
*.asc
45+
*.gpg
46+
*.key
47+
*.keystore
48+
*.jks
49+
*.p12
50+
51+
# ========== NODE/NPM (if using tooling or frontend) ==========
52+
node_modules/
53+
npm-debug.log
54+
yarn-error.log
55+
dist/
56+
57+
# ========== COVERAGE TOOLS ==========
58+
coverage/
59+
*.lcov
60+
*.ec
61+
jacoco.exec
62+
reports/
63+
64+
# ========== TEMP FILES ==========
65+
*.swp
66+
*.tmp
67+
*.bak
68+
*.orig
69+
*.rej
70+
71+
# ========== ENV / CI CONFIG ==========
72+
.env
73+
.env.*
74+
secrets/
75+
/rep
76+
/VCL/property*/

0 commit comments

Comments
 (0)