Skip to content

Commit

Permalink
support build vmtool linux aarch64 #2226 (#2478)
Browse files Browse the repository at this point in the history
  • Loading branch information
hengyunabc authored Apr 19, 2023
1 parent 8024aca commit 9a95565
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 21 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/auto-prettier.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}

Expand Down
87 changes: 70 additions & 17 deletions .github/workflows/build-vmtool.yaml
Original file line number Diff line number Diff line change
@@ -1,55 +1,108 @@
name: build vmtool

on: [push]
on:
workflow_dispatch:

jobs:
linux:
runs-on: ubuntu-18.04

build-linux-x64:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Build with Maven
run: ./mvnw package
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: lib
path: arthas-vmtool/target/lib*

mac:
path: arthas-vmtool/target/libArthasJniLibrary-x64.so
build-mac:
runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Build with Maven
run: ./mvnw package
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: lib
path: arthas-vmtool/target/lib*

windows:
path: arthas-vmtool/target/libArthas*
build-windows:
runs-on: windows-2019

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
- name: Build with Maven
run: ./mvnw package
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v3
with:
name: lib
path: arthas-vmtool/target/*.dll
path: arthas-vmtool/target/*.dll

build-linux-aarch64:
# The host should always be Linux
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
fetch-depth: 0
- uses: uraimo/run-on-arch-action@v2
name: Run commands
id: runcmd
with:
arch: aarch64
distro: ubuntu20.04

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

run: |
apt update && apt install openjdk-8-jdk g++ -y
./mvnw package -pl common,arthas-vmtool
cp arthas-vmtool/target/libArthas* lib/
- uses: actions/upload-artifact@v3
with:
name: lib
path: arthas-vmtool/target/libArthas*

commit_vmtool_files:
runs-on: ubuntu-20.04
needs: [build-linux-x64, build-linux-aarch64, build-mac, build-windows]
steps:
- name: Checkout Upstream Repo
uses: actions/checkout@v3

- uses: actions/download-artifact@v3
with:
name: lib
path: tmplib
- name: Display structure of downloaded files
run: ls -R
working-directory: tmplib
- name: Commit files
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
mv tmplib/* lib/
git add lib/
git commit -m "update arthas vmtool lib"
- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ github.ref }}
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
matrix:
java: [8, 11]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Setup java
uses: actions/setup-java@v3
with:
Expand All @@ -26,7 +26,7 @@ jobs:
# https://static.azul.com/zulu/bin/
java: [12, 13, 14 , 17, 18, 19]
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 1.8
uses: actions/setup-java@v3
with:
Expand Down
16 changes: 16 additions & 0 deletions arthas-vmtool/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,20 @@
<lib_name>libArthasJniLibrary-x64.so</lib_name>
</properties>
</profile>
<profile>
<id>linux-aarch64</id>
<activation>
<os>
<name>linux</name>
<arch>aarch64</arch>
</os>
</activation>
<properties>
<os_name>linux</os_name>
<os_arch_option>-march=armv8-a</os_arch_option>
<lib_name>libArthasJniLibrary-aarch64.so</lib_name>
</properties>
</profile>

<!-- windows -->
<profile>
Expand Down Expand Up @@ -196,6 +210,8 @@
<compilerStartOption>-fpic</compilerStartOption>
<compilerStartOption>-shared</compilerStartOption>
<compilerStartOption>-o</compilerStartOption>
<compilerStartOption>-I${JAVA_HOME}/include</compilerStartOption>
<compilerStartOption>-I${JAVA_HOME}/include/${os_name}</compilerStartOption>
</compilerStartOptions>

<linkerOutputDirectory>target</linkerOutputDirectory>
Expand Down

0 comments on commit 9a95565

Please sign in to comment.