Skip to content

Commit d2f00de

Browse files
authored
Add CI for PRs and release flow (#15)
Signed-off-by: Edoardo Vacchi <[email protected]>
1 parent 2572335 commit d2f00de

File tree

5 files changed

+268
-10
lines changed

5 files changed

+268
-10
lines changed

.github/workflows/ci.yaml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Java CI
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
java:
11+
name: Java
12+
runs-on: ${{ matrix.os }}
13+
strategy:
14+
matrix:
15+
os: [ubuntu-latest]
16+
version: [11, 17]
17+
rust:
18+
- stable
19+
steps:
20+
- name: Checkout sources
21+
uses: actions/checkout@v3
22+
- name: Set up Java
23+
uses: actions/setup-java@v3
24+
with:
25+
distribution: 'temurin'
26+
java-version: '${{ matrix.version }}'
27+
- name: Test Java
28+
run: |
29+
mvn --batch-mode -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn verify

.github/workflows/release.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
name: release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release-version:
7+
description: 'Version being released'
8+
required: true
9+
branch:
10+
description: 'Branch to release from'
11+
required: true
12+
default: 'main'
13+
14+
permissions:
15+
contents: write
16+
17+
jobs:
18+
release:
19+
name: Release
20+
runs-on: ubuntu-latest
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v4
25+
26+
- name: Setup Java
27+
uses: actions/setup-java@v4
28+
with:
29+
java-version: 21
30+
distribution: 'temurin'
31+
server-id: ossrh
32+
server-username: MAVEN_USERNAME
33+
server-password: MAVEN_CENTRAL_TOKEN
34+
gpg-private-key: ${{ secrets.JRELEASER_GPG_SECRET_KEY }}
35+
gpg-passphrase: MAVEN_GPG_PASSPHRASE
36+
37+
- id: install-secret-key
38+
name: Install gpg secret key
39+
run: |
40+
cat <(echo -e "${{ secrets.JRELEASER_GPG_SECRET_KEY }}") | gpg --batch --import
41+
gpg --list-secret-keys --keyid-format LONG
42+
43+
- name: Compile
44+
run: mvn --batch-mode verify
45+
46+
- name: Setup Git
47+
run: |
48+
git config user.name "Extism BOT"
49+
git config user.email "[email protected]"
50+
51+
- name: Set the version
52+
run: |
53+
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=${{ github.event.inputs.release-version }}
54+
git add .
55+
git commit -m "Release version update ${{ github.event.inputs.release-version }}"
56+
git push
57+
git tag ${{ github.event.inputs.release-version }}
58+
git push origin ${{ github.event.inputs.release-version }}
59+
env:
60+
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
61+
62+
- name: Release to Maven Central
63+
run: |
64+
mvn --batch-mode clean verify deploy -X
65+
env:
66+
MAVEN_USERNAME: ${{ secrets.JRELEASER_NEXUS2_PASSWORD }}
67+
MAVEN_CENTRAL_TOKEN: ${{ secrets.JRELEASER_NEXUS2_USERNAME }}
68+
MAVEN_GPG_PASSPHRASE: ${{ secrets.JRELEASER_GPG_PASSPHRASE }}
69+
70+
- name: Back to Snapshot
71+
run: |
72+
mvn versions:set -DgenerateBackupPoms=false -DnewVersion=999-SNAPSHOT
73+
git add .
74+
git commit -m "Snapshot version update"
75+
git push
76+
env:
77+
GITHUB_TOKEN: ${{ github.token }}

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,7 @@ target/
44
!**/src/test/**/target/
55

66
### IntelliJ IDEA ###
7-
.idea/modules.xml
8-
.idea/jarRepositories.xml
9-
.idea/compiler.xml
10-
.idea/libraries/
7+
.idea/
118
*.iws
129
*.iml
1310
*.ipr

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright 2022 Dylibso, Inc.
1+
Copyright 2022-2024 Dylibso, Inc.
22

33
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
44

pom.xml

Lines changed: 160 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,68 @@
99
<packaging>jar</packaging>
1010

1111
<name>chicory-sdk</name>
12-
<url>http://maven.apache.org</url>
12+
<url>https://github.com/extism/extism</url>
13+
<description>Java-SDK for Extism to use WebAssembly from Java using the Chicory runtime</description>
14+
15+
16+
<licenses>
17+
<license>
18+
<name>BSD 3-Clause</name>
19+
<url>https://opensource.org/licenses/BSD-3-Clause</url>
20+
</license>
21+
</licenses>
22+
23+
<organization>
24+
<name>Dylibso, Inc.</name>
25+
<url>https://dylib.so</url>
26+
</organization>
27+
28+
<developers>
29+
<developer>
30+
<name>The Extism Authors</name>
31+
<email>[email protected]</email>
32+
<roles>
33+
<role>Maintainer</role>
34+
</roles>
35+
<organization>Dylibso, Inc.</organization>
36+
<organizationUrl>https://dylib.so</organizationUrl>
37+
</developer>
38+
</developers>
39+
40+
<scm>
41+
<connection>scm:git:git://github.com/extism/extism.git</connection>
42+
<developerConnection>scm:git:ssh://[email protected]/extism/extism.git</developerConnection>
43+
<url>https://github.com/extism/extism/tree/main/java</url>
44+
<tag>main</tag>
45+
</scm>
46+
47+
<issueManagement>
48+
<system>Github</system>
49+
<url>https://github.com/extism/chicory-sdk/issues</url>
50+
</issueManagement>
51+
52+
<distributionManagement>
53+
<repository>
54+
<id>ossrh</id>
55+
<name>Central Repository OSSRH</name>
56+
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
57+
</repository>
58+
</distributionManagement>
1359

1460
<properties>
1561
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1662
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
1763

18-
<maven.compiler.source>11</maven.compiler.source>
19-
<maven.compiler.target>11</maven.compiler.target>
20-
<maven.compiler.release>11</maven.compiler.release>
64+
<java.version>11</java.version>
2165

2266
<chicory.version>0.0.12</chicory.version>
67+
<junit.version>3.8.1</junit.version>
68+
69+
<maven-compiler-plugin.version>3.10.1</maven-compiler-plugin.version>
70+
<maven-surefire-plugin.version>2.22.2</maven-surefire-plugin.version>
71+
<maven-javadoc-plugin.version>3.4.1</maven-javadoc-plugin.version>
72+
<maven-source-plugin.version>3.2.1</maven-source-plugin.version>
73+
<maven-gpg-plugin.version>3.2.7</maven-gpg-plugin.version>
2374
</properties>
2475

2576
<dependencies>
@@ -41,8 +92,112 @@
4192
<dependency>
4293
<groupId>junit</groupId>
4394
<artifactId>junit</artifactId>
44-
<version>3.8.1</version>
95+
<version>${junit.version}</version>
4596
<scope>test</scope>
4697
</dependency>
4798
</dependencies>
99+
100+
<profiles>
101+
<profile>
102+
<id>release</id>
103+
<distributionManagement>
104+
<snapshotRepository>
105+
<id>ossrh</id>
106+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
107+
</snapshotRepository>
108+
</distributionManagement>
109+
110+
<build>
111+
<plugins>
112+
<plugin>
113+
<groupId>org.apache.maven.plugins</groupId>
114+
<artifactId>maven-javadoc-plugin</artifactId>
115+
<version>${maven-javadoc-plugin.version}</version>
116+
<configuration>
117+
<additionalJOption>-Xdoclint:none</additionalJOption>
118+
</configuration>
119+
<executions>
120+
<execution>
121+
<id>attach-javadoc</id>
122+
<goals>
123+
<goal>jar</goal>
124+
</goals>
125+
</execution>
126+
</executions>
127+
</plugin>
128+
<plugin>
129+
<groupId>org.apache.maven.plugins</groupId>
130+
<artifactId>maven-source-plugin</artifactId>
131+
<version>${maven-source-plugin.version}</version>
132+
<executions>
133+
<execution>
134+
<id>attach-source</id>
135+
<goals>
136+
<goal>jar</goal>
137+
</goals>
138+
</execution>
139+
</executions>
140+
</plugin>
141+
<plugin>
142+
<groupId>org.apache.maven.plugins</groupId>
143+
<artifactId>maven-gpg-plugin</artifactId>
144+
<version>${maven-gpg-plugin.version}</version>
145+
<executions>
146+
<execution>
147+
<id>sign-artifacts</id>
148+
<phase>verify</phase>
149+
<goals>
150+
<goal>sign</goal>
151+
</goals>
152+
</execution>
153+
</executions>
154+
</plugin>
155+
<plugin>
156+
<groupId>org.sonatype.plugins</groupId>
157+
<artifactId>nexus-staging-maven-plugin</artifactId>
158+
<extensions>true</extensions>
159+
<configuration>
160+
<serverId>ossrh</serverId>
161+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
162+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
163+
</configuration>
164+
</plugin>
165+
</plugins>
166+
</build>
167+
</profile>
168+
</profiles>
169+
170+
<build>
171+
<plugins>
172+
<plugin>
173+
<groupId>org.sonatype.plugins</groupId>
174+
<artifactId>nexus-staging-maven-plugin</artifactId>
175+
<version>1.7.0</version>
176+
<extensions>true</extensions>
177+
<configuration>
178+
<serverId>ossrh</serverId>
179+
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
180+
</configuration>
181+
</plugin>
182+
<plugin>
183+
<groupId>org.apache.maven.plugins</groupId>
184+
<artifactId>maven-compiler-plugin</artifactId>
185+
<version>${maven-compiler-plugin.version}</version>
186+
<configuration>
187+
<release>${java.version}</release>
188+
</configuration>
189+
</plugin>
190+
<plugin>
191+
<groupId>org.apache.maven.plugins</groupId>
192+
<artifactId>maven-surefire-plugin</artifactId>
193+
<version>${maven-surefire-plugin.version}</version>
194+
<configuration>
195+
<systemPropertyVariables>
196+
<jna.library.path>../target/release</jna.library.path>
197+
</systemPropertyVariables>
198+
</configuration>
199+
</plugin>
200+
</plugins>
201+
</build>
202+
48203
</project>

0 commit comments

Comments
 (0)