-
Notifications
You must be signed in to change notification settings - Fork 1
193 lines (165 loc) · 5.56 KB
/
Copy pathbuild.yml
File metadata and controls
193 lines (165 loc) · 5.56 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
name: Build Unity WakaTime
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
release:
types: [ published ]
env:
BUILD_TYPE: Release
jobs:
build-test:
name: Build Test (Push & PR)
runs-on: windows-latest
if: (github.event_name == 'push' && github.ref_type == 'branch') || github.event_name == 'pull_request'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup MinGW with Ninja
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.27'
- name: Verify Build Environment
shell: msys2 {0}
run: |
echo "🔍 Verifying Ninja build environment..."
echo "CMake version:"
cmake --version
echo "GCC version:"
gcc --version
echo "Ninja version:"
ninja --version
echo "Build type: $BUILD_TYPE"
- name: Configure CMake (Ninja)
shell: msys2 {0}
run: |
echo "⚙️ Configuring CMake with Ninja generator..."
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON \
-DCMAKE_VERBOSE_MAKEFILE=ON
- name: Copy Resources
shell: msys2 {0}
run: |
echo "📁 Copying resources..."
cp logo_32.png build/
- name: Build with Ninja (Test)
shell: msys2 {0}
run: |
echo "🥷 Building with Ninja (Test Build)..."
cmake --build build --config $BUILD_TYPE --parallel $(nproc)
- name: Verify Build Success
shell: msys2 {0}
run: |
echo "✅ Ninja build test completed!"
if [ -f "build/unity_wakatime.exe" ]; then
echo "📦 Executable created: $(stat -c%s build/unity_wakatime.exe) bytes"
echo "🥷 Ninja build test passed - ready for production!"
else
echo "❌ Ninja build test failed!"
exit 1
fi
build-release:
name: Production Build
runs-on: windows-latest
if: github.event_name == 'release'
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Extract Version
shell: bash
run: |
if [ "${{ github.event_name }}" = "release" ]; then
VERSION="${{ github.event.release.tag_name }}"
else
VERSION="${{ github.ref_name }}"
fi
VERSION=${VERSION#v}
echo "RELEASE_VERSION=$VERSION" >> $GITHUB_ENV
echo "📌 Release Version: $VERSION"
- name: Setup MinGW with Ninja
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
update: true
install: >-
mingw-w64-x86_64-gcc
mingw-w64-x86_64-cmake
mingw-w64-x86_64-ninja
mingw-w64-x86_64-7zip
- name: Setup CMake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.27'
- name: Configure CMake (Production)
shell: msys2 {0}
run: |
echo "⚙️ Configuring CMake with Ninja for production..."
cmake -B build -G Ninja \
-DCMAKE_BUILD_TYPE=$BUILD_TYPE \
-DCMAKE_CXX_STANDARD=17 \
-DCMAKE_CXX_STANDARD_REQUIRED=ON
- name: Copy Resources for Release
shell: msys2 {0}
run: |
echo "📁 Copying resources for release..."
cp logo_32.png build/
- name: Build Production Release (Ninja)
shell: msys2 {0}
run: |
echo "🥷 Building Unity WakaTime with Ninja v${{ env.RELEASE_VERSION }}..."
cmake --build build --config $BUILD_TYPE --parallel $(nproc)
- name: Verify Production Build
shell: msys2 {0}
run: |
if [ -f "build/unity_wakatime.exe" ]; then
echo "✅ Ninja production build successful!"
echo "📦 Final executable size: $(stat -c%s build/unity_wakatime.exe) bytes"
else
echo "❌ Ninja production build failed!"
exit 1
fi
- name: Create Release Package
shell: msys2 {0}
run: |
PACKAGE_NAME="Unity-Wakatime_v${{ env.RELEASE_VERSION }}"
echo "📦 Creating release package: $PACKAGE_NAME"
mkdir -p "release-package/$PACKAGE_NAME"
cp build/unity_wakatime.exe "release-package/$PACKAGE_NAME/"
cp build/logo_32.png "release-package/$PACKAGE_NAME/"
[ -f README.md ] && cp README.md "release-package/$PACKAGE_NAME/" || echo "README.md not found"
[ -f LICENSE ] && cp LICENSE "release-package/$PACKAGE_NAME/" || echo "LICENSE not found"
echo "📋 Release package contents:"
ls -la "release-package/$PACKAGE_NAME/"
echo "PACKAGE_NAME=$PACKAGE_NAME" >> $GITHUB_ENV
- name: Create ZIP Archive
shell: msys2 {0}
run: |
cd release-package
echo "🗜️ Creating ZIP archive: ${{ env.PACKAGE_NAME }}.zip"
7z a "${{ env.PACKAGE_NAME }}.zip" "${{ env.PACKAGE_NAME }}/"
echo "✅ ZIP archive created with Ninja build"
ls -lh "${{ env.PACKAGE_NAME }}.zip"
- name: Upload Release Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.PACKAGE_NAME }}
path: release-package/${{ env.PACKAGE_NAME }}/
retention-days: 90
- name: Upload ZIP to Release
uses: softprops/action-gh-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: release-package/${{ env.PACKAGE_NAME }}.zip