Skip to content

Commit

Permalink
Add build-java, update yml and other files
Browse files Browse the repository at this point in the history
  • Loading branch information
wtfsck committed Jul 7, 2022
1 parent 456e293 commit c894e45
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ updates:
schedule:
interval: "daily"

- package-ecosystem: "maven"
directory: "/src/java/iced-x86"
schedule:
interval: "daily"

- package-ecosystem: "cargo"
directory: "/src/rust/iced-x86/"
schedule:
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ env:
CI_NODE_MIN_VER: '14.0.0'
RUSTFLAGS: '-D warnings'
MACOSX_DEPLOYMENT_TARGET: '10.12'
JAVA_DISTRIBUTION: 'temurin'
JAVA_VERSION: '8'

jobs:

Expand Down Expand Up @@ -79,6 +81,35 @@ jobs:
#############################################################################
#############################################################################

build-java:
name: Java (${{matrix.os}})
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: ${{env.JAVA_DISTRIBUTION}}
java-version: ${{env.JAVA_VERSION}}

- name: Build and test
shell: bash
run: ./build/build-java --quick-check

- uses: actions/upload-artifact@v3
with:
name: java
path: src/java/iced-x86/target/iced-x86*
if-no-files-found: error

#############################################################################
#############################################################################
#############################################################################

build-rust:
name: Rust (${{matrix.os}})
runs-on: ${{matrix.os}}
Expand Down
63 changes: 63 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ env:
CI_NODE_MIN_VER: '14.0.0'
RUSTFLAGS: '-D warnings'
MACOSX_DEPLOYMENT_TARGET: '10.12'
JAVA_DISTRIBUTION: 'temurin'
JAVA_VERSION: '8'

jobs:

Expand Down Expand Up @@ -51,6 +53,41 @@ jobs:
#############################################################################
#############################################################################

build-java:
name: Java (${{matrix.os}})
runs-on: ${{matrix.os}}
strategy:
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]

steps:
- uses: actions/checkout@v3

- uses: actions/setup-java@v3
with:
distribution: ${{env.JAVA_DISTRIBUTION}}
java-version: ${{env.JAVA_VERSION}}

- name: Build and test
shell: bash
run: |
extra_args=
if [[ "$OSTYPE" != "linux-gnu"* ]]; then
extra_args=--quick-check
fi
./build/build-java $extra_args
- uses: actions/upload-artifact@v3
if: startsWith(matrix.os, 'ubuntu-')
with:
name: java
path: src/java/iced-x86/target/iced-x86*
if-no-files-found: error

#############################################################################
#############################################################################
#############################################################################

build-rust:
name: Rust (${{matrix.os}})
runs-on: ${{matrix.os}}
Expand Down Expand Up @@ -542,6 +579,7 @@ jobs:
name: Upload files
needs:
- build-dotnet
- build-java
- build-rust
- build-rust-js-wasm
- build-rust-python-linux-aarch64
Expand All @@ -558,6 +596,10 @@ jobs:
- uses: actions/setup-dotnet@v2
with:
dotnet-version: ${{env.CI_REQ_DOTNET_SDK_VER}}
- uses: actions/setup-java@v3
with:
distribution: ${{env.JAVA_DISTRIBUTION}}
java-version: ${{env.JAVA_VERSION}}
- uses: actions/setup-python@v3
with:
python-version: '3.x'
Expand Down Expand Up @@ -607,6 +649,7 @@ jobs:
dotnet nuget push --help
cargo publish --help
npm publish --help
mvn --help
- name: Upload to nuget.org
shell: bash
Expand Down Expand Up @@ -637,3 +680,23 @@ jobs:
npm publish /tmp/artifacts/npm/iced-x86-*.tgz
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

- name: Set up Apache Maven Central
uses: actions/setup-java@v3
with:
distribution: ${{env.JAVA_DISTRIBUTION}}
java-version: ${{env.JAVA_VERSION}}
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_CENTRAL_TOKEN
gpg-private-key: ${{ secrets.MAVEN_GPG_PRIVATE_KEY }}
gpg-passphrase: MAVEN_GPG_PASSPHRASE

- name: Publish to Apache Maven Central
run: mvn deploy
#TODO: remove this once this works
continue-on-error: true
env:
MAVEN_USERNAME: wtfsck
MAVEN_CENTRAL_TOKEN: ${{ secrets.MAVEN_CENTRAL_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.MAVEN_GPG_PASSPHRASE }}
48 changes: 48 additions & 0 deletions build/build-java
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/sh
set -e

root_dir=$(dirname "$0")
root_dir=$(cd "$root_dir/.." && pwd)
if [ ! -f "$root_dir/LICENSE.txt" ]; then
echo "Couldn't find the root dir"
exit 1
fi

full_check=y
test_code=y

new_func() {
echo
echo "****************************************************************"
echo "$1"
echo "****************************************************************"
echo
}

build_test() {
new_func "Build, test"

mvn clean package
}

while [ "$#" -gt 0 ]; do
case $1 in
--quick-check) full_check=n ;;
--no-test) test_code=n ;;
*) echo "Unknown arg: $1"; exit 1 ;;
esac
shift
done

echo
echo "=================================================="
echo "Java build"
echo "=================================================="
echo

echo "java version"
java -showversion
echo "maven version"
mvn --version

build_test
12 changes: 11 additions & 1 deletion src/java/iced-x86/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>io.github.icedland.iced</groupId>
<artifactId>iced-x86</artifactId>
<version>1.17.0</version>
<version>1.17.0-SNAPSHOT</version>

<name>iced-x86</name>
<description>x86/x64 disassembler, encoder, assembler written in Java</description>
Expand All @@ -24,6 +24,8 @@
</developer>
</developers>
<scm>
<connection>scm:git:https://github.com/icedland/iced.git</connection>
<developerConnection>scm:git:https://github.com/icedland/iced.git</developerConnection>
<url>https://github.com/icedland/iced</url>
</scm>
<distributionManagement>
Expand Down Expand Up @@ -159,6 +161,14 @@
</goals>
</execution>
</executions>
<configuration>
<!-- https://github.com/actions/setup-java/blob/main/docs/advanced-usage.md#extra-setup-for-pomxml -->
<!-- Prevent gpg from using pinentry programs -->
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
Expand Down

0 comments on commit c894e45

Please sign in to comment.