forked from trojan-gfw/trojan
-
Notifications
You must be signed in to change notification settings - Fork 0
/
azure-pipelines.yml
138 lines (127 loc) · 4.43 KB
/
azure-pipelines.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
stages:
- stage: Build
jobs:
- job: Linux
pool:
vmImage: ubuntu-latest
container:
image: trojangfw/centos-build:latest
steps:
- script: |
set -euo pipefail
echo 'target_link_libraries(trojan dl)' >> CMakeLists.txt
cmake -DMYSQL_INCLUDE_DIR=/usr/local/include/mariadb -DMYSQL_LIBRARY=/usr/local/lib/mariadb/libmysqlclient.a -DDEFAULT_CONFIG=config.json -DFORCE_TCP_FASTOPEN=ON -DBoost_USE_STATIC_LIBS=ON .
make
strip -s trojan
- publish: $(System.DefaultWorkingDirectory)/trojan
artifact: LinuxBinary
- job: macOS
pool:
vmImage: macOS-latest
steps:
- script: |
set -euo pipefail
brew install boost [email protected]
cmake -DBoost_USE_STATIC_LIBS=ON -DOPENSSL_INCLUDE_DIR=/usr/local/opt/[email protected]/include -DOPENSSL_CRYPTO_LIBRARY=/usr/local/opt/[email protected]/lib/libcrypto.a -DOPENSSL_SSL_LIBRARY=/usr/local/opt/[email protected]/lib/libssl.a -DDEFAULT_CONFIG=config.json -DENABLE_MYSQL=OFF .
make
strip -SXTx trojan
- publish: $(System.DefaultWorkingDirectory)/trojan
artifact: macOSBinary
- job: Windows
pool:
vmImage: windows-latest
steps:
- bash: |
set -euo pipefail
curl -LO https://slproweb.com/download/Win64OpenSSL-1_1_1d.exe
powershell ".\\Win64OpenSSL-1_1_1d.exe /silent /sp- /suppressmsgboxes /DIR='C:\\Program Files\\OpenSSL-Win64'"
cmake -DBoost_USE_STATIC_LIBS=ON -DOPENSSL_ROOT_DIR='C:/Program Files/OpenSSL-Win64' -DOPENSSL_USE_STATIC_LIBS=ON -DENABLE_MYSQL=OFF .
cmake --build . --config Release
- publish: $(System.DefaultWorkingDirectory)/Release/trojan.exe
artifact: WindowsBinary
- stage: Test
jobs:
- job: Linux
pool:
vmImage: ubuntu-latest
steps:
- download: current
artifact: LinuxBinary
- script: |
set -uo pipefail
BINARY="$PIPELINE_WORKSPACE/LinuxBinary/trojan"
chmod +x "$BINARY"
mkdir results
cp -r "$(tests/LinuxSmokeTest/basic.sh "$BINARY")" results/basic
cp -r "$(tests/LinuxSmokeTest/fake-client.sh "$BINARY")" results/fake-client
env:
PIPELINE_WORKSPACE: $(Pipeline.Workspace)
- publish: $(System.DefaultWorkingDirectory)/results
artifact: LinuxTest
- stage: Package
jobs:
- job: Linux
pool:
vmImage: ubuntu-latest
steps:
- download: current
artifact: LinuxBinary
- script: |
set -euo pipefail
BINARY="$PIPELINE_WORKSPACE/LinuxBinary/trojan"
chmod +x "$BINARY"
mkdir trojan
cp "$BINARY" trojan/trojan
cp -r examples CONTRIBUTORS.md LICENSE README.md trojan
cp examples/server.json-example trojan/config.json
tar cf trojan-linux-amd64.tar trojan
xz trojan-linux-amd64.tar
env:
PIPELINE_WORKSPACE: $(Pipeline.Workspace)
- publish: $(System.DefaultWorkingDirectory)/trojan-linux-amd64.tar.xz
artifact: LinuxRelease
- job: macOS
pool:
vmImage: macOS-latest
steps:
- download: current
artifact: macOSBinary
- script: |
set -euo pipefail
BINARY="$PIPELINE_WORKSPACE/macOSBinary/trojan"
chmod +x "$BINARY"
mkdir trojan
cp "$BINARY" trojan/trojan
cp -r examples CONTRIBUTORS.md LICENSE README.md trojan
cp examples/client.json-example trojan/config.json
rm trojan/examples/nat.json-example trojan/examples/trojan.service-example
cat > trojan/start.command <<EOF
#!/bin/sh
cd "\$(dirname "\$0")"
./trojan
EOF
chmod +x trojan/start.command
zip -r9 trojan-macos.zip trojan
env:
PIPELINE_WORKSPACE: $(Pipeline.Workspace)
- publish: $(System.DefaultWorkingDirectory)/trojan-macos.zip
artifact: macOSRelease
- job: Windows
pool:
vmImage: windows-latest
steps:
- download: current
artifact: WindowsBinary
- bash: |
set -euo pipefail
BINARY="$PIPELINE_WORKSPACE/WindowsBinary/trojan.exe"
mkdir trojan
cp "$BINARY" trojan/trojan.exe
cp -r examples CONTRIBUTORS.md LICENSE README.md trojan
cp examples/client.json-example trojan/config.json
rm trojan/examples/nat.json-example trojan/examples/trojan.service-example
7z a -mx=9 trojan-win.zip trojan
env:
PIPELINE_WORKSPACE: $(Pipeline.Workspace)
- publish: $(System.DefaultWorkingDirectory)/trojan-win.zip
artifact: WindowsRelease