|
| 1 | +name: Java SDK Matrix CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches-ignore: |
| 6 | + - staging-test |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + build: |
| 11 | + name: Test ${{ matrix.module }} on JDK ${{ matrix.java }} |
| 12 | + runs-on: ubuntu-20.04 # or ubuntu-latest |
| 13 | + |
| 14 | + strategy: |
| 15 | + matrix: |
| 16 | + java: [ '8', '9', '10', '11' ] |
| 17 | + module: [ 'core', 'http5' ] |
| 18 | + |
| 19 | + steps: |
| 20 | + - name: Checkout code |
| 21 | + uses: actions/checkout@v4 |
| 22 | + |
| 23 | + - name: Set up JDK ${{ matrix.java }} |
| 24 | + uses: actions/setup-java@v4 |
| 25 | + with: |
| 26 | + distribution: 'adopt' |
| 27 | + java-version: ${{ matrix.java }} |
| 28 | + |
| 29 | + - name: Clean Gradle plugin cache |
| 30 | + run: | |
| 31 | + rm -f $HOME/.gradle/caches/modules-2/modules-2.lock |
| 32 | + rm -fr $HOME/.gradle/caches/*/plugin-resolution/ |
| 33 | +
|
| 34 | + - name: Cache Gradle |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: | |
| 38 | + ~/.gradle/caches |
| 39 | + ~/.gradle/wrapper |
| 40 | + key: ${{ runner.os }}-gradle-${{ matrix.java }}-${{ matrix.module }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} |
| 41 | + restore-keys: | |
| 42 | + ${{ runner.os }}-gradle- |
| 43 | +
|
| 44 | + - name: Create test subaccount |
| 45 | + run: ./gradlew createTestSubAccount -PmoduleName=${{ matrix.module }} |
| 46 | + |
| 47 | + - name: Load CLOUDINARY_URL and run ciTest |
| 48 | + run: | |
| 49 | + source tools/cloudinary_url.txt |
| 50 | + ./gradlew -DCLOUDINARY_URL=$CLOUDINARY_URL ciTest -p cloudinary-${{ matrix.module }} -i |
| 51 | +
|
| 52 | + - name: Notify by email on failure (optional) |
| 53 | + if: failure() |
| 54 | + uses: dawidd6/action-send-mail@v3 |
| 55 | + with: |
| 56 | + server_address: smtp.example.com # 🔧 Replace with actual SMTP server |
| 57 | + server_port: 465 |
| 58 | + username: ${{ secrets.SMTP_USERNAME }} |
| 59 | + password: ${{ secrets.SMTP_PASSWORD }} |
| 60 | + subject: "Build Failed: Java SDK CI" |
| 61 | + body: "CI build failed for module '${{ matrix.module }}' on JDK '${{ matrix.java }}'" |
| 62 | + to: sdk_developers@cloudinary.com |
| 63 | + from: GitHub Actions <ci@example.com> |
0 commit comments