Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Re-enable windows for nym-vpn-core CI and release #1401

Merged
merged 29 commits into from
Oct 29, 2024
Merged
Show file tree
Hide file tree
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
1d77a80
Re-enable windows for nym-vpn-core CI and release
octol Oct 27, 2024
5df2a1f
Use msys2 to build wireguard-go
pronebird Oct 28, 2024
7af614e
Use msys2 shell
pronebird Oct 28, 2024
200773d
Install build tools
pronebird Oct 28, 2024
1e94efe
Add silent flag
pronebird Oct 28, 2024
4f1bbd4
Try new plugin
pronebird Oct 28, 2024
1e81dbf
use winget --disable-interactivity
pronebird Oct 28, 2024
235c051
Add --passive
pronebird Oct 28, 2024
fb12136
Use powershell to set PATH
pronebird Oct 28, 2024
9913242
Use pwshcore
pronebird Oct 28, 2024
18c68fb
ignore error if winget package is already installed
pronebird Oct 28, 2024
c75fceb
Use correct value
pronebird Oct 28, 2024
3bd81ab
Build wireguard for windows with msys2
pronebird Oct 28, 2024
8187d1b
Fix msys2 inherit env
pronebird Oct 28, 2024
1a70d66
Remove no longer needed RUSTFLAGS
pronebird Oct 28, 2024
0e15e42
Add msbuild to path
pronebird Oct 28, 2024
a2da90d
Fix typo
pronebird Oct 28, 2024
dd0de85
Exclude gateway-probe on windows
pronebird Oct 28, 2024
ff4cd60
Use CC name instead of full path
pronebird Oct 28, 2024
8aece4b
clippy: fix
pronebird Oct 28, 2024
84fa96c
Disable nym-gateway-probe in windows builds
pronebird Oct 29, 2024
e317e43
Extract windows core ci into its own workflow
pronebird Oct 29, 2024
2620062
Exclude gateway-probe.exe
pronebird Oct 29, 2024
a40e65f
Move MSYS env into step
pronebird Oct 29, 2024
4ec1d1b
Rename workflow for windows
pronebird Oct 29, 2024
d2ee1f4
Update step name
pronebird Oct 29, 2024
7411bfc
Remove winpcap from CI
octol Oct 29, 2024
208f4cf
Remove trailing whitespace
octol Oct 29, 2024
b907121
Remove Packet
octol Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-nym-vpn-core-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: Build nym-vpn-core
working-directory: nym-vpn-core
run: |
cargo build --${{ env.CARGO_TARGET }}
cargo build --${{ env.CARGO_TARGET }} --workspace --exclude nym-gateway-probe

- name: Get rust version used for build
id: rust-version
Expand All @@ -99,7 +99,7 @@ jobs:
echo "moving binaries into ${{ env.UPLOAD_DIR_WINDOWS }}"
rm -rf ${{ env.UPLOAD_DIR_WINDOWS }} || true
mkdir ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr ${{ env.SRC_BINARY }}/nym-gateway-probe.exe ${{ env.UPLOAD_DIR_WINDOWS }}
#cp -vpr ${{ env.SRC_BINARY }}/nym-gateway-probe.exe ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr ${{ env.SRC_BINARY }}/nym-vpn-cli.exe ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr ${{ env.SRC_BINARY }}/nym-vpnc.exe ${{ env.UPLOAD_DIR_WINDOWS }}
cp -vpr ${{ env.SRC_BINARY }}/nym-vpnd.exe ${{ env.UPLOAD_DIR_WINDOWS }}
Expand Down
30 changes: 27 additions & 3 deletions .github/workflows/build-wireguard-go-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,35 @@ jobs:
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup MSBuild.exe
uses: microsoft/setup-msbuild@v2
- name: Install build tools
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
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
uses: msys2/setup-msys2@v2
with:
update: false
msystem: MINGW64
install: mingw-w64-x86_64-clang

- name: Build wireguard
shell: bash
shell: msys2 {0}
env:
MSYS2_PATH_TYPE: inherit
run: |
./wireguard/build-wireguard-go.sh

Expand Down
151 changes: 151 additions & 0 deletions .github/workflows/ci-nym-vpn-core-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
name: ci-nym-vpn-core-windows

on:
# push:
pull_request:
paths:
- "nym-vpn-core/**"
- ".github/workflows/ci-nym-vpn-core-windows.yml"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always
AGENT_ISSELFHOSTED: 1 # https://github.com/actions/setup-go/issues/432

jobs:
build:
runs-on: custom-windows-11

steps:
- name: "Cleanup working directory"
shell: bash
run: |
ls -la ./
rm -rf ./* || true
rm -rf ./.??* || true
ls -la ./

- name: Support longpaths on 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: Set env
shell: bash
run: |
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we didn't need this anymore @pronebird ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh I see now, it's for winfw et al

mkdir -p ${GITHUB_WORKSPACE}/build/lib/

- name: Install Go
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
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
shell: pwsh
run: |
$buildtoolspath = "$Env:ProgramFiles (x86)/Microsoft Visual Studio/2022/BuildTools"
$msbuildpath = "$buildtoolspath/MSBuild/Current/Bin"
echo "Add msbuild dir to path: $msbuildpath"
Add-Content $env:GITHUB_PATH "$msbuildpath"

$msvctoolspath = "$buildtoolspath/VC/Tools/MSVC"
$contents = Get-ChildItem $msvctoolspath | Select-Object -First 1
$subdir = $contents[0].Name
$vctoolsdir = "$msvctoolspath/$subdir/bin/Hostx64/x64"
echo "Add vctools dir to path: $vctoolsdir"
Add-Content $env:GITHUB_PATH "$vctoolsdir"

- name: Setup msys2
uses: msys2/setup-msys2@v2
with:
update: false
msystem: MINGW64
install: mingw-w64-x86_64-clang

- name: Build wireguard
shell: msys2 {0}
env:
MSYS2_PATH_TYPE: inherit
run: |
./wireguard/build-wireguard-go.sh

- name: Download wintun.zip and winpcap.zip
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
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this one is unused, let me try removing it


- name: Unzip wintun.zip and winpcap.zip
shell: bash
run: |
unzip ${GITHUB_WORKSPACE}/wintun.zip
unzip ${GITHUB_WORKSPACE}/winpcap.zip

- name: Move wintun.dll and packet.lib to build directory
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
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
shell: bash
run: |
cd ${GITHUB_WORKSPACE}/nym-vpn-mullvad-libs
./build-windows-modules.sh

- name: Move winfw.dll to build directory
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 (excluding gateway probe)
working-directory: nym-vpn-core
run: |
cargo build --verbose --workspace --exclude nym-gateway-probe

- name: Run tests (excluding gateway probe)
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
72 changes: 2 additions & 70 deletions .github/workflows/ci-nym-vpn-core.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ jobs:
strategy:
fail-fast: false
matrix:
# os: [arc-ubuntu-22.04, custom-runner-mac-m1, custom-windows-11]
os: [arc-ubuntu-22.04, custom-runner-mac-m1]
target: [native]
include:
Expand All @@ -41,10 +40,6 @@ jobs:
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

Expand Down Expand Up @@ -80,30 +75,20 @@ jobs:
if ${{ contains(matrix.os, 'ubuntu') && contains(matrix.target, 'native') }}; then
triplet=x86_64-unknown-linux-gnu
echo "TRIPLET=$triplet" >> $GITHUB_ENV
echo "RUSTFLAGS=-L ${GITHUB_WORKSPACE}/build/lib/${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
echo "RUSTFLAGS=-L ${GITHUB_WORKSPACE}/build/lib/${triplet} -L ${GITHUB_WORKSPACE}/build/lib/x86_64-unknown-linux-gnu" >> $GITHUB_ENV
elif ${{ matrix.target == 'ios' }}; then
triplet=aarch64-apple-ios
echo "TRIPLET=$triplet" >> $GITHUB_ENV
echo "RUSTFLAGS=-L ${GITHUB_WORKSPACE}/build/lib/${triplet}" >> $GITHUB_ENV
elif ${{ matrix.os == 'macos-12' || matrix.os == 'macos-13' }}; then
triplet=x86_64-apple-darwin
echo "TRIPLET=$triplet" >> $GITHUB_ENV
echo "RUSTFLAGS=-L ${GITHUB_WORKSPACE}/build/lib/${triplet}" >> $GITHUB_ENV
elif ${{ contains(matrix.os, 'macos') || contains(matrix.os, 'mac-m1') }}; then
triplet=universal-apple-darwin
echo "TRIPLET=$triplet" >> $GITHUB_ENV
echo "RUSTFLAGS=-L ${GITHUB_WORKSPACE}/build/lib/${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/${triplet} -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
Expand All @@ -121,10 +106,6 @@ jobs:
version: "21.12" # 3.21.12: the version on ubuntu 24.04. Don't change this!
repo-token: ${{ secrets.GITHUB_TOKEN }}

- name: Setup MSBuild.exe
if: contains(matrix.os, 'windows')
uses: microsoft/setup-msbuild@v2

- name: Build wireguard
if: matrix.target != 'ios' && matrix.target != 'android'
shell: bash
Expand All @@ -141,49 +122,6 @@ jobs:
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: |
Expand All @@ -194,7 +132,7 @@ jobs:
working-directory: nym-vpn-core
run: |
cargo build --verbose

- name: Build (Android)
if: matrix.target == 'android'
working-directory: nym-vpn-core
Expand Down Expand Up @@ -266,17 +204,11 @@ jobs:
run: exit 1

- name: Run tests (Linux, macOS)
if: matrix.target != 'android' && matrix.target != 'ios' && !contains(matrix.os, 'windows')
if: matrix.target != 'android' && matrix.target != 'ios'
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: |
Expand Down
Loading
Loading