-
Notifications
You must be signed in to change notification settings - Fork 29
181 lines (150 loc) · 5.75 KB
/
build.yaml
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
name: Build
on: [push]
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
build-type: [Release]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive
- name: Add GCC repository
if: runner.os == 'Linux'
run: |
sudo apt-get install -y software-properties-common
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
- name: Install Linux dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
libx11-dev \
libxcursor-dev \
libxinerama-dev \
libxi-dev \
libxrandr-dev \
libgl1-mesa-dev \
libncurses5 \
gcc-13 g++-13
- name: Install GCC
if: runner.os == 'Linux'
run: |
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-13 100 --slave /usr/bin/g++ g++ /usr/bin/g++-13 --slave /usr/bin/gcov gcov /usr/bin/gcov-13
sudo update-alternatives --set gcc /usr/bin/gcc-13
- name: Install LLVM and Clang
uses: KyleMayes/install-llvm-action@v2
if: runner.os != 'Windows' # Windows uses MSVC
with:
env: true
version: 17
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@master
with:
version: 1.12.1
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: "cd124b84feb0c02a24a2d90981e8358fdee0e077"
- name: Determine CMake Preset
id: select-preset
run: |
if [ "${{ runner.os }}" == "Windows" ]; then
prefix="win"
elif [ "${{ runner.os }}" == "Linux" ]; then
prefix="linux"
elif [ "${{ runner.os }}" == "macOS" ]; then
prefix="mac"
fi
preset="${prefix}-$(echo "${{ matrix.build-type }}" | tr '[:upper:]' '[:lower:]')"
echo "preset=$preset" >> $GITHUB_OUTPUT
shell: bash
- name: Use Developer Command Prompt for Microsoft Visual C++
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: Configure CMake
run: cmake --preset ${{ steps.select-preset.outputs.preset }}
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
- name: Build
run: cmake --build . --preset ${{ steps.select-preset.outputs.preset }} -v
env:
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
- name: Prepare Binaries
id: prep
shell: bash
run: |
# Set up configuration variables
build_dir="bin/${{ matrix.build-type }}"
os="${{ runner.os }}"
build_type="${{ matrix.build-type }}"
arch="$(echo "${{ runner.arch }}" | tr '[:upper:]' '[:lower:]')"
configuration="$os-$build_type-$arch"
cd "$build_dir"
# Determine source and binary names
if [[ "$os" == "Windows" ]]; then
cli_source="blur-cli.exe"
gui_source="blur.exe"
cli_binary="blur-cli-$configuration.exe"
gui_binary="blur-$configuration.exe"
mv "$cli_source" "$cli_binary"
mv "$gui_source" "$gui_binary"
gui_path="$gui_binary"
cli_path="$cli_binary"
elif [[ "$os" == "Linux" ]]; then
cli_source="blur-cli"
gui_source="blur"
cli_binary="blur-cli-$configuration"
gui_binary="blur-$configuration"
mv "$cli_source" "$cli_binary"
tar -cvf "$cli_binary.tar.gz" "$cli_binary"
cli_path="$cli_binary.tar.gz"
mv "$gui_source" "$gui_binary"
tar -cvf "$gui_binary.tar.gz" "$gui_binary"
gui_path="$gui_binary.tar.gz"
elif [[ "$os" == "macOS" ]]; then
cli_source="blur-cli"
gui_source="blur.app"
cli_binary="blur-cli-$configuration"
gui_binary="blur-$configuration.dmg"
mv "$cli_source" "$cli_binary"
tar -cvf "$cli_binary.tar.gz" "$cli_binary"
cli_path="$cli_binary.tar.gz"
brew install create-dmg
mkdir source_folder
mv "$gui_source" source_folder
create-dmg \
--volname "Blur Installer" \
--window-pos 200 120 \
--window-size 600 400 \
--icon-size 100 \
--icon "Blur.app" 175 120 \
--hide-extension "Blur.app" \
--app-drop-link 425 120 \
"$gui_binary" \
"source_folder"
gui_path="$gui_binary"
fi
# Output for subsequent steps
echo "build_dir=$build_dir" >> $GITHUB_OUTPUT
echo "cli_path=$cli_path" >> $GITHUB_OUTPUT
echo "gui_path=$gui_path" >> $GITHUB_OUTPUT
echo "configuration=$configuration" >> $GITHUB_OUTPUT
- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Blur-${{ steps.prep.outputs.configuration }}
path: |
${{ steps.prep.outputs.build_dir }}/${{ steps.prep.outputs.cli_path }}
${{ steps.prep.outputs.build_dir }}/${{ steps.prep.outputs.gui_path }}
- name: Release
uses: softprops/action-gh-release@v1
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags/') }}
with:
files: |
${{ steps.prep.outputs.build_dir }}/${{ steps.prep.outputs.cli_path }}
${{ steps.prep.outputs.build_dir }}/${{ steps.prep.outputs.gui_path }}