Skip to content

Commit 102e46e

Browse files
authored
Merge pull request #29 from KareemAliAWS/add_CI_build
Add CI build using GitHub actions
2 parents 34539cf + e2b513a commit 102e46e

File tree

3 files changed

+215
-49
lines changed

3 files changed

+215
-49
lines changed

.github/workflows/ci.yml

Lines changed: 167 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,167 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- '*'
7+
8+
env:
9+
PACKAGE_NAME: aws-iot-securetunneling-localproxy
10+
11+
jobs:
12+
osx:
13+
runs-on: macos-latest
14+
steps:
15+
- uses: actions/checkout@v2
16+
name: 'Checkout'
17+
- name: Install brew dependencies
18+
run: |
19+
brew install openssl zlib cmake wget git
20+
- name: Install boost
21+
working-directory: ${{ github.workspace }}
22+
run: |
23+
wget https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz -O /tmp/boost.tar.gz
24+
tar xzvf /tmp/boost.tar.gz
25+
cd boost_1_69_0
26+
./bootstrap.sh --with-toolset=clang
27+
./b2 install toolset=clang
28+
- name: Install protobuf
29+
working-directory: ${{ github.workspace }}
30+
run: |
31+
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz -O /tmp/protobuf-all-3.6.1.tar.gz
32+
tar xzvf /tmp/protobuf-all-3.6.1.tar.gz
33+
cd protobuf-3.6.1
34+
mkdir build_make
35+
cd build_make
36+
cmake ../cmake
37+
make
38+
make install
39+
- name: Install Catch2
40+
working-directory: ${{ github.workspace }}
41+
run: |
42+
git clone https://github.com/catchorg/Catch2.git
43+
cd Catch2
44+
mkdir build
45+
cd build
46+
cmake ../
47+
make
48+
make install
49+
- name: Building localproxy
50+
working-directory: ${{ github.workspace }}
51+
run: |
52+
mkdir build
53+
cd build
54+
cmake .. -DOPENSSL_ROOT_DIR=/usr/local/Cellar/[email protected]/1.1.1g/ -DOPENSSL_LIBRARIES=/usr/local/Cellar/[email protected]/1.1.1g/lib/
55+
make
56+
ubuntu:
57+
runs-on: ubuntu-latest
58+
steps:
59+
- name: 'Checkout'
60+
uses: actions/checkout@v2
61+
- name: Install apt-get dependencies
62+
run: |
63+
sudo apt-get install -y build-essential git python3-dev
64+
sudo apt-get install -y wget tar zlibc libssl-dev openssl cmake python-dev
65+
sudo apt-get clean -y
66+
- name: Install boost
67+
working-directory: ${{ github.workspace }}
68+
run: |
69+
wget https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz -O /tmp/boost.tar.gz
70+
tar xzvf /tmp/boost.tar.gz
71+
cd boost_1_69_0
72+
./bootstrap.sh
73+
sudo ./b2 install
74+
- name: Install protobuf
75+
working-directory: ${{ github.workspace }}
76+
run: |
77+
wget https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz -O /tmp/protobuf-all-3.6.1.tar.gz
78+
tar xzvf /tmp/protobuf-all-3.6.1.tar.gz
79+
cd protobuf-3.6.1
80+
mkdir build_make
81+
cd build_make
82+
cmake ../cmake
83+
make
84+
sudo make install
85+
- name: install Catch2
86+
working-directory: ${{ github.workspace }}
87+
run: |
88+
git clone https://github.com/catchorg/Catch2.git
89+
cd Catch2
90+
mkdir build
91+
cd build
92+
cmake ../
93+
make
94+
sudo make install
95+
- name: Building localproxy
96+
working-directory: ${{ github.workspace }}
97+
run: |
98+
mkdir build
99+
cd build
100+
cmake .. -DOPENSSL_ROOT_DIR=/usr/local/Cellar/[email protected]/1.1.1g/ -DOPENSSL_LIBRARIES=/usr/local/Cellar/[email protected]/1.1.1g/lib/
101+
make
102+
windows:
103+
runs-on: windows-latest
104+
steps:
105+
- name: Setup developer command prompt
106+
uses: ilammy/msvc-dev-cmd@v1
107+
with:
108+
toolset: 14.1
109+
arch: x64
110+
- name: Install OpenSSL
111+
run: |
112+
Invoke-WebRequest "https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip" -OutFile "nasm-2.15.05-win64.zip"
113+
Expand-Archive "nasm-2.15.05-win64.zip" -Force -DestinationPath "C:\NASM"
114+
$env:Path += ";C:\NASM\nasm-2.15.05\"
115+
git clone https://github.com/openssl/openssl.git
116+
cd openssl
117+
git checkout OpenSSL_1_1_1-stable
118+
perl Configure VC-WIN64A
119+
nmake
120+
nmake install
121+
$env:Path += ";C:\Program Files\OpenSSL\bin"
122+
- name: Install Catch2
123+
run: |
124+
git clone https://github.com/catchorg/Catch2.git
125+
cd Catch2
126+
mkdir build
127+
cd build
128+
cmake -DBUILD_TESTING=OFF -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ../
129+
nmake
130+
nmake install
131+
- name: Install zlib
132+
run: |
133+
git clone -b v1.2.8 https://github.com/madler/zlib.git
134+
cd zlib
135+
mkdir build
136+
cd build
137+
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ../
138+
nmake
139+
nmake install
140+
$env:Path += ";C:\Program Files (x86)\zlib\bin"
141+
- name: Install boost
142+
run: |
143+
Invoke-WebRequest "https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.zip" -OutFile "boost_1_69_0.zip"
144+
Expand-Archive "boost_1_69_0.zip" -Force
145+
cd .\boost_1_69_0\boost_1_69_0\
146+
.\bootstrap.bat
147+
.\b2 toolset=msvc-14.1 address-model=64 install define=BOOST_WINAPI_VERSION_WIN10
148+
- name: Install protobuf
149+
run: |
150+
Invoke-WebRequest "https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.zip" -OutFile "protobuf-all-3.6.1.zip"
151+
Expand-Archive protobuf-all-3.6.1.zip
152+
cd .\protobuf-all-3.6.1\protobuf-3.6.1\cmake\
153+
mkdir build
154+
cd build
155+
cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../
156+
nmake
157+
nmake install
158+
$env:Path += ";C:\Program Files (x86)\protobuf\bin"
159+
- name: 'Checkout'
160+
uses: actions/checkout@v2
161+
- name: Build localproxy
162+
working-directory: ${{ github.workspace }}
163+
run: |
164+
mkdir build
165+
cd build
166+
cmake -DWIN32_WINNT=0x0A00 -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 16 2019" -A x64 ..\
167+
msbuild localproxy.vcxproj -p:Configuration=Release

CMakeLists.txt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,10 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
2929
if (UNIX OR APPLE)
3030
set(CUSTOM_COMPILER_FLAGS "-O2 -D_FORTIFY_SOURCE=2 -fPIE -Wall -Werror")
3131
set(TEST_COMPILER_FLAGS "${CUSTOM_COMPILER_FLAGS} -D_AWSIOT_TUNNELING_NO_SSL")
32-
elseif (WIN32)
32+
elseif (WIN32 OR MSVC)
3333
set(CUSTOM_COMPILER_FLAGS "/W4 /DYNAMICBASE /NXCOMPAT /analyze")
3434
set(TEST_COMPILER_FLAGS "${CUSTOM_COMPILER_FLAGS} /D_AWSIOT_TUNNELING_NO_SSL")
35+
add_definitions(-D_WIN32_WINNT=${WIN32_WINNT})
3536
endif ()
3637

3738

@@ -87,8 +88,8 @@ set(TEST_SOURCES ${PROJECT_SOURCE_DIR}/test/AdapterTests.cpp ${CORE_SOURCES} ${P
8788
add_executable(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} ${MAIN_SOURCES})
8889
add_executable(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} ${TEST_SOURCES})
8990

90-
#libatomic ensured for all platforms except OSX
91-
if(NOT APPLE)
91+
#libatomic ensured for all platforms except OSX and WINDOWS
92+
if(NOT APPLE AND NOT MSVC)
9293
target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} atomic)
9394
target_link_libraries(${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} atomic)
9495
endif()

windows-localproxy-build.md

Lines changed: 44 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -7,67 +7,65 @@
77
* Install the following dependencies (Choose visual studio command prompt based on architecture):
88
* Download and install zlib:
99
* Use Visual Studio native tool command prompt in admin mode.
10-
* git clone -b v1.2.8 https://github.com/madler/zlib.git
11-
* cd zlib
12-
* mkdir build & cd build
13-
* cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ../
14-
* nmake & nmake install (installs zlib inside C:\Program Files (x86)\ )
10+
* `git clone -b v1.2.8 https://github.com/madler/zlib.git`
11+
* `cd zlib`
12+
* `mkdir build`
13+
* `cd build`
14+
* `cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ../`
15+
* `nmake`
16+
* `nmake install` (installs zlib inside C:\Program Files (x86)\ )
1517
* Update PATH environment variable to add the dll for zlib which is inside C:\Program Files (x86)\zlib\bin
1618
* Download and install openssl
1719
* Use Visual Studio native tool command prompt in admin mode.
18-
* git clone https://github.com/openssl/openssl.git
19-
* cd openssl
20-
* git checkout OpenSSL_1_1_1-stable
21-
* perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE } (Choose one of the options based on your architecture )
22-
* nmake & nmake install (installs OpenSSL inside C:\Program Files\)
20+
* `git clone https://github.com/openssl/openssl.git`
21+
* `cd openssl`
22+
* `git checkout OpenSSL_1_1_1-stable`
23+
* `perl Configure { VC-WIN32 | VC-WIN64A | VC-WIN64I | VC-CE }` (Choose one of the options based on your architecture )
24+
* `nmake`
25+
* `nmake install` (installs OpenSSL inside C:\Program Files\)
2326
* Update PATH environment variable to add the dll for openssl which is inside C:\Program Files\OpenSSL\bin
2427
* Download and install catch2
2528
* Use Visual Studio native tool command prompt in admin mode.
26-
* git clone https://github.com/catchorg/Catch2.git
27-
* cd Catch2
28-
* mkdir build & cd build
29-
* cmake -DBUILD_TESTING=OFF -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ../ ( Install python if you want to execute test )
30-
* nmake & nmake ( install catch2 inside C:\Program Files (x86)\ )
29+
* `git clone https://github.com/catchorg/Catch2.git`
30+
* `cd Catch2`
31+
* `mkdir build`
32+
* `cd build`
33+
* `cmake -DBUILD_TESTING=OFF -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release ../` ( Install python if you want to execute test )
34+
* `nmake`
35+
* `nmake install` ( install catch2 inside C:\Program Files (x86)\ )
3136
* Download and install protobuf
3237
* Download from https://github.com/protocolbuffers/protobuf/releases/download/v3.6.1/protobuf-all-3.6.1.tar.gz
3338
* Extract protobuf-all-3.6.1.tar.gz
3439
* Use Visual Studio native tool command prompt
35-
* cd path/to/protobuf-3.6.1
36-
* cd cmake
37-
* mkdir build & cd build
38-
* cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../
39-
* nmake & nmake install ( install protobuf inside C:\Program Files (x86)\ )
40+
* `cd path/to/protobuf-3.6.1`
41+
* `cd cmake`
42+
* `mkdir build`
43+
* `cd build`
44+
* `cmake -G "NMake Makefiles" -DCMAKE_BUILD_TYPE=Release -Dprotobuf_MSVC_STATIC_RUNTIME=OFF ../`
45+
* `nmake`
46+
* `nmake install` ( install protobuf inside C:\Program Files (x86)\ )
4047
* Download and install boost
4148
* Download from https://dl.bintray.com/boostorg/release/1.69.0/source/boost_1_69_0.tar.gz
4249
* Extract boost_1_69_0.tar.gz
4350
* Use Visual Studio native tool command prompt
44-
* cd path/to/boost_1_69_0
45-
* bootstrap.bat
46-
* .\b2 install ( installs boost inside C:\)
51+
* `cd path/to/boost_1_69_0`
52+
* `bootstrap.bat`
53+
* `.\b2 toolset=msvc address-model={32 | 64} install define=BOOST_WINAPI_VERSION_WIN10` ( installs boost inside C:\)
54+
* Replace `BOOST_WINAPI_VERSION_WIN10` with the appropriate macro from [here](https://www.boost.org/doc/libs/develop/libs/winapi/doc/html/winapi/config.html)
4755
* Download and build aws-iot-securetunneling-localproxy
4856
* Use Visual Studio native tool comand prompt in admin mode
49-
* git clone https://github.com/aws-samples/aws-iot-securetunneling-localproxy.git
50-
* cd aws-iot-securetunneling-localproxy
51-
* Edit CmakeList.txt file to make the following changes:
52-
* Replace set_property(GLOBAL PROPERTY Boost_USE_STATIC_LIBS ON) by set(Boost_USE_STATIC_LIBS ON)
53-
* Comment out line target_link_libraries(\${AWS_TUNNEL_LOCAL_PROXY_TARGET_NAME} atomic) and target_link_libraries(\${AWS_TUNNEL_LOCAL_PROXY_TEST_NAME} atomic) by inserting # infront of those lines.
54-
* Replace the following code block ( Replace WINAPI_VERSION using link https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=vs-2019 ).
55-
```
56-
elseif (WIN32)
57-
set(CUSTOM_COMPILER_FLAGS "/W4 /DYNAMICBASE /NXCOMPAT /analyze")
58-
set(TEST_COMPILER_FLAGS "${CUSTOM_COMPILER_FLAGS} /D_AWSIOT_TUNNELING_NO_SSL")
59-
endif ()
60-
```
61-
With the following code block:
62-
```
63-
elseif (WIN32)
64-
set(CUSTOM_COMPILER_FLAGS "/W4 /DYNAMICBASE /NXCOMPAT /analyze")
65-
set(TEST_COMPILER_FLAGS "${CUSTOM_COMPILER_FLAGS} /D_AWSIOT_TUNNELING_NO_SSL")
66-
add_definitions(-D_WIN32_WINNT=<WINAPI_VERSION>)
67-
add_definitions(-D_BOOST_USE_WINAPI_VERSION=<WINAPI_VERSION>)
68-
endif ()
57+
* `git clone https://github.com/aws-samples/aws-iot-securetunneling-localproxy.git`
58+
* `cd aws-iot-securetunneling-localproxy`
59+
* `mkdir build`
60+
* `cd build`
61+
* Build the cmake project. Replace <_WIN32_WINNT> with the appropriate value based on [your OS from here](https://docs.microsoft.com/en-us/cpp/porting/modifying-winver-and-win32-winnt?view=vs-2019)
62+
* For visual studio 2019
6963
```
70-
* mkdir build & cd build
71-
* cmake -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 15 2017 <Win64/Win32>" ..\
72-
* msbuild localproxy.vcxproj -p:Configuration=Release ( builds localproxy.exe inside bin\Release folder )
64+
cmake -DWIN32_WINNT=<_WIN32_WINNT> -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 16 2019" -A x64 ..\
65+
```
66+
* for visual studio 2017
67+
```
68+
cmake -DWIN32_WINNT=<_WIN32_WINNT> -DBoost_USE_STATIC_LIBS=ON -DCMAKE_PREFIX_PATH="C:\Boost;C:\Program Files (x86)\Catch2;C:\Program Files (x86)\protobuf;C:\Program Files\OpenSSL" -G "Visual Studio 15 2017 <Win64/Win32>" ..\
69+
```
70+
* `msbuild localproxy.vcxproj -p:Configuration=Release` ( builds localproxy.exe inside bin\Release folder )
7371
* Follow [instructions](https://github.com/aws-samples/aws-iot-securetunneling-localproxy) under heading `Security Considerations` to run local proxy on a window OS.

0 commit comments

Comments
 (0)