-
Notifications
You must be signed in to change notification settings - Fork 1
214 lines (211 loc) · 8.11 KB
/
CD.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
202
203
204
205
206
207
208
209
210
211
212
213
214
name: CD
on:
push:
branches: main
env:
NUGETTOKEN: ${{ secrets.NUGET_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SCRIPTS_BASE_URL: https://raw.githubusercontent.com/linksplatform/Scripts/main/MultiProjectRepository
jobs:
findCppDirectory:
runs-on: ubuntu-latest
outputs:
isCppDirectoryFound: ${{steps.findCppDirectory.outputs.isCppDirectoryFound}}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Find cpp directory
id: findCppDirectory
run: |
if [ -d "cpp" ]
then
echo "Directory cpp exists."
echo "::set-output name=isCppDirectoryFound::true"
else
echo "Directory cpp does not exists."
echo "::set-output name=isCppDirectoryFound::false"
fi
testCpp:
runs-on: ubuntu-latest
needs: findCppDirectory
if: needs.findCppDirectory.outputs.isCppDirectoryFound == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Install conan
run: pip install conan
- name: Setup conan
run: |
conan profile new linksplatform --detect
conan profile update settings.compiler=clang linksplatform
conan profile update settings.compiler.version=13 linksplatform
conan profile update settings.compiler.libcxx=libstdc++11 linksplatform
conan profile update env.CXX=clang++ linksplatform
conan profile show linksplatform
- name: Instll conan packages
run: |
git clone https://github.com/linksplatform/conan-center-index
cd conan-center-index && git checkout only-development && cd recipes
conan create platform.interfaces/0.2.0+ platform.interfaces/0.2.5@ -pr=linksplatform
conan create platform.ranges/all platform.ranges/0.1.3@ -pr=linksplatform
conan create platform.random/all platform.random/0.1.0@ -pr=linksplatform
conan create platform.collections/all platform.collections/0.1.0@ -pr=linksplatform
conan create platform.collections.methods/all platform.collections.methods/0.1.0@ -pr=linksplatform
conan create platform.converters/all platform.converters/0.1.0@ -pr=linksplatform
conan create platform.threading/all platform.threading/0.1.0@ -pr=linksplatform
conan create platform.memory/all platform.memory/0.1.0@ -pr=linksplatform
conan create platform.data/all platform.data/0.1.0@ -pr=linksplatform
conan create platform.delegates/all platform.delegates/0.1.3@ -pr=linksplatform
conan create platform.setters/all platform.setters/0.0.1@ -pr=linksplatform
conan create platform.equality/all platform.equality/0.0.1@ -pr=linksplatform
conan create platform.exceptions/all platform.exceptions/0.2.0@ -pr=linksplatform
conan create platform.hashing/all platform.hashing/0.2.0@ -pr=linksplatform
- name: Test C++ and scan-build
run: |
$CXX=clang++
$cmake_flags="-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DLINKS_PLATFORM_TESTS=TRUE"
$cmake_build_dir="build"
cd cpp && mkdir $cmake_build_dir && cd $cmake_build_dir
conan install $pwd/.. -pr=linksplatform --build=missing
cmake .. $cmake_flags
cmake --build .
ls
findCsharpDirectory:
runs-on: ubuntu-latest
outputs:
isCsharpDirectoryFound: ${{steps.findCsharpDirectory.outputs.isCsharpDirectoryFound}}
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Find csharp directory
id: findCsharpDirectory
run: |
if [ -d "csharp" ]
then
echo "Directory csharp exists."
echo "::set-output name=isCsharpDirectoryFound::true"
else
echo "Directory csharp does not exists."
echo "::set-output name=isCsharpDirectoryFound::false"
fi
testCs:
runs-on: ubuntu-latest
needs: findCsharpDirectory
if: needs.findCsharpDirectory.outputs.isCsharpDirectoryFound == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Test C#
run: |
dotnet test -c Release -f net6
deployCpp:
runs-on: ubuntu-latest
needs: testCpp
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Read Cpp package information
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/read_cpp_package_info.sh"
bash ./read_cpp_package_info.sh
- name: Publish Cpp NuGet package
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/push-cpp-nuget.sh"
bash ./push-cpp-nuget.sh
deployCs:
runs-on: ubuntu-latest
needs: testCs
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Read CSharp project information
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/read_csharp_package_info.sh"
bash ./read_csharp_package_info.sh
- name: Publish CSharp NuGet package
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/push-csharp-nuget.sh"
bash ./push-csharp-nuget.sh
publiseRelease:
runs-on: ubuntu-latest
needs: [deployCpp, deployCs]
if: ((needs.deployCpp.result == 'skipped' && needs.deployCs.result != 'skipped') || (needs.deployCpp.result != 'skipped' && needs.deployCs.result == 'skipped')) && !failure() && !cancelled()
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Publish release
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/publish-release.sh"
bash ./publish-release.sh
pushCSharpNuGetToGitHubPackageRegistry:
needs: publiseRelease
runs-on: windows-latest
steps:
- uses: actions/checkout@v1
with:
submodules: true
- uses: nuget/setup-nuget@v1
- name: Publish CSharp NuGet to GitHub Package Registry
run: |
dotnet build -c Release
dotnet pack -c Release
nuget source Add -Name "GitHub" -Source "https://nuget.pkg.github.com/linksplatform/index.json" -UserName linksplatform -Password ${{ secrets.GITHUB_TOKEN }}
nuget push **/*.nupkg -Source "GitHub" -SkipDuplicate
findChangedCsFiles:
runs-on: ubuntu-latest
needs: publiseRelease
outputs:
isCsFilesChanged: steps.check_if_csharp_files_changed.outputs.findChangesCsFiles
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Check if cs files are changed
uses: tj-actions/[email protected]
id: findChangesCsFiles
with:
files: |
*.cs
generatePdfWithCsharpCode:
runs-on: ubuntu-latest
needs: [testCs, publiseRelease, findChangedCsFiles]
if: needs.findChangedCsFiles.outputs.isCsFilesChanged == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Generate PDF with CSharp code
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/format-csharp-files.py"
wget "$SCRIPTS_BASE_URL/format-csharp-document.sh"
wget "$SCRIPTS_BASE_URL/generate-csharp-pdf.sh"
bash ./generate-csharp-pdf.sh
publishCsDocumentation:
runs-on: ubuntu-latest
needs: [testCs, publiseRelease, findChangedCsFiles]
if: needs.findChangedCsFiles.outputs.isCsFilesChanged == 'true'
steps:
- uses: actions/checkout@v1
with:
submodules: true
- name: Publish CSharp documentation to gh-pages branch
run: |
export REPOSITORY_NAME=$(basename ${{ github.repository }})
wget "$SCRIPTS_BASE_URL/docfx.json"
wget "$SCRIPTS_BASE_URL/filter.yml"
wget "$SCRIPTS_BASE_URL/toc.yml"
wget "$SCRIPTS_BASE_URL/publish-csharp-docs.sh"
bash ./publish-csharp-docs.sh