Add support for Windows builds in the ci #67
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: CI | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| tags: | |
| - '[0-9]*' | |
| pull_request: | |
| permissions: | |
| contents: read | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| build: | |
| name: Build (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install radare2 | |
| id: r2 | |
| uses: radareorg/github-actions@v3 | |
| - name: Build | |
| run: make | |
| - name: Build plugin | |
| run: make plugin | |
| meson: | |
| name: Meson (${{ matrix.os }}) | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-24.04, macos-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install radare2 | |
| id: r2 | |
| uses: radareorg/github-actions@v3 | |
| - name: Install deps | |
| run: pip install meson ninja --break-system-packages | |
| - name: Configure | |
| run: meson setup build | |
| - name: Build | |
| run: meson compile -C build | |
| - name: Test | |
| run: meson test -C build --print-errorlogs | |
| r2-git: | |
| name: Build against radare2 git | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Install radare2 from git | |
| id: r2 | |
| uses: radareorg/github-actions@v3 | |
| with: | |
| from-git: true | |
| - name: Build | |
| run: make | |
| - name: Build plugin | |
| run: make plugin | |
| debian: | |
| name: Build Debian package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Install build deps | |
| run: sudo apt-get update -y && sudo apt-get install -y build-essential pkg-config | |
| - name: Install radare2 | |
| id: r2 | |
| uses: radareorg/github-actions@v3 | |
| - name: Build Debian package | |
| run: make -C dist/debian SUDO= | |
| - name: Upload Debian package artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| path: dist/debian/*.deb | |
| if-no-files-found: error | |
| archive: false | |
| windows: | |
| name: Build Windows package | |
| runs-on: windows-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: 3.12.x | |
| - name: Setup MSVC | |
| uses: TheMrMilchmann/setup-msvc-dev@v4 | |
| with: | |
| arch: x64 | |
| - name: Install build dependencies | |
| run: python -m pip install meson ninja | |
| - name: Install radare2 | |
| id: r2 | |
| uses: radareorg/github-actions@v3 | |
| - name: Configure | |
| run: meson setup build-windows --buildtype=release -Dplugins=enabled | |
| - name: Build | |
| run: meson compile -C build-windows | |
| - name: Test | |
| run: meson test -C build-windows --print-errorlogs | |
| - name: Package Windows build | |
| id: package | |
| shell: pwsh | |
| run: | | |
| $project = meson introspect build-windows --projectinfo | ConvertFrom-Json | |
| $package = "r2unity-$($project.version)-w64" | |
| $files = @( | |
| "build-windows\r2unity.exe", | |
| "build-windows\core_r2unity.dll", | |
| "build-windows\bin_r2unity.dll" | |
| ) | |
| New-Item -ItemType Directory -Path $package | Out-Null | |
| foreach ($file in $files) { | |
| if (-not (Test-Path $file)) { | |
| throw "Missing Windows build output: $file" | |
| } | |
| Copy-Item $file -Destination $package | |
| } | |
| $archive = "$package.zip" | |
| Compress-Archive -Path "$package\*" -DestinationPath $archive -Force | |
| "archive=$archive" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append | |
| - name: Upload Windows package artifact | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: windows-package | |
| path: ${{ steps.package.outputs.archive }} | |
| if-no-files-found: error | |
| release: | |
| name: Publish release | |
| if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} | |
| needs: | |
| - build | |
| - meson | |
| - debian | |
| - windows | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download Debian package artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: '*.deb' | |
| path: dist/artifacts | |
| merge-multiple: true | |
| - name: Download Windows package artifact | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: windows-package | |
| path: dist/artifacts | |
| - name: Generate release notes | |
| run: ./release.sh notes > release-notes.md | |
| - name: Create GitHub release | |
| uses: softprops/action-gh-release@v3.0.0 | |
| with: | |
| name: ${{ github.ref_name }} | |
| tag_name: ${{ github.ref_name }} | |
| draft: false | |
| prerelease: false | |
| body_path: release-notes.md | |
| fail_on_unmatched_files: true | |
| files: | | |
| dist/artifacts/*.deb | |
| dist/artifacts/*.zip |