From 31625fd8a05611cbed0e8ee451e8e5ee6ce1702a Mon Sep 17 00:00:00 2001 From: Edoardo Vacchi Date: Fri, 8 Nov 2024 09:44:11 +0100 Subject: [PATCH 1/2] Add CI for PRs and release flow Signed-off-by: Edoardo Vacchi --- .github/workflows/ci.yaml | 29 ++++++ .github/workflows/release.yaml | 78 ++++++++++++++++ .gitignore | 5 +- LICENSE | 2 +- pom.xml | 165 ++++++++++++++++++++++++++++++++- 5 files changed, 269 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/ci.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..e7a99b8 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,29 @@ +name: Java CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + java: + name: Java + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] + version: [11, 17] + rust: + - stable + steps: + - name: Checkout sources + uses: actions/checkout@v3 + - name: Set up Java + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '${{ matrix.version }}' + - name: Test Java + run: | + mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn verify diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..4a3b5b3 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,78 @@ +name: release + +on: + workflow_dispatch: + inputs: + release-version: + description: 'Version being released' + required: true + branch: + description: 'Branch to release from' + required: true + default: 'main' + +permissions: + contents: write + +jobs: + release: + name: Release + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Java + uses: actions/setup-java@v4 + with: + java-version: 21 + distribution: 'temurin' + server-id: ossrh + server-username: MAVEN_USERNAME + server-password: MAVEN_CENTRAL_TOKEN + gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-passphrase: MAVEN_GPG_PASSPHRASE + + - id: install-secret-key + name: Install gpg secret key + run: | + cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import + gpg --list-secret-keys --keyid-format LONG + + - name: Compile + run: mvn --batch-mode verify + + - name: Setup Git + run: | + git config user.name "Extism BOT" + git config user.email "extism@dylibso.com" + + - name: Set the version + run: | + mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.release-version }} + ./scripts/update-docs-version ${{ github.event.inputs.release-version }} + git add . + git commit -m "Release version update ${{ github.event.inputs.release-version }}" + git push + git tag ${{ github.event.inputs.release-version }} + git push origin ${{ github.event.inputs.release-version }} + env: + GITHUB_TOKEN: ${{secrets.GH_TOKEN}} + + - name: Release to Maven Central + run: | + mvn --batch-mode clean verify deploy -Drelease -DskipTests=true -X + env: + MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + + - name: Back to Snapshot + run: | + mvn versions:set -DgenerateBackupPoms=false -DnewVersion=999-SNAPSHOT + git add . + git commit -m "Snapshot version update" + git push + env: + GITHUB_TOKEN: ${{secrets.GH_TOKEN}} diff --git a/.gitignore b/.gitignore index 5ff6309..b425f09 100644 --- a/.gitignore +++ b/.gitignore @@ -4,10 +4,7 @@ target/ !**/src/test/**/target/ ### IntelliJ IDEA ### -.idea/modules.xml -.idea/jarRepositories.xml -.idea/compiler.xml -.idea/libraries/ +.idea/ *.iws *.iml *.ipr diff --git a/LICENSE b/LICENSE index c6c70b4..31673b2 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright 2022 Dylibso, Inc. +Copyright 2022-2024 Dylibso, Inc. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff --git a/pom.xml b/pom.xml index a680e25..de9dc98 100644 --- a/pom.xml +++ b/pom.xml @@ -9,17 +9,68 @@ jar chicory-sdk - http://maven.apache.org + https://github.com/extism/extism + Java-SDK for Extism to use WebAssembly from Java using the Chicory runtime + + + + + BSD 3-Clause + https://opensource.org/licenses/BSD-3-Clause + + + + + Dylibso, Inc. + https://dylib.so + + + + + The Extism Authors + oss@extism.org + + Maintainer + + Dylibso, Inc. + https://dylib.so + + + + + scm:git:git://github.com/extism/extism.git + scm:git:ssh://git@github.com/extism/extism.git + https://github.com/extism/extism/tree/main/java + main + + + + Github + https://github.com/extism/chicory-sdk/issues + + + + + ossrh + Central Repository OSSRH + https://oss.sonatype.org/service/local/staging/deploy/maven2/ + + UTF-8 UTF-8 - 11 - 11 - 11 + 11 0.0.12 + 3.8.1 + + 3.10.1 + 2.22.2 + 3.4.1 + 3.2.1 + 3.2.7 @@ -41,8 +92,112 @@ junit junit - 3.8.1 + ${junit.version} test + + + + release + + + ossrh + https://s01.oss.sonatype.org/content/repositories/snapshots + + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + ${maven-javadoc-plugin.version} + + -Xdoclint:none + + + + attach-javadoc + + jar + + + + + + org.apache.maven.plugins + maven-source-plugin + ${maven-source-plugin.version} + + + attach-source + + jar + + + + + + org.apache.maven.plugins + maven-gpg-plugin + ${maven-gpg-plugin.version} + + + sign-artifacts + verify + + sign + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + true + + ossrh + https://s01.oss.sonatype.org/ + true + + + + + + + + + + + org.sonatype.plugins + nexus-staging-maven-plugin + 1.7.0 + true + + ossrh + https://s01.oss.sonatype.org/ + + + + org.apache.maven.plugins + maven-compiler-plugin + ${maven-compiler-plugin.version} + + ${java.version} + + + + org.apache.maven.plugins + maven-surefire-plugin + ${maven-surefire-plugin.version} + + + ../target/release + + + + + + From 733bb6e438bfa1e447b206b82138a4db62d586bc Mon Sep 17 00:00:00 2001 From: Edoardo Vacchi Date: Mon, 11 Nov 2024 14:59:47 +0100 Subject: [PATCH 2/2] update reflecting https://github.com/extism/java-sdk/pull/34 Signed-off-by: Edoardo Vacchi --- .github/workflows/release.yaml | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 4a3b5b3..62f1f95 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -31,13 +31,13 @@ jobs: server-id: ossrh server-username: MAVEN_USERNAME server-password: MAVEN_CENTRAL_TOKEN - gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }} + gpg-private-key: ${{ secrets.JRELEASER_GPG_SECRET_KEY }} gpg-passphrase: MAVEN_GPG_PASSPHRASE - id: install-secret-key name: Install gpg secret key run: | - cat <(echo -e "${{ secrets.GPG_PRIVATE_KEY }}") | gpg --batch --import + cat <(echo -e "${{ secrets.JRELEASER_GPG_SECRET_KEY }}") | gpg --batch --import gpg --list-secret-keys --keyid-format LONG - name: Compile @@ -46,27 +46,26 @@ jobs: - name: Setup Git run: | git config user.name "Extism BOT" - git config user.email "extism@dylibso.com" + git config user.email "oss@extism.org" - name: Set the version run: | mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.release-version }} - ./scripts/update-docs-version ${{ github.event.inputs.release-version }} git add . git commit -m "Release version update ${{ github.event.inputs.release-version }}" git push git tag ${{ github.event.inputs.release-version }} git push origin ${{ github.event.inputs.release-version }} env: - GITHUB_TOKEN: ${{secrets.GH_TOKEN}} + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} - name: Release to Maven Central run: | - mvn --batch-mode clean verify deploy -Drelease -DskipTests=true -X + mvn --batch-mode clean verify deploy -X env: - MAVEN_USERNAME: ${{ secrets.SONATYPE_USERNAME }} - MAVEN_CENTRAL_TOKEN: ${{ secrets.SONATYPE_PASSWORD }} - MAVEN_GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} + MAVEN_USERNAME: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }} + MAVEN_CENTRAL_TOKEN: ${{ secrets.JRELEASER_NEXUS2_USERNAME }} + MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }} - name: Back to Snapshot run: | @@ -75,4 +74,4 @@ jobs: git commit -m "Snapshot version update" git push env: - GITHUB_TOKEN: ${{secrets.GH_TOKEN}} + GITHUB_TOKEN: ${{ github.token }}