|
1 | | -# This workflow will build a Java project with Ant |
2 | | -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant |
| 1 | +name: Java CI Combined |
3 | 2 |
|
4 | | -name: Java CI |
5 | | - |
6 | | -on: [push, pull_request,workflow_dispatch] |
| 3 | +on: [push, pull_request, workflow_dispatch] |
7 | 4 |
|
8 | 5 | jobs: |
9 | | - build: |
| 6 | + setup: |
| 7 | + runs-on: ubuntu-latest |
| 8 | + outputs: |
| 9 | + version: ${{ steps.extract-version.outputs.VERSION }} |
| 10 | + steps: |
| 11 | + - name: Checkout repository |
| 12 | + uses: actions/checkout@v4 |
| 13 | + |
| 14 | + - name: Set up JDK 11 |
| 15 | + uses: actions/setup-java@v4 |
| 16 | + with: |
| 17 | + distribution: 'temurin' |
| 18 | + java-version: '11' |
| 19 | + |
| 20 | + - name: Cache Maven packages |
| 21 | + uses: actions/cache@v4 |
| 22 | + with: |
| 23 | + path: ~/.m2 |
| 24 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 25 | + restore-keys: | |
| 26 | + ${{ runner.os }}-maven- |
10 | 27 |
|
| 28 | + - name: Extract version number |
| 29 | + id: extract-version |
| 30 | + run: | |
| 31 | + VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout) |
| 32 | + echo "::set-output name=VERSION::$VERSION" |
| 33 | +
|
| 34 | + - name: Cache Lucee files |
| 35 | + uses: actions/cache@v4 |
| 36 | + with: |
| 37 | + path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache |
| 38 | + key: lucee-downloads |
| 39 | + |
| 40 | + - name: Import GPG key |
| 41 | + run: | |
| 42 | + echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import |
| 43 | + env: |
| 44 | + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} |
| 45 | + |
| 46 | + build-and-test: |
11 | 47 | runs-on: ubuntu-latest |
| 48 | + needs: setup |
12 | 49 | env: |
13 | | - luceeVersion: light-6.0.0.451-BETA |
14 | | - luceeVersionQuery: 0/all/light |
| 50 | + LUCEE_TEST_VERSIONS_PLUS: ${{ vars.LUCEE_TEST_VERSIONS_PLUS }} |
| 51 | + strategy: |
| 52 | + matrix: |
| 53 | + lucee: ${{ fromJSON(vars.LUCEE_TEST_VERSIONS_PLUS) }} |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + |
| 57 | + - name: Set up JDK 11 |
| 58 | + uses: actions/setup-java@v4 |
| 59 | + with: |
| 60 | + java-version: '11' |
| 61 | + distribution: 'adopt' |
| 62 | + |
| 63 | + - name: Build and Install with Maven |
| 64 | + run: | |
| 65 | + echo "------- Maven Install -------"; |
| 66 | + mvn -B -e -f pom.xml clean install |
| 67 | +
|
| 68 | + - name: Upload Artifact |
| 69 | + uses: actions/upload-artifact@v4 |
| 70 | + with: |
| 71 | + name: argon2-lex-${{ matrix.lucee.version }} |
| 72 | + path: target/*.lex |
| 73 | + |
| 74 | + - name: Checkout Lucee |
| 75 | + uses: actions/checkout@v4 |
| 76 | + with: |
| 77 | + repository: lucee/lucee |
| 78 | + path: lucee |
| 79 | + |
| 80 | + - name: Run Lucee Test Suite |
| 81 | + uses: lucee/script-runner@main |
| 82 | + with: |
| 83 | + webroot: ${{ github.workspace }}/lucee/test |
| 84 | + execute: /bootstrap-tests.cfm |
| 85 | + luceeVersion: ${{ matrix.lucee.version }} |
| 86 | + luceeVersionQuery: ${{ matrix.lucee.query }} |
| 87 | + extensionDir: ${{ github.workspace }}/target |
| 88 | + env: |
| 89 | + testLabels: argon2 |
| 90 | + testAdditional: ${{ github.workspace }}/tests |
| 91 | + |
| 92 | + deploy: |
| 93 | + runs-on: ubuntu-latest |
| 94 | + needs: [build-and-test] |
| 95 | + if: always() && needs.build-and-test.result == 'success' |
15 | 96 | steps: |
16 | | - - uses: actions/checkout@v4 |
17 | | - - name: Set up JDK 11 |
18 | | - uses: actions/setup-java@v4 |
19 | | - with: |
20 | | - java-version: '11' |
21 | | - distribution: 'adopt' |
22 | | - - name: Cache Maven packages |
23 | | - uses: actions/cache@v4 |
24 | | - with: |
25 | | - path: ~/.m2 |
26 | | - key: lucee-script-runner-maven-cache |
27 | | - enableCrossOsArchive: true |
28 | | - - name: Cache Lucee files |
29 | | - uses: actions/cache@v4 |
30 | | - with: |
31 | | - path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache |
32 | | - key: lucee-downloads |
33 | | - enableCrossOsArchive: true |
34 | | - - name: Build with Ant |
35 | | - run: ant -noinput -verbose -buildfile build.xml |
36 | | - - name: Upload Artifact |
37 | | - uses: actions/upload-artifact@v4 |
38 | | - with: |
39 | | - name: argon2-lex |
40 | | - path: dist/*.lex |
41 | | - - name: Checkout Lucee |
42 | | - uses: actions/checkout@v4 |
43 | | - with: |
44 | | - repository: lucee/lucee |
45 | | - path: lucee |
46 | | - - name: Run Lucee Test Suite (testFilter="argon2") |
47 | | - uses: lucee/script-runner@main |
48 | | - with: |
49 | | - webroot: ${{ github.workspace }}/lucee/test |
50 | | - execute: /bootstrap-tests.cfm |
51 | | - luceeVersion: ${{ env.luceeVersion }} |
52 | | - luceeVersionQuery: ${{ env.luceeVersionQuery }} |
53 | | - extensionDir: ${{ github.workspace }}/dist |
54 | | - env: |
55 | | - testLabels: argon2 |
56 | | - testAdditional: ${{ github.workspace }}/tests |
| 97 | + - name: Checkout repository |
| 98 | + uses: actions/checkout@v4 |
| 99 | + |
| 100 | + - name: Set up JDK 11 |
| 101 | + uses: actions/setup-java@v4 |
| 102 | + with: |
| 103 | + distribution: 'temurin' |
| 104 | + java-version: '11' |
| 105 | + |
| 106 | + - name: Cache Maven packages |
| 107 | + uses: actions/cache@v4 |
| 108 | + with: |
| 109 | + path: ~/.m2 |
| 110 | + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} |
| 111 | + restore-keys: | |
| 112 | + ${{ runner.os }}-maven- |
| 113 | +
|
| 114 | + - name: Import GPG key |
| 115 | + run: | |
| 116 | + echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import |
| 117 | + env: |
| 118 | + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} |
| 119 | + |
| 120 | + - name: Build and Deploy with Maven |
| 121 | + env: |
| 122 | + MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }} |
| 123 | + MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }} |
| 124 | + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} |
| 125 | + run: | |
| 126 | + if [[ "${{ needs.setup.outputs.version }}" == *-SNAPSHOT ]]; then |
| 127 | + echo "------- Maven Deploy snapshot on ${{ github.event_name }} -------"; |
| 128 | + mvn -B -e -f pom.xml clean deploy --settings maven-settings.xml |
| 129 | + else |
| 130 | + echo "------- Maven Deploy release on ${{ github.event_name }} -------"; |
| 131 | + mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml |
| 132 | + fi |
0 commit comments