-
Notifications
You must be signed in to change notification settings - Fork 0
128 lines (126 loc) · 3.81 KB
/
build.yml
File metadata and controls
128 lines (126 loc) · 3.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: Build
on:
push:
paths-ignore:
- 'README.md'
branches: [ "main" ]
pull_request:
paths-ignore:
- 'README.md'
branches: [ "main" ]
workflow_dispatch:
jobs:
build:
name: Build (${{ matrix.os }})
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
fail-fast: false
matrix:
include:
- os: windows-latest
cli: packobf_cli.exe
gui: packobf_gui.exe
java-lib: rust.dll
- os: macos-latest
cli: packobf_cli
gui: packobf_gui
java-lib: librust.dylib
- os: ubuntu-latest
cli: packobf_cli
gui: packobf_gui
java-lib: librust.so
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
- name: Rust Cache
uses: Swatinem/rust-cache@v2
- uses: taiki-e/install-action@v2
with:
tool: cargo-about
- name: Build
run: cargo build --release
- name: Prepare License
run: cargo about generate about.hbs | perl -0777 -pe 's/\s+$/\n/' | tee -a LICENSE.md > /dev/null
- name: Prepare CLI Executable
# Always make sure files that are published contain the license files
run: |
rm -rf dist && mkdir -p dist
cp target/release/${{ matrix.cli }} dist/
cp LICENSE.md dist/
- name: Upload CLI Executable
uses: actions/upload-artifact@v4
with:
name: cli-${{ matrix.os }}
path: dist/*
- name: Prepare GUI Executable
# Always make sure files that are published contain the license files
run: |
rm -rf dist && mkdir -p dist
cp target/release/${{ matrix.gui }} dist/
cp LICENSE.md dist/
- name: Upload GUI Executable
uses: actions/upload-artifact@v4
with:
name: gui-${{ matrix.os }}
path: dist/*
- name: Prepare Java Native Library
run: |
rm -rf dist && mkdir -p dist
cp target/release/${{ matrix.java-lib }} dist/
cp LICENSE.md dist/
- name: Upload Java Native Library
uses: actions/upload-artifact@v4
with:
name: java-lib-${{ matrix.os }}
path: dist/*
buildJava:
name: Build Java Library
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Setup Java
uses: graalvm/setup-graalvm@v1
with:
java-version: '21'
distribution: 'graalvm'
cache: 'gradle'
- name: Download Linux native
uses: actions/download-artifact@v4
with:
name: java-lib-ubuntu-latest
path: artifacts/native/linux
- name: Download MacOS native
uses: actions/download-artifact@v4
with:
name: java-lib-macos-latest
path: artifacts/native/macos
- name: Download Windows native
uses: actions/download-artifact@v4
with:
name: java-lib-windows-latest
path: artifacts/native/windows
- name: Copy native libraries
run: |
mkdir -p java/build/external-natives
cp artifacts/native/linux/librust.so java/build/external-natives/
cp artifacts/native/macos/librust.dylib java/build/external-natives/
cp artifacts/native/windows/rust.dll java/build/external-natives/
cp artifacts/native/linux/LICENSE.md java/build/external-natives/
- name: Build
run: |
cd java
./gradlew build
- name: Upload jar
uses: actions/upload-artifact@v4
with:
name: java-package
path: java/build/libs/*.jar