Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 70 additions & 2 deletions .github/workflows/build_multi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,69 @@ jobs:
path: target/*-osx64.jar
overwrite: true

build_windows64:
runs-on: windows-latest

strategy:
matrix:
jdk: [21]
libyara_tag: ["v4.5.2-subreption"]
arch: [windows64]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{ matrix.jdk }}
settings-path: ${{ github.workspace }}

- name: Set up MSVC developer environment (x64)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Set up NuGet
uses: NuGet/setup-nuget@v2

- 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 }}

# packages.config is not auto-restored by MSBuild.
- name: Restore libyara NuGet packages
run: nuget restore yara/windows/vs2017/yara.sln

# libyara only (JNI embedded; no yara/yarac).
- name: Build libyara (MSVC Release|x64)
run: |
msbuild "yara/windows/vs2017/libyara/libyara.vcxproj" /p:Configuration=Release /p:Platform=x64 /v:minimal
if ($LASTEXITCODE -ne 0) { throw "msbuild failed for libyara" }

- name: Export YARA_HOME
run: echo "YARA_HOME=${{ github.workspace }}\yara" >> $env:GITHUB_ENV

- name: Build YARA-Java (Windows)
run: mvn -B package --file pom.xml
env:
YARA_HOME: ${{ env.YARA_HOME }}

- name: Upload windows64 build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-artifacts
path: target/*-windows64.jar
overwrite: true

bundle:
needs: [build_linux, build_mac]
needs: [build_linux, build_mac, build_windows64]
runs-on: ubuntu-latest

steps:
Expand All @@ -149,15 +210,22 @@ jobs:
name: osx64-artifacts
path: build/osx64

- name: Download windows64 build artifacts
uses: actions/download-artifact@v4
with:
name: windows64-artifacts
path: build/windows64

- name: List current working directory
run: ls -lhRt

# Step to bundle Linux and macOS JARs
# Step to bundle Linux, macOS, and Windows JARs
- name: Bundle multiplatform JARs
run: |
mkdir -p bundled-jars
cp build/linux64/*.jar bundled-jars/
cp build/osx64/*.jar bundled-jars/
cp build/windows64/*.jar bundled-jars/

- name: Upload bundled JARs
uses: actions/upload-artifact@v4
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/build_windows64.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Build (windows64)

on:
workflow_dispatch:
pull_request:
push:

jobs:

build_windows64:
runs-on: windows-latest

strategy:
matrix:
jdk: [21]
libyara_tag: ["v4.5.2-subreption"]
arch: [windows64]

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 }}

# Step 3: MSVC dev environment (exported to all later steps).
- name: Set up MSVC developer environment (x64)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Set up NuGet
uses: NuGet/setup-nuget@v2

# Step 4: Clone libyara.
- 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 5: Restore NuGet deps (packages.config is not auto-restored).
- name: Restore libyara NuGet packages
run: nuget restore yara/windows/vs2017/yara.sln

# Step 6: Build libyara only (JNI embedded; no yara/yarac).
- name: Build libyara (MSVC Release|x64)
run: |
msbuild "yara/windows/vs2017/libyara/libyara.vcxproj" /p:Configuration=Release /p:Platform=x64 /v:minimal
if ($LASTEXITCODE -ne 0) { throw "msbuild failed for libyara" }

- name: Export YARA_HOME
run: echo "YARA_HOME=${{ github.workspace }}\yara" >> $env:GITHUB_ENV

# Step 7: Build + test yara-java (windows-amd64 profile auto-activates).
- name: Build and test yara-java (mvn package)
run: mvn -B package --file pom.xml

- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-artifacts
path: target/*.jar
if-no-files-found: error
88 changes: 86 additions & 2 deletions .github/workflows/ci_nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,85 @@ jobs:
outputs:
mac-artifact: ${{ steps.build.outputs.maven-artifact }}

build_windows64:
runs-on: windows-latest

strategy:
matrix:
jdk: [21]
libyara_tag: [ "v4.5.2-subreption" ]
arch: [windows64]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{ matrix.jdk }}
settings-path: ${{ github.workspace }}

- name: Set up MSVC developer environment (x64)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Set up NuGet
uses: NuGet/setup-nuget@v2

- 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 }}

# packages.config is not auto-restored by MSBuild.
- name: Restore libyara NuGet packages
run: nuget restore yara/windows/vs2017/yara.sln

# libyara only (JNI embedded; no yara/yarac).
- name: Build libyara (MSVC Release|x64)
run: |
msbuild "yara/windows/vs2017/libyara/libyara.vcxproj" /p:Configuration=Release /p:Platform=x64 /v:minimal
if ($LASTEXITCODE -ne 0) { throw "msbuild failed for libyara" }

- name: Export YARA_HOME
run: echo "YARA_HOME=${{ github.workspace }}\yara" >> $env:GITHUB_ENV

- name: Build YARA-Java (Windows)
run: mvn -B package --file pom.xml
env:
YARA_HOME: ${{ env.YARA_HOME }}

- name: Upload windows64 build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-artifacts
path: target/*-windows64.jar
overwrite: true

- name: Set up Maven settings.xml for GitHub Packages
shell: bash
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>github</id><username>${{ github.actor }}</username><password>${{ secrets.GITHUB_TOKEN }}</password></server></servers></settings>" > ~/.m2/settings.xml

- name: Deploy Maven artifacts
shell: bash
run: mvn deploy -s ~/.m2/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} || echo "Deployment failed but continuing..."
env:
YARA_HOME: ${{ env.YARA_HOME }}

- name: Cleanup
shell: bash
run: rm -rf ~/.m2/settings.xml

bundle:
needs: [build_linux, build_mac]
needs: [build_linux, build_mac, build_windows64]
runs-on: ubuntu-latest

steps:
Expand All @@ -190,15 +267,22 @@ jobs:
name: osx64-artifacts
path: build/osx64

- name: Download windows64 build artifacts
uses: actions/download-artifact@v4
with:
name: windows64-artifacts
path: build/windows64

- name: List current working directory
run: ls -lhRt

# Step to bundle Linux and macOS JARs
# Step to bundle Linux, macOS, and Windows JARs
- name: Bundle multiplatform JARs
run: |
mkdir -p bundled-jars
cp build/linux64/*.jar bundled-jars/
cp build/osx64/*.jar bundled-jars/
cp build/windows64/*.jar bundled-jars/

- name: Upload bundled JARs
uses: actions/upload-artifact@v4
Expand Down
88 changes: 86 additions & 2 deletions .github/workflows/ci_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,85 @@ jobs:
outputs:
mac-artifact: ${{ steps.build.outputs.maven-artifact }}

build_windows64:
runs-on: windows-latest

strategy:
matrix:
jdk: [21]
libyara_tag: [ "v4.5.2-subreption" ]
arch: [windows64]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up JDK ${{ matrix.jdk }}
uses: actions/setup-java@v4
with:
distribution: 'oracle'
java-version: ${{ matrix.jdk }}
settings-path: ${{ github.workspace }}

- name: Set up MSVC developer environment (x64)
uses: ilammy/msvc-dev-cmd@v1
with:
arch: x64

- name: Set up NuGet
uses: NuGet/setup-nuget@v2

- 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 }}

# packages.config is not auto-restored by MSBuild.
- name: Restore libyara NuGet packages
run: nuget restore yara/windows/vs2017/yara.sln

# libyara only (JNI embedded; no yara/yarac).
- name: Build libyara (MSVC Release|x64)
run: |
msbuild "yara/windows/vs2017/libyara/libyara.vcxproj" /p:Configuration=Release /p:Platform=x64 /v:minimal
if ($LASTEXITCODE -ne 0) { throw "msbuild failed for libyara" }

- name: Export YARA_HOME
run: echo "YARA_HOME=${{ github.workspace }}\yara" >> $env:GITHUB_ENV

- name: Build YARA-Java (Windows)
run: mvn -B package --file pom.xml
env:
YARA_HOME: ${{ env.YARA_HOME }}

- name: Upload windows64 build artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.arch }}-artifacts
path: target/*-windows64.jar
overwrite: true

- name: Set up Maven settings.xml for GitHub Packages
shell: bash
run: |
mkdir -p ~/.m2
echo "<settings><servers><server><id>github</id><username>${{ github.actor }}</username><password>${{ secrets.GITHUB_TOKEN }}</password></server></servers></settings>" > ~/.m2/settings.xml

- name: Deploy Maven artifacts
shell: bash
run: mvn deploy -s ~/.m2/settings.xml -DaltDeploymentRepository=github::default::https://maven.pkg.github.com/${{ github.repository }} || echo "Deployment failed but continuing..."
env:
YARA_HOME: ${{ env.YARA_HOME }}

- name: Cleanup
shell: bash
run: rm -rf ~/.m2/settings.xml

bundle:
needs: [build_linux64, build_osx64]
needs: [build_linux64, build_osx64, build_windows64]
runs-on: ubuntu-latest

steps:
Expand All @@ -196,12 +273,19 @@ jobs:
name: osx64-artifacts
path: build/osx64

# Step to bundle Linux and macOS JARs
- name: Download windows64 build artifacts
uses: actions/download-artifact@v4
with:
name: windows64-artifacts
path: build/windows64

# Step to bundle Linux, macOS, and Windows JARs
- name: Bundle multiplatform JARs
run: |
mkdir -p bundled-jars
cp build/linux64/*.jar bundled-jars/
cp build/osx64/*.jar bundled-jars/
cp build/windows64/*.jar bundled-jars/

- name: Upload bundled JARs
uses: actions/upload-artifact@v4
Expand Down
Loading