Skip to content
This repository has been archived by the owner on Oct 12, 2021. It is now read-only.

Commit

Permalink
Merge pull request #226 from vegaprotocol/fix-ci-warnings
Browse files Browse the repository at this point in the history
Java: Add JAR creation to CI
  • Loading branch information
ashleyvega committed May 22, 2021
2 parents 121b4c6 + 3c69048 commit c510dd4
Show file tree
Hide file tree
Showing 6 changed files with 65 additions and 11 deletions.
53 changes: 53 additions & 0 deletions .github/workflows/java.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---

name: Java

"on":
pull_request:
branches:
- develop
- main
paths:
- "external/**"
- "grpc/clients/java/**"
- "grpc/examples/java/**"
- "proto/**"
- "rest/examples/java/**"
push:
branches:
- develop
tags:
- "v[0-9]+.[0-9]+.[0-9]+"
- "v[0-9]+.[0-9]+.[0-9]+-pre[0-9]+"

jobs:

build:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up JDK 11
uses: actions/setup-java@v2
with:
java-version: '11'
distribution: 'adopt'

- name: Build with Maven
run: |
cd grpc/clients/java
./make-jar.sh
- name: Set release version
id: vars
if: ${{ startsWith(github.ref, 'refs/tags/') }}
run: echo ::set-output name=version::${GITHUB_REF#refs/*/v}

- name: Publish JAR file
uses: softprops/action-gh-release@v1
if: ${{ startsWith(github.ref, 'refs/tags/') }}
with:
files: grpc/clients/java/generated/target/vega-${{ steps.vars.outputs.version }}.jar
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,7 @@ Pull requests for additional languages are gratefully received.

## Update process - gRPC

Install BUF
* https://docs.buf.build/installation/
Install `buf`: https://docs.buf.build/installation/

```bash
# Copy proto files from Core
Expand All @@ -78,7 +77,7 @@ Run the update for gRPC in general and this will generate all the Java source fi
Install maven
* Linux: `sudo apt install maven`

Run `./make-jar.sh` in the `grpc/clients/java` directory
Run `./make-jar.sh` in the `grpc/clients/java` directory.

## Update process - GraphQL

Expand Down
4 changes: 2 additions & 2 deletions grpc/clients/java/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
*.jar
*.class
classes
generated/manifest.txt
lib
generated/pom.xml
target
8 changes: 3 additions & 5 deletions grpc/clients/java/make-jar.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@

# This script generates a jar file. Run it as:
#
# cd java
# cd grpc/clients/java
# ./make-jar.sh

set -e

java_generated_dir=generated
cp pom.xml generated/

cp pom.xml $java_generated_dir/

pushd $java_generated_dir 1>/dev/null || exit 1
pushd generated 1>/dev/null || exit 1
mvn clean package
popd 1>/dev/null || exit 1
2 changes: 1 addition & 1 deletion grpc/clients/java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.vegaprotocol</groupId>
<artifactId>vega</artifactId>
<version>1.0-SNAPSHOT</version>
<version>0.36.0</version>
<packaging>jar</packaging>
<properties>
<src.dir>src</src.dir>
Expand Down
4 changes: 4 additions & 0 deletions setversion.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ checkfile README.md '^Version: '"$version"'$'
# CPP
# to be done

# Java
sed --in-place -e 's#^ <version>[^<]*</version># <version>'"$version"'</version>#' grpc/clients/java/pom.xml
checkfile grpc/clients/java/pom.xml "<version>$version</version>"

# Javascript
sed --in-place -e 's#"version": "[^"]*"#"version": "'"$version"'"#' grpc/clients/js/package.json
checkfile grpc/clients/js/package.json '"version": "'"$version"'",'
Expand Down

0 comments on commit c510dd4

Please sign in to comment.