-
Notifications
You must be signed in to change notification settings - Fork 12
130 lines (111 loc) · 5.12 KB
/
build-nym-vpn-core-mac.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
119
120
121
122
123
124
125
126
127
128
129
130
name: build-nym-vpn-core-mac
on:
workflow_dispatch:
pull_request:
paths:
- ".github/workflows/build-nym-vpn-core-mac.yml"
workflow_call:
env:
CARGO_TERM_COLOR: always
CARGO_TARGET: release
WG_GO_LIB_PATH: ${{ github.workspace }}/build/lib/universal-apple-darwin
WG_GO_LIB_NAME: wireguard-go_apple_universal
UPLOAD_DIR_MAC: mac_artifacts
jobs:
build-wireguard-go-mac:
uses: ./.github/workflows/build-wireguard-go-mac.yml
build-mac:
needs: build-wireguard-go-mac
runs-on: macos-14
outputs:
UPLOAD_DIR_MAC: ${{ env.UPLOAD_DIR_MAC }}
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: brndnmtthws/rust-action-rustup@v1
with:
toolchain: stable
components: rustfmt, clippy
targets: x86_64-apple-darwin aarch64-apple-darwin
- name: Install Go toochain
uses: actions/setup-go@v5
with:
go-version: "stable"
- name: Install Protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Install cargo-get
run: |
cargo install --locked cargo-get || true
- name: Update nym-vpn-apple to use latest core
run: |
./scripts/update-nym-vpn-apple-to-latest-core.sh
git diff || echo "No changes detected"
git diff > mac-plist-changes.patch
- name: Upload applied changes
uses: actions/upload-artifact@v4
with:
name: mac-plist-changes.patch
path: mac-plist-changes.patch
retention-days: 3
- name: Get workspace version
id: workspace-version
uses: nicolaiunrein/cargo-get@master
with:
subcommand: workspace.package.version --entry nym-vpn-core
- name: Install cargo-edit
run: cargo install --locked cargo-edit || true
- name: Append timestamp if it's a dev version
run: ./scripts/append-timestamp-to-version.sh nym-vpn-core/Cargo.toml ${{ steps.workspace-version.outputs.output }}
- name: Download wireguard-go artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.WG_GO_LIB_NAME }}
path: ${{ env.WG_GO_LIB_PATH }}
- name: Build nym-vpn-core (native)
working-directory: nym-vpn-core
env:
RUSTFLAGS: "-L ${{ env.WG_GO_LIB_PATH }}"
run: |
cargo build -p nym-vpnc -p nym-gateway-probe --${{ env.CARGO_TARGET }}
ls -la target/release/ || true
- name: Build nym-vpn-core (x86_64)
working-directory: nym-vpn-core
env:
RUSTFLAGS: "-L ${{ env.WG_GO_LIB_PATH }}"
run: |
cargo build -p nym-vpnc --${{ env.CARGO_TARGET }} --target x86_64-apple-darwin
ls -la target/x86_64-apple-darwin/release/ || true
- name: Build nym-vpnd with extra flags (native)
working-directory: nym-vpn-core
env:
RUSTFLAGS: "-L ${{ env.WG_GO_LIB_PATH }} -C link-arg=-all_load -C link-arg=-ObjC -C link-arg=-sectcreate -C link-arg=__TEXT -C link-arg=__info_plist -C link-arg=${{ github.workspace }}/nym-vpn-apple/Daemon/Info.plist -C link-arg=-sectcreate -C link-arg=__TEXT -C link-arg=__launchd_plist -C link-arg=${{ github.workspace }}/nym-vpn-apple/Daemon/Launchd.plist"
run: |
cargo build -p nym-vpnd --${{ env.CARGO_TARGET }}
ls -la target/release/ || true
- name: Build nym-vpnd with extra flags (x86_64)
working-directory: nym-vpn-core
env:
RUSTFLAGS: "-L ${{ env.WG_GO_LIB_PATH }} -C link-arg=-all_load -C link-arg=-ObjC -C link-arg=-sectcreate -C link-arg=__TEXT -C link-arg=__info_plist -C link-arg=${{ github.workspace }}/nym-vpn-apple/Daemon/Info.plist -C link-arg=-sectcreate -C link-arg=__TEXT -C link-arg=__launchd_plist -C link-arg=${{ github.workspace }}/nym-vpn-apple/Daemon/Launchd.plist"
run: |
cargo build -p nym-vpnd --${{ env.CARGO_TARGET }} --target x86_64-apple-darwin
ls -la target/x86_64-apple-darwin/release/ || true
- name: Create universal binaries and prepare for upload
env:
SRC_NATIVE_BINARY: nym-vpn-core/target/${{ env.CARGO_TARGET }}/
SRC_X86_64_BINARY: nym-vpn-core/target/x86_64-apple-darwin/${{ env.CARGO_TARGET }}/
run: |
mkdir ${{ env.UPLOAD_DIR_MAC }}
lipo -create -output ${{ env.UPLOAD_DIR_MAC }}/nym-vpnc ${{ env.SRC_NATIVE_BINARY }}/nym-vpnc ${{ env.SRC_X86_64_BINARY }}/nym-vpnc
lipo -create -output ${{ env.UPLOAD_DIR_MAC }}/nym-vpnd ${{ env.SRC_NATIVE_BINARY }}/nym-vpnd ${{ env.SRC_X86_64_BINARY }}/nym-vpnd
#lipo -create -output ${{ env.UPLOAD_DIR_MAC }}/nym-gateway-probe ${{ env.SRC_NATIVE_BINARY }}/nym-gateway-probe ${{ env.SRC_X86_64_BINARY }}/nym-gateway-probe
# Native only for nym-gateway-probe
cp ${{ env.SRC_NATIVE_BINARY }}/nym-gateway-probe ${{ env.UPLOAD_DIR_MAC }}/nym-gateway-probe
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.UPLOAD_DIR_MAC }}
path: ${{ env.UPLOAD_DIR_MAC }}
retention-days: 1