Skip to content

add maven build

add maven build #227

Workflow file for this run

name: Java CI Combined
on: [push, pull_request, workflow_dispatch]
jobs:
setup:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.extract-version.outputs.VERSION }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Cache Maven packages
uses: actions/cache@v3
with:
path: ~/.m2
key: lucee-script-runner-maven-cache
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Extract version number
id: extract-version
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
echo "::set-output name=VERSION::$VERSION"
- name: Cache Lucee files
uses: actions/cache@v4
with:
path: ~/work/_actions/lucee/script-runner/main/lucee-download-cache
key: lucee-downloads
- name: Import GPG key
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
build-and-test:
runs-on: ubuntu-latest
needs: setup
env:
testLabels: image
testAdditional: ${{ github.workspace }}/tests
MYSQL_SERVER: localhost
MYSQL_USERNAME: lucee
MYSQL_PASSWORD: lucee
MYSQL_PORT: 3306
MYSQL_DATABASE: lucee
strategy:
matrix:
lucee:
- { version: 'light-5.4.6.9', query: '5/all/light' }
- { version: 'light-6.0.3.1', query: '6.0/all/light' }
- { version: 'light-6.1.0.206-SNAPSHOT', query: '6.1/all/light' }
services:
minio:
image: fclairamb/minio-github-actions
ports:
- 9000:9000
steps:
- uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
java-version: '11'
distribution: 'adopt'
- name: Build and Install with Maven
run: |
echo "------- Maven Install -------";
mvn -B -e -f pom.xml clean install
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: image-lex-${{ matrix.lucee.version }}
path: target/*.lex
- name: Checkout Lucee
uses: actions/checkout@v4
with:
repository: lucee/lucee
path: lucee
- name: Run Lucee Test Suite
uses: lucee/script-runner@main
with:
webroot: ${{ github.workspace }}/lucee/test
execute: /bootstrap-tests.cfm
luceeVersion: ${{ matrix.lucee.version }}
luceeVersionQuery: ${{ matrix.lucee.query }}
extensionDir: ${{ github.workspace }}/target
env:
testLabels: image
testAdditional: ${{ github.workspace }}/tests
deploy:
runs-on: ubuntu-latest
needs: [build-and-test]
if: always() && needs.build-and-test.result == 'success'
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up JDK 11
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '11'
- name: Cache Maven packages
uses: actions/cache@v4
with:
path: ~/.m2
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Import GPG key
run: |
echo "$GPG_PRIVATE_KEY" | base64 --decode | gpg --batch --import
env:
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
- name: Build and Deploy with Maven
env:
MAVEN_USERNAME: ${{ secrets.MAVEN_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.MAVEN_PASSWORD }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
run: |
if [[ "${{ needs.setup.outputs.version }}" == *-SNAPSHOT ]]; then
echo "------- Maven Deploy snapshot on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy --settings maven-settings.xml
else
echo "------- Maven Deploy release on ${{ github.event_name }} -------";
mvn -B -e -f pom.xml clean deploy -DperformRelease=true --settings maven-settings.xml
fi