Skip to content

Commit 8fec96a

Browse files
Add cpp.yml
1 parent fe357b7 commit 8fec96a

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

.github/workflows/cpp.yml

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: cppWorkflow
2+
3+
on:
4+
push:
5+
branches: main
6+
paths:
7+
- 'cpp/**'
8+
- '.github/workflows/cpp.yml'
9+
10+
env:
11+
NUGETTOKEN: ${{ secrets.NUGET_TOKEN }}
12+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
13+
SCRIPTS_BASE_URL: https://raw.githubusercontent.com/linksplatform/Scripts/main/MultiProjectRepository
14+
15+
defaults:
16+
run:
17+
working-directory: cpp
18+
19+
jobs:
20+
test:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v1
24+
with:
25+
submodules: true
26+
- name: Setup clang
27+
uses: egor-tensin/setup-clang@v1
28+
with:
29+
version: 13
30+
platform: x64
31+
- name: Install conan
32+
run: pip install conan
33+
- name: Setup conan
34+
run: |
35+
conan profile new linksplatform --detect
36+
conan profile update settings.compiler=clang linksplatform
37+
conan profile update settings.compiler.version=13 linksplatform
38+
conan profile update settings.compiler.libcxx=libstdc++11 linksplatform
39+
conan profile update env.CXX=clang++ linksplatform
40+
conan profile show linksplatform
41+
- name: Instll conan packages
42+
run: |
43+
if [ -f "install-local-conan-dependencies.sh" ]; then
44+
echo "install-local-conan-dependencies.sh exists."
45+
./install-local-conan-dependencies.sh
46+
fi
47+
- name: Test and scan-build
48+
run: |
49+
CXX=clang++
50+
cmake_flags="-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=clang++ -DLINKS_PLATFORM_TESTS=TRUE"
51+
cmake_build_dir="build"
52+
mkdir $cmake_build_dir && cd $cmake_build_dir
53+
conan install .. -pr=linksplatform --build=missing
54+
cmake .. "$cmake_flags"
55+
cmake --build .
56+
ls
57+
pushToNuget:
58+
runs-on: ubuntu-latest
59+
needs: test
60+
steps:
61+
- uses: actions/checkout@v1
62+
with:
63+
submodules: true
64+
- name: Read package information
65+
run: |
66+
export REPOSITORY_NAME=$(basename ${{ github.repository }})
67+
wget "$SCRIPTS_BASE_URL/read_cpp_package_info.sh"
68+
bash ./read_cpp_package_info.sh
69+
- name: Publish NuGet package
70+
run: |
71+
export REPOSITORY_NAME=$(basename ${{ github.repository }})
72+
wget "$SCRIPTS_BASE_URL/push-cpp-nuget.sh"
73+
bash ./push-cpp-nuget.sh
74+
publiseRelease:
75+
runs-on: ubuntu-latest
76+
needs: test
77+
steps:
78+
- uses: actions/checkout@v1
79+
with:
80+
submodules: true
81+
- name: Read project information
82+
run: |
83+
export REPOSITORY_NAME=$(basename ${{ github.repository }})
84+
wget "$SCRIPTS_BASE_URL/read_cpp_package_info.sh"
85+
bash ./read_cpp_package_info.sh
86+
- name: Publish release
87+
run: |
88+
export REPOSITORY_NAME=$(basename ${{ github.repository }})
89+
wget "$SCRIPTS_BASE_URL/publish-release.sh"
90+
chmod +x ./publish-release.sh
91+
wget "$SCRIPTS_BASE_URL/publish-cpp-release.sh"
92+
bash ./publish-cpp-release.sh

0 commit comments

Comments
 (0)