🐍 Refresh PDCursesMod #8
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: 🐍 Refresh PDCursesMod | |
| on: | |
| workflow_dispatch: | |
| schedule: | |
| - cron: "0 9 1 1-12 *" | |
| jobs: | |
| ubuntu: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| arch: x64 | |
| - os: ubuntu-24.04-arm | |
| arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| name: 🐧 Ubuntu (${{ matrix.arch }}) | |
| steps: | |
| - name: ☁️ Clone repository | |
| id: checkout-repository | |
| uses: actions/checkout@master | |
| with: | |
| repository: Bill-Gray/PDCursesMod | |
| ref: refs/heads/master | |
| - name: ⚙️ Setup environment | |
| id: setup-environment | |
| run: | | |
| sudo apt update | |
| sudo apt install libsdl1.2-dev libsdl-ttf2.0-dev libsdl2-dev libsdl2-ttf-dev | |
| - name: 🛠️ Patch "curses.h" | |
| id: patch-curses | |
| run: | | |
| echo -e "#define PDC_WIDE 1\n#define CHTYPE_32 1\n#define PDC_RGB 1\n" > curses.h.new && \ | |
| cat curses.h >> curses.h.new && \ | |
| rm curses.h && \ | |
| mv curses.h.new curses.h | |
| - name: 🛠️ Build library (VT) | |
| id: build-library-vt | |
| run: | | |
| cd vt | |
| make WIDE=Y DLL=Y CHTYPE_32=Y | |
| mv libpdcurses.so libpdcursesmod-vt-${{ matrix.arch }}.so | |
| - name: 🛠️ Build library (FB) | |
| id: build-library-fb | |
| run: | | |
| cd fb | |
| make WIDE=Y DLL=Y CHTYPE_32=Y | |
| mv libpdcurses.so libpdcursesmod-fb-${{ matrix.arch }}.so | |
| - name: 🛠️ Build library (SDL1) | |
| id: build-library-sdl1 | |
| run: | | |
| cd sdl1 | |
| make WIDE=Y DLL=Y CHTYPE_32=Y | |
| mv libpdcurses.so libpdcursesmod-sdl1-${{ matrix.arch }}.so | |
| - name: 🛠️ Build library (SDL2) | |
| id: build-library-sdl2 | |
| run: | | |
| cd sdl2 | |
| make WIDE=Y DLL=Y CHTYPE_32=Y | |
| mv libpdcurses.so libpdcursesmod-sdl2-${{ matrix.arch }}.so | |
| - name: ⬆️ Upload artifacts (VT) | |
| id: upload-artifacts-vt | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-ubuntu-${{ matrix.arch }}-vt | |
| path: "vt/libpdcursesmod-vt-${{ matrix.arch }}.so" | |
| if-no-files-found: error | |
| - name: ⬆️ Upload artifacts (FB) | |
| id: upload-artifacts-fb | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-ubuntu-${{ matrix.arch }}-fb | |
| path: "fb/libpdcursesmod-fb-${{ matrix.arch }}.so" | |
| if-no-files-found: error | |
| - name: ⬆️ Upload artifacts (SDL1) | |
| id: upload-artifacts-sdl1 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-ubuntu-${{ matrix.arch }}-sdl1 | |
| path: "sdl1/libpdcursesmod-sdl1-${{ matrix.arch }}.so" | |
| if-no-files-found: error | |
| - name: ⬆️ Upload artifacts (SDL2) | |
| id: upload-artifacts-sdl2 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-ubuntu-${{ matrix.arch }}-sdl2 | |
| path: "sdl2/libpdcursesmod-sdl2-${{ matrix.arch }}.so" | |
| if-no-files-found: error | |
| macos: | |
| strategy: | |
| matrix: | |
| include: | |
| - os: macos-15-intel | |
| arch: x64 | |
| - os: macos-15 | |
| arch: arm64 | |
| runs-on: ${{ matrix.os }} | |
| name: 🍎 macOS (${{ matrix.arch }}) | |
| steps: | |
| - name: ☁️ Clone repository | |
| id: checkout-repository | |
| uses: actions/checkout@master | |
| with: | |
| repository: Bill-Gray/PDCursesMod | |
| ref: refs/heads/master | |
| - name: ⚙️ Setup environment | |
| id: setup-environment | |
| run: | | |
| brew install sdl2 sdl2_ttf | |
| - name: 🛠️ Patch "curses.h" | |
| id: patch-curses | |
| run: | | |
| echo -e "#define PDC_WIDE 1\n#define CHTYPE_32 1\n#define PDC_RGB 1\n" > curses.h.new && \ | |
| cat curses.h >> curses.h.new && \ | |
| rm curses.h && \ | |
| mv curses.h.new curses.h | |
| - name: 🛠️ Build library (VT) | |
| id: build-library-vt | |
| run: | | |
| cd vt | |
| make WIDE=Y DLL=Y CHTYPE_32=Y | |
| mv libpdcurses.dylib libpdcursesmod-vt-${{ matrix.arch }}.dylib | |
| - name: 🛠️ Build library (SDL2) | |
| id: build-library-sdl2 | |
| run: | | |
| cd sdl2 | |
| make WIDE=Y DLL=Y CHTYPE_32=Y | |
| mv libpdcurses.dylib libpdcursesmod-sdl2-${{ matrix.arch }}.dylib | |
| - name: ⬆️ Upload artifacts (VT) | |
| id: upload-artifacts-vt | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-macos-${{ matrix.arch }}-vt | |
| path: "vt/libpdcursesmod-vt-${{ matrix.arch }}.dylib" | |
| if-no-files-found: error | |
| - name: ⬆️ Upload artifacts (SDL2) | |
| id: upload-artifacts-sdl2 | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-macos-${{ matrix.arch }}-sdl2 | |
| path: "sdl2/libpdcursesmod-sdl2-${{ matrix.arch }}.dylib" | |
| if-no-files-found: error | |
| windows: | |
| strategy: | |
| matrix: | |
| include: | |
| - cross: amd64 | |
| arch: x64 | |
| - cross: amd64_arm64 | |
| arch: arm64 | |
| name: 🪟 Windows (${{ matrix.arch }}) | |
| runs-on: windows-2022 | |
| steps: | |
| - name: ☁️ Clone repository | |
| id: checkout-repository | |
| uses: actions/checkout@master | |
| with: | |
| repository: Bill-Gray/PDCursesMod | |
| ref: refs/heads/master | |
| - name: ⚙️ Setup environment | |
| id: setup-environment | |
| uses: ilammy/msvc-dev-cmd@v1 | |
| with: | |
| arch: ${{ matrix.cross }} | |
| - name: 🛠️ Patch "curses.h" | |
| id: patch-curses | |
| shell: pwsh | |
| run: | | |
| $defines = @" | |
| #define PDC_DLL_BUILD 1 | |
| #define PDC_WIDE 1 | |
| #define CHTYPE_32 1 | |
| #define PDC_RGB 1 | |
| "@ | |
| $content = Get-Content -Path "curses.h" -Raw | |
| $newContent = $defines + $content | |
| Set-Content -Path "curses.h" -Value $newContent | |
| - name: 🛠️ Build library (WinGUI) | |
| id: build-library-wingui | |
| run: | | |
| cd wingui | |
| nmake PLATFORM=${{ matrix.arch }} WIDE=Y DLL=Y CHTYPE_32=Y -f Makefile.vc | |
| ren pdcurses.dll libpdcursesmod-wingui-${{ matrix.arch }}.dll | |
| - name: 🛠️ Build library (WinCon) | |
| id: build-library-wincon | |
| run: | | |
| cd wincon | |
| nmake PLATFORM=${{ matrix.arch }} WIDE=Y DLL=Y CHTYPE_32=Y -f Makefile.vc | |
| ren pdcurses.dll libpdcursesmod-wincon-${{ matrix.arch }}.dll | |
| - name: 🛠️ Build library (VT) | |
| id: build-library-vt | |
| run: | | |
| cd vt | |
| nmake PLATFORM=${{ matrix.arch }} WIDE=Y DLL=Y CHTYPE_32=Y -f Makefile.vc | |
| ren pdcurses.dll libpdcursesmod-vt-${{ matrix.arch }}.dll | |
| - name: ⬆️ Upload artifacts (WinGUI) | |
| id: upload-artifacts-wingui | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-windows-${{ matrix.arch }}-wingui | |
| path: "wingui/libpdcursesmod-wingui-${{ matrix.arch }}.dll" | |
| if-no-files-found: error | |
| - name: ⬆️ Upload artifacts (WinCon) | |
| id: upload-artifacts-wincon | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-windows-${{ matrix.arch }}-wincon | |
| path: "wincon/libpdcursesmod-wincon-${{ matrix.arch }}.dll" | |
| if-no-files-found: error | |
| - name: ⬆️ Upload artifacts (VT) | |
| id: upload-artifacts-vt | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: libraries-windows-${{ matrix.arch }}-vt | |
| path: "vt/libpdcursesmod-vt-${{ matrix.arch }}.dll" | |
| if-no-files-found: error | |
| create-pr: | |
| name: 📝 Create pull request | |
| runs-on: ubuntu-latest | |
| needs: | |
| [ubuntu, macos, windows] | |
| outputs: | |
| pr_created: ${{ steps.create-pull-request.outputs.pull-request-number != '' }} | |
| pr_number: ${{ steps.create-pull-request.outputs.pull-request-number }} | |
| files_changed: ${{ steps.check-changes.outputs.files_changed }} | |
| steps: | |
| - name: ☁️ Clone repository | |
| id: checkout-repository | |
| uses: actions/checkout@v4 | |
| - name: 📥 Download artifacts | |
| id: download-artifact | |
| uses: actions/download-artifact@v4.1.7 | |
| with: | |
| pattern: libraries* | |
| merge-multiple: true | |
| path: lib/pdcursesmod | |
| - name: 🔍 Check for changes | |
| id: check-changes | |
| run: | | |
| if git diff --quiet HEAD -- lib/pdcursesmod/; then | |
| echo "files_changed=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "files_changed=true" >> $GITHUB_OUTPUT | |
| fi | |
| - name: 🔼 Bump version | |
| id: bump-version | |
| if: steps.check-changes.outputs.files_changed == 'true' | |
| run: | | |
| VERSION=$(date +%Y.%m.%d) | |
| sed -i "s|<OverallVersion>.*</OverallVersion>|<OverallVersion>$VERSION</OverallVersion>|" NativeLibraries/Sharpie.NativeLibraries.PdCursesMod.csproj | |
| - name: 📝 Create pull request | |
| id: create-pull-request | |
| uses: peter-evans/create-pull-request@v6 | |
| with: | |
| commit-message: (chore) Update PDCursesMod native libraries. | |
| committer: Alexandru Ciobanu <alex+git[bot]@ciobanu.org> | |
| author: Alexandru Ciobanu <alex+git[bot]@ciobanu.org> | |
| title: Update PDCursesMod native library to latest master. | |
| body: This is an auto-generated PR with native library updates. | |
| delete-branch: true | |
| labels: dependencies | |
| assignees: pavkam | |
| branch: pdcursesmod-lib-update | |
| summary: | |
| name: ✔︎ Generate summary | |
| runs-on: ubuntu-latest | |
| needs: [ubuntu, macos, windows, create-pr] | |
| if: always() | |
| steps: | |
| - name: 📝 Create summary | |
| id: create-summary | |
| shell: bash | |
| run: | | |
| echo "## 🐍 PDCursesMod Library Build Summary" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "| Platform | Status | Library Changes |" >> $GITHUB_STEP_SUMMARY | |
| echo "|----------|--------|----------------|" >> $GITHUB_STEP_SUMMARY | |
| # Check each build job status | |
| if [ "${{ needs.ubuntu.result }}" = "success" ]; then | |
| echo "| Ubuntu | ✅ Success |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| Ubuntu | ❌ Failed |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [ "${{ needs.macos.result }}" = "success" ]; then | |
| echo "| macOS | ✅ Success |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| macOS | ❌ Failed |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| if [ "${{ needs.windows.result }}" = "success" ]; then | |
| echo "| Windows | ✅ Success |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| Windows | ❌ Failed |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### 📝 Pull Request Status" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| # Check if PR was created and files changed | |
| if [ "${{ needs.create-pr.outputs.pr_created }}" = "true" ]; then | |
| if [ "${{ needs.create-pr.outputs.files_changed }}" = "true" ]; then | |
| echo "| Status | 🔄 PR Created with Changes |" >> $GITHUB_STEP_SUMMARY | |
| echo "| PR Number | #${{ needs.create-pr.outputs.pr_number }} |" >> $GITHUB_STEP_SUMMARY | |
| else | |
| echo "| Status | ⏭️ No Changes - No PR Created |" >> $GITHUB_STEP_SUMMARY | |
| fi | |
| else | |
| echo "| Status | ❌ PR Creation Failed |" >> $GITHUB_STEP_SUMMARY | |
| fi |