Upload to build server in publish workflow for nym-vpn-core #23
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |