Re-enable windows for nym-vpn-core CI and release #1271
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: ci-nym-vpn-core | |
on: | |
# push: | |
pull_request: | |
paths: | |
- "nym-vpn-core/**" | |
- ".github/workflows/ci-nym-vpn-core.yml" | |
workflow_dispatch: | |
env: | |
CARGO_TERM_COLOR: always | |
AGENT_ISSELFHOSTED: 1 # https://github.com/actions/setup-go/issues/432 | |
MSYS2_PATH_TYPE: inherit | |
jobs: | |
build: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [arc-ubuntu-22.04, custom-runner-mac-m1, custom-windows-11] | |
target: [native] | |
include: | |
- os: arc-ubuntu-22.04 | |
target: android | |
- os: custom-runner-mac-m1 | |
target: ios | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: "Cleanup working directory" | |
if: contains(matrix.os, 'custom') | |
shell: bash | |
run: | | |
ls -la ./ | |
rm -rf ./* || true | |
rm -rf ./.??* || true | |
ls -la ./ | |
- name: Install system dependencies | |
run: sudo apt-get update && sudo apt-get install -y libdbus-1-dev libmnl-dev libnftnl-dev protobuf-compiler git curl gcc g++ make unzip | |
if: contains(matrix.os, 'ubuntu') | |
- name: Support longpaths on windows | |
if: contains(matrix.os, 'windows') | |
run: git config --system core.longpaths true | |
- name: Checkout repo | |
uses: actions/checkout@v4 | |
- name: Install rust toolchain | |
uses: brndnmtthws/rust-action-rustup@v1 | |
with: | |
toolchain: stable | |
components: rustfmt, clippy | |
- name: Install cargo ndk | |
if: matrix.target == 'android' | |
run: cargo install cargo-ndk | |
- name: Setup NDK | |
uses: nttld/setup-ndk@v1 | |
id: setup-ndk | |
if: matrix.target == 'android' | |
with: | |
ndk-version: r25c | |
add-to-path: false | |
- name: Add iOS target | |
if: matrix.target == 'ios' | |
run: rustup target add aarch64-apple-ios | |
- name: Add Android target | |
if: matrix.target == 'android' | |
run: rustup target add aarch64-linux-android | |
- name: Set env | |
shell: bash | |
run: | | |
if ${{ contains(matrix.os, 'ubuntu') && contains(matrix.target, 'native') }}; then | |
triplet=x86_64-unknown-linux-gnu | |
echo "TRIPLET=$triplet" >> $GITHUB_ENV | |
elif ${{ matrix.target == 'android' }}; then | |
triplet=aarch64-linux-android | |
echo "ANDROID_NDK_HOME=${{ steps.setup-ndk.outputs.ndk-path }}" >> $GITHUB_ENV | |
echo "NDK_TOOLCHAIN_DIR=${{ steps.setup-ndk.outputs.ndk-path }}/toolchains/llvm/prebuilt/linux-x86_64/bin" >> $GITHUB_ENV | |
echo "TRIPLET=$triplet" >> $GITHUB_ENV | |
elif ${{ matrix.target == 'ios' }}; then | |
triplet=aarch64-apple-ios | |
echo "TRIPLET=$triplet" >> $GITHUB_ENV | |
elif ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' }}; then | |
triplet=x86_64-apple-darwin | |
echo "TRIPLET=$triplet" >> $GITHUB_ENV | |
elif ${{ contains(matrix.os, 'macos') || contains(matrix.os, 'mac-m1') }}; then | |
triplet=universal-apple-darwin | |
echo "TRIPLET=$triplet" >> $GITHUB_ENV | |
elif ${{ contains(matrix.os, 'windows') }}; then | |
triplet=x86_64-pc-windows-msvc | |
echo "TRIPLET=$triplet" >> $GITHUB_ENV | |
echo "RUSTFLAGS=-L ${GITHUB_WORKSPACE}/build/lib -Clink-args=/LIBPATH:${GITHUB_WORKSPACE}/build/lib/x64-Debug" >> $GITHUB_ENV | |
mkdir -p ${GITHUB_WORKSPACE}/build/lib/ | |
else | |
echo " ✗ unknown platform/arch [${{ matrix.os }}]" | |
exit 1 | |
fi | |
- name: Install Go | |
if: ${{ !contains(matrix.os, 'ubuntu') }} | |
uses: actions/setup-go@v5 | |
with: | |
go-version: "stable" | |
- name: Install Protoc | |
uses: arduino/setup-protoc@v3 | |
with: | |
version: "21.12" # 3.21.12: the version on ubuntu 24.04. Don't change this! | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install build tools | |
if: contains(matrix.os, 'windows') | |
shell: cmd | |
run: | | |
winget install --disable-interactivity --id=Microsoft.VisualStudio.2022.BuildTools --override "--wait --passive --add Microsoft.VisualStudio.Workload.VCTools;includeRecommended" | |
if %ERRORLEVEL% EQU -1978335189 ( | |
exit /b 0 | |
) | |
- name: Update path with vctools | |
if: contains(matrix.os, 'windows') | |
shell: pwsh | |
run: | | |
$path = "$Env:ProgramFiles (x86)/Microsoft Visual Studio/2022/BuildTools/VC/Tools/MSVC" | |
$contents = Get-ChildItem $path | Select-Object -First 1 | |
$subdir = $contents[0].Name | |
$vctoolsdir = "$path/$subdir/bin/Hostx64/x64" | |
echo "Add vctools dir to path: $vctoolsdir" | |
Add-Content $env:GITHUB_PATH "$vctoolsdir" | |
- name: Setup msys2 | |
if: contains(matrix.os, 'windows') | |
uses: msys2/setup-msys2@v2 | |
with: | |
update: false | |
msystem: MINGW64 | |
install: mingw-w64-x86_64-clang | |
- name: Build wireguard | |
if: matrix.target != 'ios' && matrix.target != 'android' && !contains(matrix.os, 'windows') | |
shell: bash | |
run: | | |
./wireguard/build-wireguard-go.sh | |
- name: Build wireguard (Windows) | |
if: contains(matrix.os, 'windows') | |
shell: msys2 {0} | |
run: | | |
./wireguard/build-wireguard-go.sh | |
- name: Build wireguard (iOS) | |
if: matrix.target == 'ios' | |
shell: bash | |
run: | | |
./wireguard/build-wireguard-go.sh --ios | |
- name: Build wireguard (Android) | |
if: matrix.target == 'android' | |
run: ./wireguard/libwg/build-android.sh | |
- name: Download wintun.zip and winpcap.zip | |
if: contains(matrix.os, 'windows') | |
shell: bash | |
run: | | |
curl --output ${GITHUB_WORKSPACE}/wintun.zip https://www.wintun.net/builds/wintun-0.14.1.zip | |
curl --output ${GITHUB_WORKSPACE}/winpcap.zip https://www.winpcap.org/install/bin/WpdPack_4_1_2.zip | |
- name: Unzip wintun.zip and winpcap.zip | |
if: contains(matrix.os, 'windows') | |
shell: bash | |
run: | | |
unzip ${GITHUB_WORKSPACE}/wintun.zip | |
unzip ${GITHUB_WORKSPACE}/winpcap.zip | |
- name: Move wintun.dll and packet.lib to build directory | |
if: contains(matrix.os, 'windows') | |
shell: bash | |
run: | | |
mv ${GITHUB_WORKSPACE}/wintun/bin/amd64/wintun.dll ${GITHUB_WORKSPACE}/build/lib/ | |
mv ${GITHUB_WORKSPACE}/WpdPack/Lib/x64/Packet.lib ${GITHUB_WORKSPACE}/build/lib/ | |
- name: Checkout mullvad libs for Windows | |
if: contains(matrix.os, 'windows') | |
uses: actions/checkout@v4 | |
with: | |
repository: nymtech/nym-vpn-mullvad-libs | |
ref: main | |
path: "nym-vpn-mullvad-libs" | |
submodules: true | |
- name: Build winfw.dll from mullvad | |
if: contains(matrix.os, 'windows') | |
shell: bash | |
run: | | |
cd ${GITHUB_WORKSPACE}/nym-vpn-mullvad-libs | |
./build-windows-modules.sh | |
- name: Move winfw.dll to build directory | |
if: contains(matrix.os, 'windows') | |
shell: bash | |
run: | | |
mv ${GITHUB_WORKSPACE}/nym-vpn-mullvad-libs/windows/winfw/bin/x64-Debug ${GITHUB_WORKSPACE}/build/lib/ | |
- name: rustfmt check | |
working-directory: nym-vpn-core | |
run: | | |
cargo fmt --check | |
- name: Build | |
if: matrix.target != 'android' && matrix.target != 'ios' | |
working-directory: nym-vpn-core | |
run: | | |
cargo build --verbose | |
- name: Build (Android) | |
if: matrix.target == 'android' | |
working-directory: nym-vpn-core | |
run: | | |
cargo ndk -t aarch64-linux-android -o ./build build -p nym-vpn-lib | |
- name: Build (iOS) | |
if: matrix.target == 'ios' | |
working-directory: nym-vpn-core | |
run: | | |
cargo build --verbose --target aarch64-apple-ios -p nym-vpn-lib | |
- name: Generate uniffi (Android) | |
if: matrix.target == 'android' | |
working-directory: nym-vpn-core | |
run: | | |
cargo run --bin uniffi-bindgen generate \ | |
--library target/aarch64-linux-android/debug/libnym_vpn_lib.so \ | |
--config crates/nym-vpn-lib/uniffi.toml \ | |
--language kotlin --out-dir build -n | |
- name: Generate uniffi (iOS) | |
if: matrix.target == 'ios' | |
working-directory: nym-vpn-core | |
run: | | |
cargo run --bin uniffi-bindgen generate \ | |
--library target/aarch64-apple-ios/debug/libnym_vpn_lib.a \ | |
--config crates/nym-vpn-lib/uniffi.toml \ | |
--language swift --out-dir build -n | |
- name: Uniffi diff check (Android) | |
if: matrix.target == 'android' | |
working-directory: nym-vpn-core | |
run: | | |
diff -B build/nym_vpn_lib/nym_vpn_lib.kt crates/nym-vpn-lib/uniffi/nym_vpn_lib.kt | |
continue-on-error: true | |
id: diff_android | |
- name: Upload generated uniffi file (Android) | |
if: steps.diff_android.outcome == 'failure' && matrix.target == 'android' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: updated-uniffi-android | |
path: nym-vpn-core/build/nym_vpn_lib/nym_vpn_lib.kt | |
retention-days: 1 | |
- name: Fail workflow for uniffi (Android) | |
if: steps.diff_android.outcome == 'failure' && matrix.target == 'android' | |
run: exit 1 | |
- name: Uniffi diff check (iOS) | |
if: matrix.target == 'ios' | |
working-directory: nym-vpn-core | |
run: | | |
diff -B build/nym_vpn_lib.swift crates/nym-vpn-lib/uniffi/nym_vpn_lib.swift | |
continue-on-error: true | |
id: diff_ios | |
- name: Upload generated uniffi file (iOS) | |
if: steps.diff_ios.outcome == 'failure' && matrix.target == 'ios' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: updated-uniffi-ios | |
path: nym-vpn-core/build/nym_vpn_lib.swift | |
retention-days: 1 | |
- name: Fail workflow for uniffi (iOS) | |
if: steps.diff_ios.outcome == 'failure' && matrix.target == 'ios' | |
run: exit 1 | |
- name: Run tests (Linux, macOS) | |
if: matrix.target != 'android' && matrix.target != 'ios' && !contains(matrix.os, 'windows') | |
working-directory: nym-vpn-core | |
run: | | |
cargo test --verbose | |
- name: Run tests (Windows excluding gateway probe) | |
if: contains(matrix.os, 'windows') | |
working-directory: nym-vpn-core | |
run: | | |
cargo test --verbose --workspace --exclude nym-gateway-probe | |
- name: Clippy | |
working-directory: nym-vpn-core | |
run: | | |
cargo clippy -- -Dwarnings | |
- name: Clippy (Android) | |
if: matrix.target == 'android' | |
working-directory: nym-vpn-core | |
run: | | |
cargo ndk -t aarch64-linux-android clippy -p nym-vpn-lib -- -Dwarnings | |
- name: Clippy (iOS) | |
if: matrix.target == 'ios' | |
working-directory: nym-vpn-core | |
run: | | |
cargo clippy --target aarch64-apple-ios -p nym-vpn-lib -- -Dwarnings |