1- name : CMake Multi-Platform CI
1+ name : Package
22
33on :
44 push :
5- branches : ["main", "master"]
6- tags :
7- - ' v*'
5+ branches : [main, master]
6+ tags : ["v*"]
87 pull_request :
9- branches : [" main", " master" ]
8+ branches : [main, master]
109
1110jobs :
12- build :
11+ package :
12+ name : Package for ${{ matrix.os }}
1313 runs-on : ${{ matrix.os }}
1414 strategy :
1515 fail-fast : false
1616 matrix :
17- os : [ubuntu-latest, windows-latest]
18- build_type : [Release]
19- include :
20- - os : windows-latest
21- c_compiler : cl
22- cpp_compiler : cl
23- generator : " Visual Studio 17 2022"
24- is_windows : true
25- - os : ubuntu-latest
26- c_compiler : gcc
27- cpp_compiler : g++
28- generator : " Unix Makefiles"
29- is_windows : false
30- - os : ubuntu-latest
31- c_compiler : clang
32- cpp_compiler : clang++
33- generator : " Unix Makefiles"
34- is_windows : false
17+ os : [ubuntu-22.04, windows-2022]
3518
3619 steps :
3720 - uses : actions/checkout@v4
3821 with :
3922 submodules : " recursive"
4023
41- - name : Setup Linux Dependencies
42- if : matrix.is_windows == false
24+ - name : Install dependencies (Ubuntu)
25+ if : runner.os == 'Linux'
4326 run : |
4427 sudo apt-get update
45- sudo apt-get install -y build-essential cmake clang rpm
28+ sudo apt-get install -y build-essential cmake rpm dpkg
29+ timeout-minutes : 5
4630
47- - name : Setup Windows Dependencies
48- if : matrix.is_windows
31+ - name : Install NSIS (Windows)
32+ if : runner.os == 'Windows'
4933 run : |
5034 choco install nsis
35+ timeout-minutes : 5
5136
52- - name : Configure CMake (Windows)
53- if : matrix.is_windows
54- shell : cmd
37+ - name : Configure CMake
5538 run : |
56- cmake -B build ^
57- -G "${{ matrix.generator }}" ^
58- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ^
59- -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} ^
60- -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
39+ cmake -B build -DCMAKE_BUILD_TYPE=Release --log-level=VERBOSE
40+ timeout-minutes : 10
6141
62- - name : Configure CMake (Linux)
63- if : matrix.is_windows == false
64- shell : bash
65- run : |
66- cmake -B build \
67- -G "${{ matrix.generator }}" \
68- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
69- -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} \
70- -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} \
71- -DCMAKE_POSITION_INDEPENDENT_CODE=ON \
72- -DCMAKE_CXX_FLAGS="-fPIC -fms-extensions" \
73- -Dstrdup=_strdup
74-
75- - name : Build (Windows)
76- if : matrix.is_windows
77- shell : cmd
78- run : |
79- cmake --build build --config ${{ matrix.build_type }} --parallel
80-
81- - name : Build (Linux)
82- if : matrix.is_windows == false
83- shell : bash
42+ - name : Build
8443 run : |
85- cmake --build build --config ${{ matrix.build_type }} --parallel
44+ cmake --build build --config Release --verbose
45+ timeout-minutes : 20
8646
87- - name : Package (Windows)
88- if : matrix.is_windows
89- working-directory : build
90- shell : cmd
47+ - name : Package (with libs)
9148 run : |
49+ cd build
9250 cpack -C applications
51+ timeout-minutes : 10
9352
94- - name : Package (Linux)
95- if : matrix.is_windows == false
96- working-directory : build
97- shell : bash
53+ - name : List generated packages (with libs)
9854 run : |
99- cpack -C applications
55+ ls -la build/
56+ shell : bash
10057
101- - name : Upload Packages
58+ - name : Upload artifacts (with libs)
10259 uses : actions/upload-artifact@v4
10360 with :
104- name : packages-${{ matrix.os }}-${{ matrix.cpp_compiler }}
105- path : build/Astra-CacheServer-*
61+ name : astra-cache-server-${{ matrix.os }}-with-libs
62+ path : |
63+ build/*.tar.gz
64+ build/*.zip
65+ build/*.deb
66+ build/*.rpm
67+ build/*.exe
68+
69+ release :
70+ name : Create Release
71+ needs : [package]
72+ if : startsWith(github.ref, 'refs/tags/v')
73+ runs-on : ubuntu-22.04
74+ permissions :
75+ contents : write
76+ steps :
77+ - name : Checkout code
78+ uses : actions/checkout@v4
79+
80+ - name : Download artifacts
81+ uses : actions/download-artifact@v4
82+
83+ - name : Display structure of downloaded files
84+ run : ls -R
85+
86+ - name : Create Release
87+ uses : softprops/action-gh-release@v1
88+ with :
89+ files : |
90+ astra-cache-server-*/*.tar.gz
91+ astra-cache-server-*/*.zip
92+ astra-cache-server-*/*.deb
93+ astra-cache-server-*/*.rpm
94+ astra-cache-server-*/*.exe
95+ env :
96+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments