-
Notifications
You must be signed in to change notification settings - Fork 5
202 lines (167 loc) · 6.56 KB
/
build_openvpn_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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
name: windows-openvpn
on: [push]
jobs:
msvc:
strategy:
fail-fast: false
matrix:
plat: [ARM64, Win32, x64]
include:
- plat: ARM64
triplet: arm64
- plat: Win32
triplet: x86
- plat: x64
triplet: x64
name: "OpenVPN msbuild"
env:
BUILD_CONFIGURATION: Release
VCPKG_OVERLAY_PORTS: ${{ github.workspace }}/openvpn/contrib/vcpkg-ports
VCPKG_OVERLAY_TRIPLETS: ${{ github.workspace }}/openvpn/contrib/vcpkg-triplets
runs-on: windows-latest
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[windows]') ||
contains(github.event.head_commit.message, '[windows-openvpn]') ||
contains(github.event.head_commit.message, '[openvpn]')
steps:
- uses: actions/checkout@v3
- name: 'Get openvpn'
uses: actions/checkout@v3
with:
repository: OpenVPN/openvpn
ref: release/2.5
path: openvpn
- name: Add MSBuild to PATH
uses: microsoft/[email protected]
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x'
- name: Install rst2html
run: python -m pip install --upgrade pip rst2html
- name: Restore artifacts, or setup vcpkg (do not install any package)
uses: lukka/run-vcpkg@v10
with:
vcpkgGitCommitId: 'd10d511f25620ca0f315cd83dcef6485efc63010'
vcpkgJsonGlob: '**/openvpn/vcpkg.json'
appendedCacheKey: '${{matrix.triplet}}'
- name: Run MSBuild consuming vcpkg.json
working-directory: openvpn
run: |
${{ github.workspace }}/vcpkg/vcpkg.exe integrate install
(Get-Content ${{ github.workspace }}/openvpn/src/openvpn/openvpn.vcxproj).Replace('_CRT_NONSTDC_NO_DEPRECATE;', '_CRT_NONSTDC_NO_DEPRECATE;ENABLE_DEBUG;') | Set-Content ${{ github.workspace }}/openvpn/src/openvpn/openvpn.vcxproj
msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} /p:Platform="${{ matrix.plat }}" .
- name: Archive artifacts
uses: actions/upload-artifact@v3
with:
name: openvpn-win-${{ matrix.plat }}
path: |
openvpn/${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.exe
openvpn/${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.dll
openvpn/${{ matrix.plat }}-Output/${{env.BUILD_CONFIGURATION}}/*.pdb
openvpn/doc/openvpn.8.html
openvpn3-msvc:
strategy:
matrix:
arch: [amd64]
env:
VCPKG_ROOT: ${{ github.workspace }}/openvpn3/vcpkg
BUILD_CONFIGURATION: Release
buildDir: '${{ github.workspace }}/openvpn3/build'
runs-on: windows-latest
if: |
contains(github.event.head_commit.message, '[all]') ||
contains(github.event.head_commit.message, '[windows]') ||
contains(github.event.head_commit.message, '[windows-openvpn]') ||
contains(github.event.head_commit.message, '[openvpn]')
steps:
- uses: actions/checkout@v3
- uses: lukka/get-cmake@latest
- uses: ilammy/msvc-dev-cmd@v1
with:
working-directory: openvpn3
arch: ${{ matrix.arch }}
- name: 'Get openvpn3'
uses: actions/checkout@v3
with:
repository: amnezia-vpn/openvpn3
ref: win-amezia
path: openvpn3
- name: 'Build OpenVPN3'
working-directory: openvpn3
run: |
git clone https://github.com/Microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.bat
cmake -B build -S . -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/openvpn3/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_OVERLAY_PORTS="${{ github.workspace }}/openvpn3/deps/vcpkg-ports"
cmake --build build --config Release --target ovpncli
- uses: actions/upload-artifact@v2
with:
name: openvpn3-win
path: |
${{ env.buildDir }}/**/*.exe
${{ env.buildDir }}/**/*.dll
!${{ env.buildDir }}/test/ssl/**
!${{ env.buildDir }}/test/unittests/**
!${{ env.buildDir }}/CMakeFiles/**
!${{ env.buildDir }}/vcpkg_installed/**
github-release:
name: GitHub Release
needs: msvc
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in $(find ./ -name '*.exe' -or -name '*.dll' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Zip ALL
run: for file in *; do zip -r ${file%.*}.zip $file; done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn-win-ARM64.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn-win-Win32.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn-win-x64.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true
ovpn3-release:
name: GitHub Release
needs: openvpn3-msvc
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Setup | Checkout
uses: actions/checkout@v2
- name: Setup | Artifacts
uses: actions/download-artifact@v2
- name: Setup | Checksums
run: for file in $(find ./ -name '*.exe' -or -name '*.dll' ); do openssl dgst -sha256 -r "$file" | awk '{print $1}' > "${file}.sha256"; done
- name: Zip ALL
run: for file in *; do zip -r ${file%.*}.zip $file; done
- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: openvpn3-win.zip
tag: ${{ github.ref }}
overwrite: true
file_glob: true