-
Notifications
You must be signed in to change notification settings - Fork 6
162 lines (138 loc) · 5.38 KB
/
build_libssh_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
name: libssh-windows
on: [push]
env:
# Expected filename: https://zlib.net/zlib-${{env.ZLIB_VERSION}}.tar.gz
ZLIB_VERSION: 1.3.1
# Expected filename: https://www.openssl.org/source/openssl-${{env.OPENSSL_VERSION}}.tar.gz
OPENSSL_VERSION: 3.0.13
# Exoected filename: ${{env.LIBSSH_SOURCE}}libssh-${{env.LIBSSH_VERSION}}.tar.xz
LIBSSH_SOURCE: https://www.libssh.org/files/0.10/
LIBSSH_VERSION: 0.10.6
jobs:
Build-VisualCxx:
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-libssh]') ||
contains(github.event.head_commit.message, '[libssh]')
strategy:
matrix:
arch: [x86, x86_64]
# no-crypto=yes: builds version with all crypto disabled
# no-crypto=no: builds version with all crypto enabled (where required dependencies are available)
no_crypto:
- no
# - yes
steps:
- uses: actions/checkout@v3
- name: Enable Developer Command Prompt
# You may pin to the exact commit or the version.
# uses: ilammy/msvc-dev-cmd@d8610e2b41c6d0f0c3b4c46dad8df0fd826c68e1
uses: ilammy/[email protected]
with:
arch: ${{ matrix.arch }}
toolset: ${{ matrix.toolset }}
#sdk: # use the latest
#spectre: # set true to use VC libraries with sepctre mitigations
- uses: ilammy/[email protected]
name: Install NASM
- uses: shogo82148/actions-setup-perl@v1
name: Install PERL
with:
distribution: strawberry
- name: Get dependencies
run: |
# Get and unpack zlib
mkdir zlib
cd zlib
wget https://zlib.net/zlib-${{env.ZLIB_VERSION}}.tar.gz -outfile zlib-${{env.ZLIB_VERSION}}.tar.gz
7z x zlib-${{env.ZLIB_VERSION}}.tar.gz
7z x zlib-${{env.ZLIB_VERSION}}.tar
ren zlib-${{env.ZLIB_VERSION}} ${{env.ZLIB_VERSION}}
del *.tar
del *.gz
cd ..
# Get and unpack openssl
mkdir openssl
cd openssl
wget https://www.openssl.org/source/openssl-${{env.OPENSSL_VERSION}}.tar.gz -outfile openssl-${{env.OPENSSL_VERSION}}.tar.gz
7z x openssl-${{env.OPENSSL_VERSION}}.tar.gz
7z x openssl-${{env.OPENSSL_VERSION}}.tar
ren openssl-${{env.OPENSSL_VERSION}} ${{env.OPENSSL_VERSION}}
del *.tar
del *.gz
cd ..
# Get and unpack libssh
mkdir libssh
cd libssh
wget ${{env.LIBSSH_SOURCE}}libssh-${{env.LIBSSH_VERSION}}.tar.xz -outfile libssh-${{env.LIBSSH_VERSION}}.tar.xz
7z x libssh-${{env.LIBSSH_VERSION}}.tar.xz
7z x libssh-${{env.LIBSSH_VERSION}}.tar
ren libssh-${{env.LIBSSH_VERSION}} ${{env.LIBSSH_VERSION}}
del *.tar
del *.xz
cd ${{env.LIBSSH_VERSION}}
mkdir build
cd ..
cd ..
shell: powershell
- name: Build zlib
shell: cmd
run: |
cd zlib\${{env.ZLIB_VERSION}}
cmake .
nmake -f win32\Makefile.msc
- name: Build openssl x86
if: matrix.arch == 'x86'
shell: powershell
run: |
cd openssl\${{env.OPENSSL_VERSION}}
$env:Path += ";${{github.workspace}}\tools\nasm"
$env:Path
perl Configure VC-WIN32 no-tests no-shared --with-zlib-include=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}
nmake
- name: Build openssl x64
if: matrix.arch == 'x86_64'
shell: powershell
run: |
cd openssl\${{env.OPENSSL_VERSION}}
$env:Path += ";${{github.workspace}}\tools\nasm"
$env:Path
perl Configure VC-WIN64A no-tests no-shared --with-zlib-include=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}
nmake
- name: Build libssh
shell: powershell
run: |
cd libssh\${{env.LIBSSH_VERSION}}\build
cmake .. -G "NMake Makefiles" -DWITH_SERVER=OFF -DWITH_GSSAPI=OFF -DLIBSSH_LINK_LIBRARIES=crypt32 -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS="/MT" -DCMAKE_CXX_FLAGS="/MT" -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded -DOPENSSL_ROOT_DIR=${{github.workspace}}\openssl\${{env.OPENSSL_VERSION}}\ -DZLIB_ROOT:PATH=${{github.workspace}}\zlib\${{env.ZLIB_VERSION}}\
nmake ssh
- name: Upload Artifact
uses: actions/[email protected]
with:
name: libssh-win-${{ matrix.arch }}
path: ${{ github.workspace }}\libssh\${{env.LIBSSH_VERSION}}\build
if-no-files-found: error
retention-days: 7
github-release:
name: GitHub Release
needs: Build-VisualCxx
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 '*.lib' -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: "*.zip"
tag: ${{ github.ref }}
overwrite: true
file_glob: true