v1.2.2 #24
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |