Update toolname #62
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 / Build / Release | |
| on: | |
| push: | |
| branches: ['**'] | |
| tags: | |
| - 'd[0-9a-z]+' # e.g. d20260601 - tagged build | |
| - 'v(\d|\.|-|[A-Z])+' # e.g. v0.1.0-ALPHA - versioned release | |
| pull_request: | |
| workflow_dispatch: | |
| env: | |
| FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: 'true' | |
| jobs: | |
| # 1. Unit tests - Ubuntu only | |
| test: | |
| name: Tests (Ubuntu) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '25' | |
| - uses: DeLaGuardo/setup-clojure@13.4 | |
| with: | |
| cli: latest | |
| - name: Cache Maven | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-m2-${{ hashFiles('deps.edn') }} | |
| restore-keys: ${{ runner.os }}-m2- | |
| - name: Install USBSID driver | |
| shell: bash | |
| run: | | |
| DIR="$HOME/.m2/repository/usbsid/usbsid-usb-driver-library-java/1.1" | |
| mkdir -p "$DIR" | |
| cp assets/driver/usbsid-usb-driver-library-java-1.1.jar "$DIR/" | |
| cp assets/driver/usbsid-usb-driver-library-java-1.1.pom "$DIR/" | |
| - name: Install patched libusb4java (Windows native lib fix) | |
| shell: bash | |
| run: ./scripts/install-libusb4java.sh | |
| - name: Run tests | |
| run: clojure -T:build test | |
| # 2. CI build - Ubuntu only | |
| ci: | |
| name: CI Build (Ubuntu) | |
| runs-on: ubuntu-latest | |
| needs: test | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '25' | |
| - uses: DeLaGuardo/setup-clojure@13.4 | |
| with: | |
| cli: latest | |
| - name: Cache Maven | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-m2-${{ hashFiles('deps.edn') }} | |
| restore-keys: ${{ runner.os }}-m2- | |
| - name: Install USBSID driver | |
| shell: bash | |
| run: | | |
| DIR="$HOME/.m2/repository/usbsid/usbsid-usb-driver-library-java/1.1" | |
| mkdir -p "$DIR" | |
| cp assets/driver/usbsid-usb-driver-library-java-1.1.jar "$DIR/" | |
| cp assets/driver/usbsid-usb-driver-library-java-1.1.pom "$DIR/" | |
| - name: Install patched libusb4java (Windows native lib fix) | |
| shell: bash | |
| run: ./scripts/install-libusb4java.sh | |
| - name: Install Xvfb | |
| run: sudo apt-get install -y xvfb | |
| - name: CI build (uber + launchers) | |
| env: | |
| NO_AT_BRIDGE: "1" | |
| run: xvfb-run -a clojure -T:build ci | |
| - name: Upload JAR and launchers | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: jar-and-launchers | |
| path: | | |
| target/usbsid-configtool-*.jar | |
| target/run.sh | |
| target/run.bat | |
| # 3. Platform packages - tagged snapshots (d*) and releases (v*) | |
| package: | |
| name: Package (${{ matrix.platform }}) | |
| if: startsWith(github.ref, 'refs/tags/') | |
| needs: ci | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| platform: linux # jpackage app-image (zipped directory) | |
| - os: ubuntu-latest | |
| platform: linux-appimage # self-contained .AppImage | |
| - os: windows-latest | |
| platform: windows # jpackage .msi installer | |
| - os: macos-15-intel # Intel x86_64 | |
| platform: macos-intel # jpackage .dmg | |
| - os: macos-14 # Apple Silicon arm64 | |
| platform: macos-arm # jpackage .dmg | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-java@v4 | |
| with: | |
| distribution: temurin | |
| java-version: '25' | |
| - uses: DeLaGuardo/setup-clojure@13.4 | |
| with: | |
| cli: latest | |
| - name: Cache Maven | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.m2/repository | |
| key: ${{ runner.os }}-m2-${{ hashFiles('deps.edn') }} | |
| restore-keys: ${{ runner.os }}-m2- | |
| - name: Install USBSID driver | |
| shell: bash | |
| run: | | |
| DIR="$HOME/.m2/repository/usbsid/usbsid-usb-driver-library-java/1.1" | |
| mkdir -p "$DIR" | |
| cp assets/driver/usbsid-usb-driver-library-java-1.1.jar "$DIR/" | |
| cp assets/driver/usbsid-usb-driver-library-java-1.1.pom "$DIR/" | |
| - name: Install patched libusb4java (Windows native lib fix) | |
| shell: bash | |
| run: ./scripts/install-libusb4java.sh | |
| # Build uber LOCALLY on each platform runner so build.clj's host-jfx-alias | |
| # picks the matching mac classifier ($mac or $mac-aarch64) per host arch. | |
| # Using the shared Ubuntu-built uber from the `ci` job would never pull in | |
| # mac dylibs → JavaFX prism libs missing from .app → "no suitable pipeline". | |
| - name: Build uber locally (per-platform JavaFX classifier) | |
| shell: bash | |
| run: clojure -T:build uber | |
| - name: Build platform package | |
| shell: bash | |
| run: | | |
| clojure -T:build package | |
| if [ "${{ matrix.platform }}" = "linux-appimage" ]; then | |
| bash scripts/build-appimage.sh | |
| fi | |
| # Stage output with platform-tagged filenames so all five can coexist | |
| - name: Stage artifacts | |
| shell: bash | |
| run: | | |
| VERSION=$(cat resources/.version | tr -d '[:space:]') | |
| mkdir -p staging | |
| if [ "${{ matrix.platform }}" = "linux" ]; then | |
| (cd target/package && zip -r "../../staging/USBSID-Configtool-${VERSION}-linux.zip" USBSID-Configtool/) | |
| elif [ "${{ matrix.platform }}" = "linux-appimage" ]; then | |
| cp target/appimage/*.AppImage staging/ | |
| elif [ "${{ matrix.platform }}" = "windows" ]; then | |
| cp target/package/*.msi "staging/USBSID-Configtool-${VERSION}-windows.msi" | |
| elif [ "${{ matrix.platform }}" = "macos-intel" ]; then | |
| cp target/package/*.dmg "staging/USBSID-Configtool-${VERSION}-macos-x86_64.dmg" | |
| elif [ "${{ matrix.platform }}" = "macos-arm" ]; then | |
| cp target/package/*.dmg "staging/USBSID-Configtool-${VERSION}-macos-aarch64.dmg" | |
| fi | |
| - name: Upload platform artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: package-${{ matrix.platform }} | |
| path: staging/* | |
| # 4a. Delete unfinished draft prereleases, and prereleases older than 30 days (but keep at least 10) | |
| cleanup_previous_builds: | |
| name: Cleanup Previous Builds | |
| if: startsWith(github.ref, 'refs/tags/d') | |
| runs-on: ubuntu-latest | |
| needs: [ci, package] | |
| steps: | |
| - uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{secrets.GITHUB_TOKEN}} | |
| retries: 3 | |
| script: | | |
| // Get a list of all releases, sorted newest first | |
| let releases = | |
| (await github.paginate( | |
| github.rest.repos.listReleases, | |
| { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo | |
| })) | |
| .sort((a,b) => b.created_at.localeCompare(a.created_at)); | |
| let releaseCount = 0; | |
| let releasesToDelete = []; | |
| // Initiate deletion of draft prereleases | |
| for (const release of releases) | |
| { | |
| // Only cleanup prereleases | |
| if (!release.prerelease) | |
| continue; | |
| // Failed builds leave drafts - delete them | |
| if (release.draft) | |
| { | |
| console.log("Will delete draft prerelease: " + release.tag_name); | |
| releasesToDelete.push(release.id); | |
| continue; | |
| } | |
| // Keep at least 10, no matter how old | |
| if (++releaseCount <= 10) | |
| continue; | |
| // We have more than 10 releases - delete those more than 30 days old | |
| let daysAgo = Math.floor((new Date() - Date.parse(release.created_at)) / 1000 / 60 / 60 / 24); | |
| if (daysAgo <= 30) | |
| continue; | |
| console.log("Will delete old prerelease: " + release.tag_name); | |
| releasesToDelete.push(release.id); | |
| } | |
| if (releasesToDelete.length) | |
| { | |
| let promises = []; | |
| for (const id of releasesToDelete) | |
| { | |
| promises.push( | |
| github.rest.repos.deleteRelease( | |
| { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| release_id: id | |
| })); | |
| } | |
| console.log("Waiting for deletions to complete"); | |
| await Promise.all(promises); | |
| } | |
| console.log("Done."); | |
| # 4b. Tagged build pre-release - d* tags only | |
| prerelease: | |
| name: Publish Pre-release | |
| if: startsWith(github.ref, 'refs/tags/d') | |
| needs: [ci, package] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download platform packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: package-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Download JAR and launchers | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: jar-and-launchers | |
| path: dist-jar | |
| - name: Collect all release files | |
| run: | | |
| cp dist-jar/usbsid-configtool-*.jar dist/ | |
| cp dist-jar/run.sh dist/ | |
| cp dist-jar/run.bat dist/ | |
| - name: Create Pre-release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Tagged build ${{ github.ref_name }} | |
| generate_release_notes: false | |
| prerelease: true | |
| files: dist/* | |
| # 4b. Stable release - v* tags only | |
| release: | |
| name: Publish Release | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| needs: [ci, package] | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Download platform packages | |
| uses: actions/download-artifact@v4 | |
| with: | |
| pattern: package-* | |
| path: dist | |
| merge-multiple: true | |
| - name: Download JAR and launchers | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: jar-and-launchers | |
| path: dist-jar | |
| - name: Collect all release files | |
| run: | | |
| cp dist-jar/usbsid-configtool-*.jar dist/ | |
| cp dist-jar/run.sh dist/ | |
| cp dist-jar/run.bat dist/ | |
| - name: Create Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| name: Release ${{ github.ref_name }} | |
| generate_release_notes: true | |
| prerelease: false | |
| files: dist/* |