From 7d42e4711cafbaa0e1c786f5b093ec7fe4338b5e Mon Sep 17 00:00:00 2001 From: michaeloffner Date: Tue, 25 Jun 2024 14:23:45 +0200 Subject: [PATCH] add maven build --- .github/workflows/main-5.4.yml | 73 ---------- .github/workflows/main-6.0.yml | 72 ---------- .github/workflows/main.yml | 179 ++++++++++++++++------- .gitignore | 2 +- ExtensionProvider.cfc | 43 ------ build-compile.xml | 57 -------- build.number | 3 - build.properties | 14 -- build.xml | 140 ++++++++++++------ maven-settings.xml | 27 ++++ pom.xml | 256 +++++++++++++++++++++++++++++++++ project.properties | 4 - reload.cfm | 1 - 13 files changed, 510 insertions(+), 361 deletions(-) delete mode 100644 .github/workflows/main-5.4.yml delete mode 100644 .github/workflows/main-6.0.yml delete mode 100644 ExtensionProvider.cfc delete mode 100644 build-compile.xml delete mode 100644 build.number delete mode 100644 build.properties create mode 100755 maven-settings.xml create mode 100644 pom.xml delete mode 100644 project.properties delete mode 100644 reload.cfm diff --git a/.github/workflows/main-5.4.yml b/.github/workflows/main-5.4.yml deleted file mode 100644 index 84e8a4e..0000000 --- a/.github/workflows/main-5.4.yml +++ /dev/null @@ -1,73 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Java CI - Lucee 5.4 - -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - - runs-on: ubuntu-latest - services: - redis: - # Docker Hub image - image: redis - # Set health checks to wait until redis has started - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps port 6379 on service container to the host - - 6379:6379 - env: - luceeVersion: light-5.4.3.2 - luceeVersionQuery: 5.4/snapshot/light - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2 - key: lucee-script-runner-maven-cache - - name: Cache Lucee files - uses: actions/cache@v4 - with: - path: _actions/lucee/script-runner/main/lucee-download-cache - key: lucee-downloads-${{ env.luceeVersion }} - restore-keys: | - lucee-downloads - - name: Build with Ant - run: ant -noinput -verbose -buildfile build.xml - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: redis-lex - path: dist/*.lex - - name: Checkout Lucee - uses: actions/checkout@v4 - with: - repository: lucee/lucee - path: lucee - - name: Run Lucee Test Suite, labels="redis" - uses: lucee/script-runner@main - with: - webroot: ${{ github.workspace }}/lucee/test - execute: /bootstrap-tests.cfm - luceeVersion: ${{ env.luceeVersion }} - luceeVersionQuery: ${{ env.luceeVersionQuery }} - extensionDir: ${{ github.workspace }}/dist - extensions: - env: - testLabels: redis - testAdditional: ${{ github.workspace }}/tests - REDIS_PORT: 6379 - REDIS_SERVER: localhost diff --git a/.github/workflows/main-6.0.yml b/.github/workflows/main-6.0.yml deleted file mode 100644 index d405a2d..0000000 --- a/.github/workflows/main-6.0.yml +++ /dev/null @@ -1,72 +0,0 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Java CI - Lucee 6.0 - -on: [push, pull_request, workflow_dispatch] - -jobs: - build: - - runs-on: ubuntu-latest - services: - redis: - # Docker Hub image - image: redis - # Set health checks to wait until redis has started - options: >- - --health-cmd "redis-cli ping" - --health-interval 10s - --health-timeout 5s - --health-retries 5 - ports: - # Maps port 6379 on service container to the host - - 6379:6379 - env: - luceeVersion: light-6.0.0.451-BETA - luceeVersionQuery: 6.0/snapshot/light - - steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2 - key: lucee-script-runner-maven-cache - - name: Cache Lucee files - uses: actions/cache@v4 - with: - path: _actions/lucee/script-runner/main/lucee-download-cache - key: lucee-downloads-${{ env.luceeVersion }} - restore-keys: | - lucee-downloads - - name: Build with Ant - run: ant -noinput -verbose -buildfile build.xml - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: redis-lex - path: dist/*.lex - - name: Checkout Lucee - uses: actions/checkout@v4 - with: - repository: lucee/lucee - path: lucee - - name: Run Lucee Test Suite, labels="redis" - uses: lucee/script-runner@main - with: - webroot: ${{ github.workspace }}/lucee/test - execute: /bootstrap-tests.cfm - luceeVersion: ${{ env.luceeVersion }} - luceeVersionQuery: ${{ env.luceeVersionQuery }} - extensionDir: ${{ github.workspace }}/dist - env: - testLabels: redis - testAdditional: ${{ github.workspace }}/tests - REDIS_PORT: 6379 - REDIS_SERVER: localhost diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c56f526..50afeae 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,14 +1,56 @@ -# This workflow will build a Java project with Ant -# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-ant - -name: Java CI - Lucee 6.1 +name: Java CI Combined on: [push, pull_request, workflow_dispatch] jobs: - build: + 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@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: + LUCEE_TEST_VERSIONS: ${{ vars.LUCEE_TEST_VERSIONS }} + strategy: + matrix: + lucee: ${{ fromJSON(vars.LUCEE_TEST_VERSIONS) }} services: redis: # Docker Hub image @@ -22,51 +64,86 @@ jobs: ports: # Maps port 6379 on service container to the host - 6379:6379 - env: - luceeVersion: light-6.0.0.451-BETA - luceeVersionQuery: 6.1/snapshot/light + 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: redis-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: redis + testAdditional: ${{ github.workspace }}/tests + deploy: + runs-on: ubuntu-latest + needs: [build-and-test] + if: always() && needs.build-and-test.result == 'success' steps: - - uses: actions/checkout@v4 - - name: Set up JDK 11 - uses: actions/setup-java@v4 - with: - java-version: '11' - distribution: 'temurin' - - name: Cache Maven packages - uses: actions/cache@v4 - with: - path: ~/.m2 - key: lucee-script-runner-maven-cache - - name: Cache Lucee files - uses: actions/cache@v4 - with: - path: _actions/lucee/script-runner/main/lucee-download-cache - key: lucee-downloads-${{ env.luceeVersion }} - restore-keys: | - lucee-downloads - - name: Build with Ant - run: ant -noinput -verbose -buildfile build.xml - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: redis-lex - path: dist/*.lex - - name: Checkout Lucee - uses: actions/checkout@v4 - with: - repository: lucee/lucee - path: lucee - - name: Run Lucee Test Suite, labels="redis" - uses: lucee/script-runner@main - with: - webroot: ${{ github.workspace }}/lucee/test - execute: /bootstrap-tests.cfm - luceeVersion: ${{ env.luceeVersion }} - luceeVersionQuery: ${{ env.luceeVersionQuery }} - extensionDir: ${{ github.workspace }}/dist - env: - testLabels: redis - testAdditional: ${{ github.workspace }}/tests - REDIS_PORT: 6379 - REDIS_SERVER: localhost + - 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 diff --git a/.gitignore b/.gitignore index 79f5740..e31320e 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ *.class *.classpath *.DS_Store -dist/ +target/ diff --git a/ExtensionProvider.cfc b/ExtensionProvider.cfc deleted file mode 100644 index 72c354f..0000000 --- a/ExtensionProvider.cfc +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build-compile.xml b/build-compile.xml deleted file mode 100644 index fc19329..0000000 --- a/build-compile.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - Build Redis Extension Compile - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/build.number b/build.number deleted file mode 100644 index 83d8d3a..0000000 --- a/build.number +++ /dev/null @@ -1,3 +0,0 @@ -#Build Number for ANT. Do not edit! -#Fri Dec 15 16:39:37 CET 2023 -build.number=57 diff --git a/build.properties b/build.properties deleted file mode 100644 index 75489d5..0000000 --- a/build.properties +++ /dev/null @@ -1,14 +0,0 @@ - -bundlename: redis.extension -bundleversion: 3.0.0. -bundleversion_appendix: -SNAPSHOT -codename: redis -camelname: Redis -author: Michael Offner -category: Cache -id: 60772C12-F179-D555-8E2CD2B4F7428718 -releaseType: server -label: Redis driver -lab: Redis driver -class: lucee.extension.io.cache.redis.simple.RedisCache -description: Free and open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. diff --git a/build.xml b/build.xml index cd3b313..647fd93 100644 --- a/build.xml +++ b/build.xml @@ -2,41 +2,69 @@ Build Redis Extension - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Manifest-Version: 1.0 Built-Date: ${NOW} -version: "${bundleversion}${build.number}${bundleversion_appendix}" +version: "${bundleversion}" id: "${id}" name: "${label}" description: "${description}" start-bundles: false release-type: ${releaseType} -cache: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bundleversion}${build.number}${bundleversion_appendix}'}]" +cache: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bundleversion}'}]" @@ -50,18 +78,33 @@ cache: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bun - - - - - + + + + - - - - - + + + + + @@ -70,17 +113,30 @@ cache: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bun - - - - - - + + + + + + + @@ -90,7 +146,7 @@ cache: "[{'class':'${class}','bundleName':'${bundlename}','bundleVersion':'${bun - + diff --git a/maven-settings.xml b/maven-settings.xml new file mode 100755 index 0000000..3647539 --- /dev/null +++ b/maven-settings.xml @@ -0,0 +1,27 @@ + + + + + + + ossrh + ${env.MAVEN_USERNAME} + ${env.MAVEN_PASSWORD} + + + + + + ossrh + + true + + + gpg2 + ${env.GPG_PASSPHRASE} + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..9816f6f --- /dev/null +++ b/pom.xml @@ -0,0 +1,256 @@ + + 4.0.0 + org.lucee + redis-extension + 3.0.0.58-SNAPSHOT + pom + Redis Extension + + + UTF-8 + 11 + 11 + 60772C12-F179-D555-8E2CD2B4F7428718 + org.lucee.redis.extension + 5.0.0.157 + server + + Redis + lucee.extension.io.cache.redis.simple.RedisCache + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + https://oss.sonatype.org/content/repositories/snapshots/ + + + + https://github.com/lucee/extension-redis + scm:git:git://github.com/lucee/extension-redis.git + scm:git:git@github.com:lucee/extension-redis.git + ${project.version} + + + + + ossrh + ${release.url} + + + ossrh + ${snapshot.url} + + + + + + The GNU Lesser General Public License, Version 2.1 + http://www.gnu.org/licenses/lgpl-2.1.txt + repo + + + + + + micstriit + Michael Offner + michael@lucee.org + Lucee Association Switzerland + http://lucee.org + + Project-Administrator + Developer + + +1 + + + + Free and open source, high-performance, distributed memory object caching system, generic in nature, but intended for use in speeding up dynamic web applications by alleviating database load. + https://github.com/lucee/extension-redis + + + + release-sign-artifacts + + + performRelease + true + + + + + + + org.apache.maven.plugins + maven-gpg-plugin + 3.0.1 + + + sign-artifacts + verify + + sign + + + + ${project.build.directory}/${project.artifactId}-${project.version}.lex + + + + + + + org.apache.maven.plugins + maven-release-plugin + 3.0.0 + + true + false + release + deploy + + + + + + + + + + + + org.apache.maven.plugins + maven-antrun-plugin + 1.8 + + + package + + run + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + org.codehaus.mojo + build-helper-maven-plugin + 3.2.0 + + + attach-artifacts + package + + attach-artifact + + + + + ${project.build.directory}/${project.artifactId}-${project.version}.lex + lex + + + + + + + + + + org.apache.maven.plugins + maven-clean-plugin + 3.1.0 + + + cleanup + post-package + + clean + + + + + ${project.build.directory}/antrun + + **/* + + + + ${project.build.directory}/archive-tmp + + **/* + + + + + + + + + + + org.apache.maven.plugins + maven-deploy-plugin + 3.0.0-M1 + + + default-deploy + deploy + + deploy-file + + + ${project.build.directory}/${project.artifactId}-${project.version}.lex + ${project.groupId} + ${project.artifactId} + ${project.version} + ossrh + ${deploy.url} + lex + + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.6.13 + true + + ossrh + https://oss.sonatype.org/ + true + + + + + diff --git a/project.properties b/project.properties deleted file mode 100644 index bff1a22..0000000 --- a/project.properties +++ /dev/null @@ -1,4 +0,0 @@ -#locations -project.extensionDir = extension/ -project.publishDir = /Users/thomas/workspace/unified-cms/html-data/extensions -version = 0.1.0 \ No newline at end of file diff --git a/reload.cfm b/reload.cfm deleted file mode 100644 index 51fe066..0000000 --- a/reload.cfm +++ /dev/null @@ -1 +0,0 @@ -