-
Notifications
You must be signed in to change notification settings - Fork 0
executable file
·166 lines (152 loc) · 4.96 KB
/
cmake-multi-platform.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
name: Build and Release
on:
push:
branches: [main, dev]
pull_request:
branches: [main]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
include:
- os: ubuntu-latest
artifact_extension: tar.gz
- os: macos-latest
artifact_extension: zip
- os: windows-latest
artifact_extension: zip
steps:
# Step 1: Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# Ubuntu
- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y ninja-build \
qt6-base-dev qt6-tools-dev qt6-tools-dev-tools \
qt6-l10n-tools libgl1-mesa-dev libglu1-mesa-dev rsync
- name: Configure CMake (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -G "Ninja" -S .
- name: Build Notepad-- (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: cmake --build build --config Release
- name: Package Notepad-- (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
mkdir -p artifacts
tar -czvf artifacts/Notepad--_ubuntu.tar.gz -C build .
echo "Packaging completed. Listing artifacts:"
ls -al artifacts
# macOS
- name: Install dependencies (macOS)
if: matrix.os == 'macos-latest'
run: |
brew install ninja qt
- name: Configure CMake (macOS)
if: matrix.os == 'macos-latest'
run: |
cmake -B build -DCMAKE_BUILD_TYPE=Release -G "Ninja" -S .
- name: Build Notepad-- (macOS)
if: matrix.os == 'macos-latest'
run: cmake --build build --config Release
- name: Package Notepad-- (macOS)
if: matrix.os == 'macos-latest'
run: |
mkdir -p artifacts
zip -r artifacts/Notepad--_macos.zip build
echo "Packaging completed. Listing artifacts:"
ls -al artifacts
# Windows
- name: Install dependencies (Windows)
if: matrix.os == 'windows-latest'
run: |
choco install ninja -y
choco install cmake --installargs 'ADD_CMAKE_TO_PATH=System' -y
choco install mingw -y
shell: cmd
- name: Install Qt (Windows)
if: matrix.os == 'windows-latest'
uses: jurplel/install-qt-action@v4
with:
version: '6.5.3'
host: 'windows'
target: 'desktop'
arch: 'win64_mingw'
- name: Configure CMake (Windows)
if: matrix.os == 'windows-latest'
run: |
cmake -B build ^
-DCMAKE_BUILD_TYPE=Release ^
-G Ninja ^
-DCMAKE_PREFIX_PATH=D:\\a\\Notepad--\\Qt\\6.5.3\\mingw_64 ^
-S .
shell: cmd
- name: Build Notepad-- (Windows)
if: matrix.os == 'windows-latest'
run: cmake --build build --config Release
shell: cmd
- name: Package Notepad-- (Windows)
if: matrix.os == 'windows-latest'
run: |
mkdir artifacts
Compress-Archive -Path build\\* -DestinationPath artifacts\\Notepad--_windows.zip
echo "Packaging completed. Listing artifacts:"
Get-ChildItem artifacts
shell: pwsh
# Upload artifacts for all OSes
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Notepad--_artifacts_${{ matrix.os }}
path: artifacts/*
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Generate Tag Name
id: tag_name
run: |
TIMESTAMP=$(date +%Y%m%d%H%M%S)
echo "RELEASE_TAG=release-$TIMESTAMP" >> $GITHUB_ENV
echo "::set-output name=tag_name::release-$TIMESTAMP"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ env.RELEASE_TAG }}
release_name: Notepad-- Release
draft: false
prerelease: false
# Attach artifacts to release
- name: Upload Ubuntu Artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/Notepad--_ubuntu.tar.gz
asset_name: Notepad--_ubuntu.tar.gz
asset_content_type: application/gzip
- name: Upload macOS Artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/Notepad--_macos.zip
asset_name: Notepad--_macos.zip
asset_content_type: application/zip
- name: Upload Windows Artifact
uses: actions/upload-release-asset@v1
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: artifacts/Notepad--_windows.zip
asset_name: Notepad--_windows.zip
asset_content_type: application/zip