Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add native-linux-riscv64 package #111

Merged
merged 10 commits into from
Oct 25, 2023
193 changes: 173 additions & 20 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
java-version: 8
architecture: x64
- name: Build with Maven
run: mvn -B -ntp clean package --file pom.xml
run: mvn -B --show-version -ntp clean package --file pom.xml
- name: Upload the build
uses: actions/upload-artifact@v3
with:
Expand All @@ -44,7 +44,7 @@ jobs:
java-version: 11
architecture: x64
- name: Build with Maven
run: mvn -B -ntp clean package --file pom.xml
run: mvn -B --show-version -ntp --file pom.xml clean package

MacOS-x86_64-Build-JDK17:
runs-on: macos-latest
Expand All @@ -57,7 +57,7 @@ jobs:
java-version: 17
architecture: x64
- name: Build with Maven
run: mvn -B -ntp clean package --file pom.xml
run: mvn -B --show-version -ntp --file pom.xml clean package

Linux-x86_64-Build-JDK8:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -98,7 +98,7 @@ jobs:
restore-keys: |
${{ runner.os }}-pr-${{ env.cache-name }}-
${{ runner.os }}-pr-
- uses: uraimo/run-on-arch-action@v2.3.0
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
Expand All @@ -125,7 +125,7 @@ jobs:
run: |
export JAVA_HOME="/jdk"
chmod +x ./mvnw
./mvnw -B -ntp clean package
./mvnw -B --show-version -ntp clean package

- name: Upload the build
uses: actions/upload-artifact@v3
Expand All @@ -145,7 +145,7 @@ jobs:
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.3.0
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
Expand All @@ -172,7 +172,7 @@ jobs:
run: |
export JAVA_HOME="/jdk"
chmod +x ./mvnw
./mvnw -B -ntp clean package
./mvnw -B --show-version -ntp clean package

Linux-Aarch64-Build-JDK17:
runs-on: ubuntu-latest
Expand All @@ -186,7 +186,7 @@ jobs:
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.3.0
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
Expand Down Expand Up @@ -214,7 +214,7 @@ jobs:
export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork"
export JAVA_HOME="/jdk"
chmod +x ./mvnw
./mvnw -B -ntp clean package
./mvnw -B --show-version -ntp clean package

Linux-ArmV7-Build-JDK8:
runs-on: ubuntu-latest
Expand All @@ -228,7 +228,7 @@ jobs:
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.3.0
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
Expand All @@ -255,7 +255,7 @@ jobs:
run: |
export JAVA_HOME="/jdk"
chmod +x ./mvnw
./mvnw -B -ntp clean package
./mvnw -B --show-version -ntp clean package

- name: Upload the build
uses: actions/upload-artifact@v3
Expand All @@ -275,7 +275,7 @@ jobs:
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.3.0
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
Expand All @@ -302,7 +302,7 @@ jobs:
run: |
export JAVA_HOME="/jdk"
chmod +x ./mvnw
./mvnw -B -ntp clean package
./mvnw -B --show-version -ntp clean package

Linux-s390x-Build-JDK8:
runs-on: ubuntu-latest
Expand All @@ -316,7 +316,7 @@ jobs:
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.3.0
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
Expand All @@ -339,7 +339,7 @@ jobs:

run: |
chmod +x ./mvnw
./mvnw -B -ntp clean package
./mvnw -B --show-version -ntp clean package

- name: Upload the build
uses: actions/upload-artifact@v3
Expand All @@ -359,7 +359,7 @@ jobs:
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.3.0
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
Expand All @@ -382,7 +382,160 @@ jobs:

run: |
chmod +x ./mvnw
./mvnw -B -ntp clean package
./mvnw -B --show-version -ntp clean package

Linux-riscv64-Build-JDK11:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
env:
cache-name: cache-m2-repository-${{ runner.os }}-jdk11-riscv64
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-

- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
arch: riscv64
distro: ubuntu20.04

# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}

# Mount the .m2/repository
dockerRunArgs: |
--platform linux/riscv64
--volume "/home/runner/.m2/repository/:/root/.m2/repository"
# Install dependencies
install: |
apt-get update
apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-11-jdk

run: |
export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork"
chmod +x ./mvnw
./mvnw -B --show-version -ntp clean package

- uses: uraimo/run-on-arch-action@v2.4.0
name: Test on JDK 8
id: test
with:
arch: aarch64
distro: ubuntu20.04

# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}

# Mount the .m2/repository
dockerRunArgs: |
--platform linux/aarch64
--volume "/home/runner/.m2/repository/:/root/.m2/repository"

# Install dependencies
install: |
apt-get update
apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-8-jdk

run: |
export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork"
chmod +x ./mvnw
# Build native-linux-aarch64 only
./mvnw -B --show-version -ntp clean package -pl :native-linux-aarch64 -DskipTests
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When we do this, it will compile native-linux-aarch64 and run its tests not native-linux-riscv64.

I guess this is not easily achievable, let me think of something. I will do a direct push.

# Test with JDK 8
./mvnw -B --show-version -ntp surefire:test

# RISC-V doesn't upload the JDK 8 build because JDK 8 doesn't exist on RISC-V. Instead, we upload
# the JDK 11 build. It should work on JDK 8 as well, as we are testing it on all other platforms.
- name: Upload the build
uses: actions/upload-artifact@v3
with:
name: Linux-riscv64-Build-JDK11
path: /home/runner/work/Brotli4j/

Linux-riscv64-Build-JDK17:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
env:
cache-name: cache-m2-repository-${{ runner.os }}-jdk17-riscv64
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
arch: riscv64
distro: ubuntu20.04

# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}

# Mount the .m2/repository
dockerRunArgs: |
--platform linux/riscv64
--volume "/home/runner/.m2/repository/:/root/.m2/repository"
# Install dependencies
install: |
apt-get update
apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential openjdk-17-jdk

run: |
export MAVEN_OPTS="-Djdk.lang.Process.launchMechanism=vfork"
chmod +x ./mvnw
./mvnw -B --show-version -ntp clean package

Linux-riscv64-Build-JDK21:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/cache@v3
env:
cache-name: cache-m2-repository-${{ runner.os }}-jdk21-riscv64
with:
path: ~/.m2/repository
key: ${{ runner.os }}-pr-${{ env.cache-name }}-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-pr-${{ matrix.arch }}-pr-${{ env.cache-name }}-pr-
- uses: uraimo/run-on-arch-action@v2.4.0
name: Run commands
id: runcmd
with:
arch: riscv64
distro: ubuntu22.04
luhenry marked this conversation as resolved.
Show resolved Hide resolved

# Not required, but speeds up builds by storing container images in
# a GitHub package registry.
githubToken: ${{ github.token }}

# Mount the .m2/repository
dockerRunArgs: |
--platform linux/riscv64
--volume "/home/runner/.m2/repository/:/root/.m2/repository"

# Install dependencies
install: |
apt-get update
apt-get install -q -y curl gnupg2 autoconf automake libtool make tar git cmake build-essential

curl -sL https://github.com/shyiko/jabba/raw/master/install.sh | bash && . ~/.jabba/jabba.sh
jabba install 21-custom=tgz+https://api.adoptium.net/v3/binary/latest/21/ea/linux/riscv64/jdk/hotspot/normal/eclipse?project=jdk -o /jdk

run: |
export JAVA_HOME="/jdk"
luhenry marked this conversation as resolved.
Show resolved Hide resolved
chmod +x ./mvnw
./mvnw -B --show-version -ntp clean package

Windows-x86_64-Build-JDK8:
runs-on: windows-latest
Expand All @@ -397,7 +550,7 @@ jobs:
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.12.0
- name: Build with Maven
run: mvn -B -ntp clean package --file pom.xml
run: mvn -B --show-version -ntp clean package --file pom.xml
- name: Upload the build
uses: actions/upload-artifact@v3
with:
Expand All @@ -418,7 +571,7 @@ jobs:
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.12.0
- name: Build with Maven
run: mvn -B -ntp clean package --file pom.xml
run: mvn -B --show-version -ntp --file pom.xml clean package

Windows-x86_64-Build-JDK17:
runs-on: windows-latest
Expand All @@ -433,4 +586,4 @@ jobs:
- name: Enable Developer Command Prompt
uses: ilammy/msvc-dev-cmd@v1.12.0
- name: Build with Maven
run: mvn -B -ntp clean package --file pom.xml
run: mvn -B --show-version -ntp --file pom.xml clean package
5 changes: 5 additions & 0 deletions all/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@
<artifactId>native-linux-s390x</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.aayushatharva.brotli4j</groupId>
<artifactId>native-linux-riscv64</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.aayushatharva.brotli4j</groupId>
<artifactId>native-osx-aarch64</artifactId>
Expand Down
17 changes: 17 additions & 0 deletions brotli4j/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,23 @@
</dependencies>
</profile>

<profile>
<id>linux-riscv64</id>
<activation>
<os>
<family>Linux</family>
<arch>riscv64</arch>
</os>
</activation>
<dependencies>
<dependency>
<groupId>com.aayushatharva.brotli4j</groupId>
<artifactId>native-linux-riscv64</artifactId>
<version>${project.parent.version}</version>
</dependency>
</dependencies>
</profile>

<profile>
<id>windows-x86_64</id>
<activation>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ private static String getPlatform() {
return "linux-armv7";
} else if ("s390x".equalsIgnoreCase(archName)) {
return "linux-s390x";
} else if ("riscv64".equalsIgnoreCase(archName)) {
return "linux-riscv64";
}
} else if (osName.startsWith("Windows")) {
if ("amd64".equalsIgnoreCase(archName)) {
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose11.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:

build:
<<: *common
command: /bin/bash -cl "mvn -B -ntp clean package --file pom.xml"
command: /bin/bash -cl "mvn -B --show-version -ntp --file pom.xml clean package"

shell:
<<: *common
Expand Down
2 changes: 1 addition & 1 deletion docker/docker-compose17.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ services:

build:
<<: *common
command: /bin/bash -cl "mvn -B -ntp clean package --file pom.xml"
command: /bin/bash -cl "mvn -B --show-version -ntp --file pom.xml clean package"

shell:
<<: *common
Expand Down
Loading