-
Notifications
You must be signed in to change notification settings - Fork 0
118 lines (102 loc) · 3.42 KB
/
build.yml
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
# name: Cross Build
#
# on:
# workflow_dispatch: # Enables manual triggering
#
# jobs:
# build:
# runs-on: ubuntu-latest # Uses an Ubuntu runner
#
# steps:
# # Checkout the code
# - name: Checkout repository
# uses: actions/checkout@v3
#
# # Install Rust (if not already available on the runner)
# - name: Install Rust
# uses: actions-rs/toolchain@v1
# with:
# profile: minimal
# override: true # Set as the default Rust version
# toolchain: stable
#
# # Install `cross` using cargo
# - name: Install cross
# run: cargo install cross --git https://github.com/cross-rs/cross
#
# # Build for macOS
# - name: Build for macOS (x86_64-apple-darwin)
# run: cross build --release --target x86_64-apple-darwin
#
# # Build for Windows
# - name: Build for Windows (x86_64-pc-windows-gnu)
# run: cross build --release --target x86_64-pc-windows-gnu
#
# # Build for Linux
# - name: Build for Linux (x86_64-unknown-linux-gnu)
# run: cross build --release --target x86_64-unknown-linux-gnu
name: Cross Build
on:
workflow_dispatch: # Enables manual triggering
jobs:
build-windows:
runs-on: ubuntu-latest # Ubuntu runner for Linux and Windows builds
steps:
# Checkout the code
- name: Checkout repository
uses: actions/checkout@v3
# Install Rust
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true # Set as the default Rust version
toolchain: stable
# Install `cross`
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
# Build for Windows
- name: Build for Windows (x86_64-pc-windows-gnu)
run: cross build --release --target x86_64-pc-windows-gnu
# Upload Windows binary as artifact
- name: Upload Windows binary
uses: actions/upload-artifact@v3
with:
name: windows-binary
path: target/x86_64-pc-windows-gnu/release/*
build-macos:
runs-on: macos-latest # macOS runner for macOS builds
steps:
# Checkout the code
- name: Checkout repository
uses: actions/checkout@v3
# Install Rust
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
override: true # Set as the default Rust version
toolchain: stable
# Install required targets for macOS
- name: Install macOS targets
run: |
rustup target add x86_64-apple-darwin
rustup target add aarch64-apple-darwin
# Build for macOS (x86_64)
- name: Build for macOS (x86_64-apple-darwin)
run: cargo build --release --target x86_64-apple-darwin
# Upload macOS (x86_64) binary as artifact
- name: Upload macOS (x86_64) binary
uses: actions/upload-artifact@v3
with:
name: macos-x86_64-binary
path: target/x86_64-apple-darwin/release/*
# Build for macOS (aarch64)
- name: Build for macOS (aarch64-apple-darwin)
run: cargo build --release --target aarch64-apple-darwin
# Upload macOS (aarch64) binary as artifact
- name: Upload macOS (aarch64) binary
uses: actions/upload-artifact@v3
with:
name: macos-aarch64-binary
path: target/aarch64-apple-darwin/release/*