Skip to content

build-nym-vpn-core-mac #11

build-nym-vpn-core-mac

build-nym-vpn-core-mac #11

name: build-nym-vpn-core-mac
on: [workflow_dispatch, 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: Download wireguard-go artifacts
uses: actions/download-artifact@v4
with:
name: ${{ env.WG_GO_LIB_NAME }}
path: ${{ env.WG_GO_LIB_PATH }}
- name: Install cargo-get
run: |
cargo install --locked cargo-get
- 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: Build nym-vpn-core (native)
working-directory: nym-vpn-core
env:
RUSTFLAGS: "-L ${{ env.WG_GO_LIB_PATH }}"
run: |
cargo build --${{ 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 --${{ env.CARGO_TARGET }} --target x86_64-apple-darwin --workspace --exclude nym-gateway-probe
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-vpn-cli ${{ env.SRC_NATIVE_BINARY }}/nym-vpn-cli ${{ env.SRC_X86_64_BINARY }}/nym-vpn-cli
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
# - name: Compile protobuf (health)
# run: |
# protoc --swift_out=. proto/grpc/health.proto
# protoc --grpc-swift_out=. proto/grpc/health.proto
#
# - name: Compile protobuf (vpn)
# run: |
# protoc --swift_out=. proto/nym/vpn.proto
# protoc --grpc-swift_out=. proto/nym/vpn.proto
#
# - name: Upload artifacts
# uses: actions/upload-artifact@v4
# with:
# name: swift-proto-files
# path: |
# vpn.grpc.swift
# vpn.pb.swift
# health.grpc.swift
# health.pb.swift
# retention-days: 1