-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactored CI for multiplatform builds (2)
- Loading branch information
Showing
5 changed files
with
633 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
name: Build (linux64) | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
|
||
build_linux64: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
jdk: [21] | ||
libyara_tag: ["v4.5.2-subreption"] | ||
arch: [linux64] | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up JDK | ||
- name: Set up JDK ${{ matrix.jdk }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'oracle' | ||
java-version: ${{ matrix.jdk }} | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Clone libyara (${{ matrix.libyara_tag }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: subreption/yara | ||
path: yara | ||
ref: ${{ matrix.libyara_tag }} | ||
token: ${{ secrets.GH_YARA_REPO_PAT }} | ||
|
||
# Step 3: Clone the YARA repository and build it | ||
- name: Build libyara (${{ matrix.libyara_tag }}) | ||
run: | | ||
cd yara | ||
./bootstrap.sh | ||
./configure --without-crypto --enable-area --disable-shared CFLAGS=-fPIC | ||
make | ||
echo "YARA_HOME=$PWD" >> $GITHUB_ENV | ||
# Step 4: Build YARA-Java | ||
- name: Build YARA-Java | ||
run: mvn -B package --file pom.xml | ||
env: | ||
YARA_HOME: ${{ env.YARA_HOME }} | ||
YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara | ||
YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac | ||
|
||
- name: Upload build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: ${{ matrix.arch }}-artifacts | ||
path: target/*.jar | ||
if-no-files-found: error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: Build (osx64) | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
build_mac: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up JDK 21 on macOS | ||
- name: Set up JDK 21 on macOS | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'oracle' | ||
java-version: 21 | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
brew install \ | ||
autoconf \ | ||
automake \ | ||
bison \ | ||
flex \ | ||
libtool \ | ||
pkg-config \ | ||
jansson \ | ||
libmagic \ | ||
openssl@3 \ | ||
protobuf \ | ||
protobuf-c | ||
- name: Print versions | ||
run: | | ||
bison --version | ||
gcc --version | ||
- name: Clone libyara (${{ matrix.libyara_tag }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: subreption/yara | ||
path: yara | ||
ref: ${{ matrix.libyara_tag }} | ||
token: ${{ secrets.GH_YARA_REPO_PAT }} | ||
|
||
# Step 3: Build libyara on macOS | ||
- name: Build libyara on macOS (${{ matrix.libyara_tag }}) | ||
run: | | ||
cd yara | ||
./bootstrap.sh | ||
./configure --without-crypto --enable-area --disable-shared CFLAGS=-fPIC | ||
make | ||
echo "YARA_HOME=$PWD" >> $GITHUB_ENV | ||
# Step 4: Build YARA-Java on macOS | ||
- name: Build YARA-Java (macOS) | ||
run: mvn -B package --file pom.xml | ||
env: | ||
YARA_HOME: ${{ env.YARA_HOME }} | ||
YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara | ||
YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac | ||
|
||
- name: List built | ||
run: | | ||
bison --version | ||
gcc --version | ||
- name: Upload macOS build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: mac-build-artifacts | ||
path: target/*-osx64.jar | ||
overwrite: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,166 @@ | ||
name: Build (multiplatform) | ||
|
||
on: | ||
workflow_dispatch: | ||
pull_request: | ||
push: | ||
|
||
jobs: | ||
build_linux: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
jdk: [21] | ||
libyara_tag: ["v4.5.2-subreption"] | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up JDK | ||
- name: Set up JDK ${{ matrix.jdk }} | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'oracle' | ||
java-version: ${{ matrix.jdk }} | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Clone libyara (${{ matrix.libyara_tag }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: subreption/yara | ||
path: yara | ||
ref: ${{ matrix.libyara_tag }} | ||
token: ${{ secrets.GH_YARA_REPO_PAT }} | ||
|
||
# Step 3: Build libyara on Linux | ||
- name: Build libyara (${{ matrix.libyara_tag }}) | ||
run: | | ||
cd yara | ||
./bootstrap.sh | ||
./configure --without-crypto --enable-area --disable-shared CFLAGS=-fPIC | ||
make | ||
echo "YARA_HOME=$PWD" >> $GITHUB_ENV | ||
# Step 4: Build YARA-Java on Linux | ||
- name: Build YARA-Java | ||
run: mvn -B package --file pom.xml | ||
env: | ||
YARA_HOME: ${{ env.YARA_HOME }} | ||
YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara | ||
YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac | ||
|
||
- name: Upload linux64 build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: linux64-artifacts | ||
path: target/*.jar | ||
overwrite: true | ||
|
||
build_mac: | ||
runs-on: macos-latest | ||
|
||
steps: | ||
# Step 1: Checkout the repository | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
# Step 2: Set up JDK 21 on macOS | ||
- name: Set up JDK 21 on macOS | ||
uses: actions/setup-java@v4 | ||
with: | ||
distribution: 'oracle' | ||
java-version: 21 | ||
settings-path: ${{ github.workspace }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
brew install \ | ||
autoconf \ | ||
automake \ | ||
bison \ | ||
flex \ | ||
libtool \ | ||
pkg-config \ | ||
jansson \ | ||
libmagic \ | ||
openssl@3 \ | ||
protobuf \ | ||
protobuf-c | ||
- name: Print versions | ||
run: | | ||
bison --version | ||
gcc --version | ||
- name: Clone libyara (${{ matrix.libyara_tag }}) | ||
uses: actions/checkout@v4 | ||
with: | ||
repository: subreption/yara | ||
path: yara | ||
ref: ${{ matrix.libyara_tag }} | ||
token: ${{ secrets.GH_YARA_REPO_PAT }} | ||
|
||
# Step 3: Build libyara on macOS | ||
- name: Build libyara on macOS (${{ matrix.libyara_tag }}) | ||
run: | | ||
cd yara | ||
./bootstrap.sh | ||
./configure --without-crypto --enable-area --disable-shared CFLAGS=-fPIC | ||
make | ||
echo "YARA_HOME=$PWD" >> $GITHUB_ENV | ||
# Step 4: Build YARA-Java on macOS | ||
- name: Build YARA-Java (macOS) | ||
run: mvn -B package --file pom.xml | ||
env: | ||
YARA_HOME: ${{ env.YARA_HOME }} | ||
YARA_BINARY_PATH: ${{ env.YARA_HOME }}/yara | ||
YARAC_BINARY_PATH: ${{ env.YARA_HOME }}/yarac | ||
|
||
- name: Show versions | ||
run: | | ||
bison --version | ||
gcc --version | ||
- name: Upload osx64 build artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: osx64-artifacts | ||
path: target/*-osx64.jar | ||
overwrite: true | ||
|
||
bundle: | ||
needs: [build_linux, build_mac] | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Download build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: linux64-artifacts | ||
path: build/linux64 | ||
|
||
- name: Download macOS build artifacts | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: osx64-artifacts | ||
path: build/osx64 | ||
|
||
- name: List current working directory | ||
run: ls -lhRt | ||
|
||
# Step to bundle Linux and macOS JARs | ||
- name: Bundle multiplatform JARs | ||
run: | | ||
mkdir -p bundled-jars | ||
cp build/linux64/*.jar bundled-jars/ | ||
cp build/osx64/*.jar bundled-jars/ | ||
- name: Upload bundled JARs | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: bundled-jars | ||
path: bundled-jars |
Oops, something went wrong.