-
Notifications
You must be signed in to change notification settings - Fork 1
130 lines (110 loc) · 4.05 KB
/
build-macos-intel.yml
File metadata and controls
130 lines (110 loc) · 4.05 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
129
130
name: macOS Intel CI
on:
push:
branches: [ main, develop, feature/* ]
pull_request:
branches: [ main, develop ]
jobs:
test-macos-intel:
name: Test on macOS Intel
runs-on: macos-latest
# Note: This runs on Intel Macs. Apple Silicon builds are handled separately
# to preserve existing macOS silicon-only workflow per project history
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
components: rustfmt, clippy
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: macos-intel-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
macos-intel-cargo-
macos-cargo-
- name: Check formatting
run: cargo fmt --all -- --check
- name: Run clippy
run: cargo clippy --no-default-features -- -D warnings
- name: Install system dependencies
run: |
brew install openssl
export OPENSSL_ROOT_DIR=/usr/local/opt/openssl
export OPENSSL_LIB_DIR=/usr/local/opt/openssl/lib
export OPENSSL_INCLUDE_DIR=/usr/local/opt/openssl/include
- name: Build (default features)
run: cargo build --no-default-features
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
OPENSSL_LIB_DIR: /usr/local/opt/openssl/lib
OPENSSL_INCLUDE_DIR: /usr/local/opt/openssl/include
- name: Build (with CLI UI)
run: cargo build --features cli-ui
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
OPENSSL_LIB_DIR: /usr/local/opt/openssl/lib
OPENSSL_INCLUDE_DIR: /usr/local/opt/openssl/include
- name: Run tests (default features)
run: cargo test --no-default-features --lib
continue-on-error: true
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
OPENSSL_LIB_DIR: /usr/local/opt/openssl/lib
OPENSSL_INCLUDE_DIR: /usr/local/opt/openssl/include
- name: Run tests (with CLI UI)
run: cargo test --features cli-ui --lib
continue-on-error: true
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
OPENSSL_LIB_DIR: /usr/local/opt/openssl/lib
OPENSSL_INCLUDE_DIR: /usr/local/opt/openssl/include
- name: Build release binary
run: cargo build --release --no-default-features
env:
OPENSSL_ROOT_DIR: /usr/local/opt/openssl
OPENSSL_LIB_DIR: /usr/local/opt/openssl/lib
OPENSSL_INCLUDE_DIR: /usr/local/opt/openssl/include
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: codl3-zksync-macos-intel
path: target/release/codl3-zksync
if-no-files-found: warn
macos-cross-compile:
name: Cross-compile for macOS (from Linux)
runs-on: ubuntu-latest
if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop')
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: actions-rust-lang/setup-rust-toolchain@v1
with:
toolchain: stable
targets: x86_64-apple-darwin
- name: Install osxcross
run: |
git clone https://github.com/tpoechtrager/osxcross
cd osxcross
wget -nc https://s3.dockerproject.org/darwin/v2/MacOSX10.11.sdk.tar.xz
mv MacOSX10.11.sdk.tar.xz tarballs/
UNATTENDED=yes OSX_VERSION_MIN=10.7 ./build.sh
export PATH="$PWD/target/bin:$PATH"
echo "PATH=$PWD/target/bin:$PATH" >> $GITHUB_ENV
- name: Build for macOS Intel
run: |
export PATH="/home/runner/work/osxcross/target/bin:$PATH"
cargo build --release --no-default-features --target x86_64-apple-darwin
- name: Upload macOS cross-compiled binary
uses: actions/upload-artifact@v4
with:
name: codl3-zksync-macos-intel-cross
path: target/x86_64-apple-darwin/release/codl3-zksync
if-no-files-found: warn