Skip to content

Commit 2a4ef98

Browse files
committed
add a file for cross platform java build
1 parent c6ec473 commit 2a4ef98

File tree

1 file changed

+65
-0
lines changed

1 file changed

+65
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Cross-platform Build Java
2+
3+
on:
4+
push:
5+
branches: [ "master" ]
6+
pull_request:
7+
branches: [ "master" ]
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
build:
14+
name: Build on ${{ matrix.os }}
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
matrix:
18+
include:
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-gnu
21+
use_xwin: false
22+
- os: windows-latest
23+
target: x86_64-pc-windows-gnu
24+
use_xwin: true
25+
- os: macos-latest
26+
target: aarch64-apple-darwin
27+
use_xwin: false
28+
- os: macos-latest
29+
target: x86_64-apple-darwin
30+
use_xwin: false
31+
32+
steps:
33+
- uses: actions/checkout@v3
34+
35+
- name: Install Rust
36+
uses: actions-rs/toolchain@v1
37+
with:
38+
toolchain: stable
39+
target: ${{ matrix.target }}
40+
override: true
41+
42+
- name: Install cargo-binstall
43+
uses: taiki-e/install-action@cargo-binstall
44+
45+
- name: Install cargo-zigbuild
46+
if: ${{ !matrix.use_xwin }}
47+
run: cargo binstall --no-confirm cargo-zigbuild
48+
49+
- name: Install cargo-xwin
50+
if: ${{ matrix.use_xwin }}
51+
run: cargo binstall --no-confirm cargo-xwin
52+
53+
- name: Build with cargo-zigbuild
54+
if: ${{ !matrix.use_xwin }}
55+
run: cargo zigbuild --target ${{ matrix.target }} --release
56+
57+
- name: Build with cargo-xwin
58+
if: ${{ matrix.use_xwin }}
59+
run: cargo xwin build --target ${{ matrix.target }} --release
60+
61+
- name: Upload artifacts
62+
uses: actions/upload-artifact@v3
63+
with:
64+
name: ${{ matrix.target }}
65+
path: target/${{ matrix.target }}/release/*

0 commit comments

Comments
 (0)