-
Notifications
You must be signed in to change notification settings - Fork 12
143 lines (119 loc) · 4.28 KB
/
ci-nym-vpn-core-windows.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
131
132
133
134
135
136
137
138
139
140
141
142
143
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: windows-latest
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: dtolnay/rust-toolchain@master
with:
# TODO let's pin to 1.82.0 as in 1.83.0 the step `Build winfw.dll from mullvad` fails
toolchain: 1.82.0
components: rustfmt, clippy
- name: Install target i686-pc-windows-msvc
run: |
rustup target add i686-pc-windows-msvc
- name: Set env
shell: bash
run: |
echo "RUSTFLAGS=-L ${GITHUB_WORKSPACE}/build/lib -Clink-args=/LIBPATH:${GITHUB_WORKSPACE}/build/lib/x64-Debug" >> $GITHUB_ENV
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
shell: bash
run: |
curl --output ${GITHUB_WORKSPACE}/wintun.zip https://www.wintun.net/builds/wintun-0.14.1.zip
unzip ${GITHUB_WORKSPACE}/wintun.zip
mv ${GITHUB_WORKSPACE}/wintun/bin/amd64/wintun.dll ${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 --all
- name: Build
working-directory: nym-vpn-core
run: |
cargo build --verbose --workspace
- name: Run tests
working-directory: nym-vpn-core
run: |
cargo test --verbose --workspace
- name: Clippy
working-directory: nym-vpn-core
run: |
cargo clippy --workspace -- -Dwarnings