@@ -2,13 +2,12 @@ name: Build and Release
22
33on :
44 push :
5- branches : [ main, develop ]
6- tags :
7- - ' v*'
8- pull_request :
9- branches : [ main, develop ]
5+ tags : [ 'v*' ]
106 workflow_dispatch :
117
8+ permissions :
9+ contents : write
10+
1211env :
1312 CMAKE_VERSION : " 3.28.0"
1413 QT_VERSION : " 6.9.3"
@@ -19,194 +18,137 @@ jobs:
1918 fail-fast : false
2019 matrix :
2120 include :
22- # Windows MSVC builds
2321 - name : " Windows MSVC 2022 x64"
2422 os : windows-2022
2523 preset : " windows-msvc-x64-release"
26- cmake_generator : " Visual Studio 17 2022"
27- cmake_platform : " x64"
24+ generator : " Visual Studio 17 2022"
25+ platform : " x64"
2826 qt_arch : " win64_msvc2022_64"
2927 artifact_prefix : " windows-msvc-x64"
3028
31- # macOS builds
3229 - name : " macOS x86_64 (Intel)"
3330 os : macos-13
3431 preset : " macos-x64-release"
35- cmake_generator : " Ninja"
36- cmake_build_type : " Release"
32+ generator : " Ninja"
33+ build_type : " Release"
3734 qt_arch : " clang_64"
3835 artifact_prefix : " macos-x64"
3936
40- # Linux builds
4137 - name : " Linux x64"
4238 os : ubuntu-22.04
4339 preset : " linux-x64-release"
44- cmake_generator : " Ninja"
45- cmake_build_type : " Release"
40+ generator : " Ninja"
41+ build_type : " Release"
4642 qt_arch : " linux_gcc_64"
4743 artifact_prefix : " linux-x64"
4844
49- # ARM Linux builds
50- - name : " ARM Linux (aarch64)"
51- os : ubuntu-22.04
52- preset : " linux-arm64-release"
53- cmake_generator : " Ninja"
54- cmake_build_type : " Release"
55- qt_arch : " linux_gcc_arm64"
56- artifact_prefix : " linux-arm64"
57-
5845 runs-on : ${{ matrix.os }}
5946 name : ${{ matrix.name }}
6047
6148 steps :
62- - name : Checkout code
49+ - name : Checkout repository
6350 uses : actions/checkout@v4
6451 with :
6552 fetch-depth : 0
6653
67- - name : Install Qt (Windows)
54+ # Dependencies
55+ - name : Install dependencies
56+ run : |
57+ if [ "${{ runner.os }}" == "Linux" ]; then
58+ sudo apt-get update
59+ sudo apt-get install -y ninja-build cmake build-essential libgl1-mesa-dev libglu1-mesa-dev libegl1-mesa-dev qt6-base-dev qt6-base-dev-tools
60+ elif [ "${{ runner.os }}" == "macOS" ]; then
61+ brew install ninja cmake
62+ fi
63+ shell : bash
64+
65+ - name : Install dependencies (Windows)
6866 if : runner.os == 'Windows'
69- uses : jurplel/install-qt-action@v4
70- with :
71- version : ${{ env.QT_VERSION }}
72- arch : ${{ matrix.qt_arch }}
73- cache : ' true'
67+ run : choco install ninja cmake -y
7468
75- - name : Install Qt (macOS)
76- if : runner.os == 'macOS'
69+ # Qt setup
70+ - name : Install Qt (Windows/macOS)
71+ if : runner.os != 'Linux'
7772 uses : jurplel/install-qt-action@v4
7873 with :
7974 version : ${{ env.QT_VERSION }}
8075 arch : ${{ matrix.qt_arch }}
81- cache : ' true'
82-
83- - name : Install Qt (Linux)
84- if : runner.os == 'Linux'
85- run : |
86- sudo apt-get update
87- sudo apt-get install -y qt6-base-dev qt6-base-dev-tools
88-
89- - name : Install dependencies (Windows)
90- if : runner.os == 'Windows'
91- run : |
92- choco install ninja cmake -y
93-
94- - name : Install dependencies (macOS)
95- if : runner.os == 'macOS'
96- run : |
97- brew install ninja cmake
98-
99- - name : Install dependencies (Linux)
100- if : runner.os == 'Linux'
101- run : |
102- sudo apt-get update
103- sudo apt-get install -y ninja-build cmake build-essential libgl1-mesa-dev libglu1-mesa-dev libegl1-mesa-dev
104-
105- - name : Create build directory
106- run : cmake -E make_directory ${{ github.workspace }}/build
76+ cache : true
10777
108- - name : Configure CMake (Windows)
109- if : runner.os == 'Windows'
110- shell : cmd
78+ # 🏗Build
79+ - name : Configure CMake
11180 run : |
112- cd ${{ github.workspace }}/build
113- cmake -G "${{ matrix.cmake_generator }}" ^
114- -A ${{ matrix.cmake_platform }} ^
115- -DCMAKE_BUILD_TYPE=Release ^
116- -DBUILD_EXAMPLES=ON ^
117- -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" ^
118- ..
119-
120- - name : Configure CMake (non-Windows)
121- if : runner.os != 'Windows'
122- run : |
123- cd ${{ github.workspace }}/build
124- cmake -G "${{ matrix.cmake_generator }}" \
125- -DCMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
126- -DBUILD_EXAMPLES=ON \
127- -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
128- ..
81+ cmake -E make_directory build
82+ cd build
83+ if [ "${{ runner.os }}" == "Windows" ]; then
84+ cmake -G "${{ matrix.generator }}" -A ${{ matrix.platform }} \
85+ -DCMAKE_BUILD_TYPE=Release \
86+ -DBUILD_EXAMPLES=ON \
87+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
88+ ..
89+ else
90+ cmake -G "${{ matrix.generator }}" \
91+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
92+ -DBUILD_EXAMPLES=ON \
93+ -DCMAKE_INSTALL_PREFIX="${{ github.workspace }}/install" \
94+ ..
95+ fi
96+ shell : bash
12997
13098 - name : Build
131- run : cmake --build ${{ github.workspace }}/ build --config Release --parallel
99+ run : cmake --build build --config Release --parallel
132100
133101 - name : Install
134- run : cmake --install ${{ github.workspace }}/build --config Release
135-
136- - name : Create package (Windows)
137- if : runner.os == 'Windows'
138- shell : cmd
139- run : |
140- cd ${{ github.workspace }}/build
141- cpack -C Release -G NSIS
102+ run : cmake --install build --config Release
142103
143- - name : Create package (macOS)
144- if : runner.os == 'macOS'
104+ # Packaging
105+ - name : Package artifacts
145106 run : |
146- cd ${{ github.workspace }}/build
147- cpack -C Release -G DragNDrop
148- cpack -C Release -G TGZ
149-
150- - name : Create package (Linux)
151- if : runner.os == 'Linux'
152- run : |
153- cd ${{ github.workspace }}/build
154- cpack -C Release -G DEB
155- cpack -C Release -G RPM
156- cpack -C Release -G TGZ
157-
158- - name : Upload artifacts
107+ cd build
108+ case "${{ runner.os }}" in
109+ Windows)
110+ cpack -C Release -G NSIS
111+ ;;
112+ macOS)
113+ cpack -C Release -G DragNDrop
114+ cpack -C Release -G TGZ
115+ ;;
116+ Linux)
117+ cpack -C Release -G DEB
118+ cpack -C Release -G RPM
119+ cpack -C Release -G TGZ
120+ ;;
121+ esac
122+ shell : bash
123+
124+ # Upload packages
125+ - name : Upload build artifacts
159126 uses : actions/upload-artifact@v4
160127 with :
161128 name : ${{ matrix.artifact_prefix }}-packages
162- path : ${{ github.workspace }}/build/QTradingView-*
163- retention-days : 30
164-
165- - name : Generate checksums (Windows)
166- if : runner.os == 'Windows'
167- shell : pwsh
168- run : |
169- Get-ChildItem -File "QTradingView-*" | ForEach-Object {
170- Get-FileHash $_.FullName -Algorithm SHA256 |
171- ForEach-Object { $_.Hash | Out-File ($_.Path + ".sha256") -Encoding ascii }
172- }
173-
174- - name : Generate checksums (Linux/macOS)
175- if : runner.os != 'Windows'
176- run : |
177- cd ${{ github.workspace }}/build
178- find . -maxdepth 1 -name "QTradingView-*" -type f -exec sh -c 'sha256sum "$1" > "$1.sha256"' _ {} \;
179-
180-
181- - name : Upload checksums
182- # if: startsWith(github.ref, 'refs/tags/')
183- uses : actions/upload-artifact@v4
184- with :
185- name : ${{ matrix.artifact_prefix }}-checksums
186- path : ${{ github.workspace }}/build/*.sha256
129+ path : build/QTradingView-*
187130 retention-days : 30
188131
189132 release :
190133 needs : build
191134 runs-on : ubuntu-latest
192- # if: startsWith(github.ref, 'refs/tags/')
193- name : Create Release
135+ name : Create GitHub Release
136+ if : startsWith(github.ref, 'refs/tags/')
194137
195138 steps :
196- - name : Checkout code
139+ - name : Checkout repository
197140 uses : actions/checkout@v4
198141
199142 - name : Download all artifacts
200143 uses : actions/download-artifact@v4
201144 with :
202145 path : artifacts
203146
204- - name : Create Release
205- uses : softprops/action-gh-release@v1
147+ - name : Create GitHub Release
148+ uses : softprops/action-gh-release@v2
206149 with :
207150 draft : false
208151 prerelease : false
209- generate_release_notes : true
210152 files : artifacts/**/*
211153 env :
212154 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments