name: AppleCommander builds on: push: branches: [ "main" ] tags: - '*' pull_request: branches: [ "main" ] workflow_dispatch: permissions: contents: read jobs: build-java: name: Java build runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 - name: Set up JDK 25 uses: actions/setup-java@v6.2.0 with: java-version: '25' distribution: 'temurin' - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 - name: Build with Gradle env: # The SWT image tests fail in the pipeline; disable them. AC_SKIP_SWT_TESTS: true run: ./gradlew build - name: Upload 'ac' uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/cli-ac/build/libs/AppleCommander-ac* archive: false if-no-files-found: error - name: Upload 'acx' uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/cli-acx/build/libs/AppleCommander-acx* archive: false if-no-files-found: error - name: Upload MacOS aarch64 uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/gui-swt-macosx-aarch64/build/libs/AppleCommander*.jar archive: false if-no-files-found: error - name: Upload MacOS x86_64 uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/gui-swt-macosx-x86_64/build/libs/AppleCommander*.jar archive: false if-no-files-found: error - name: Upload Linux x86_64 uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/gui-swt-linux-x86_64/build/libs/AppleCommander*.jar archive: false if-no-files-found: error - name: Upload Linux ARM (Raspberry Pi?) uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/gui-swt-linux-arm/build/libs/AppleCommander*.jar archive: false if-no-files-found: error - name: Upload Linux aarch64 uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/gui-swt-linux-aarch64/build/libs/AppleCommander*.jar archive: false if-no-files-found: error - name: Upload Windows x86_64 uses: actions/upload-artifact@v7 with: name: build-artifacts path: app/gui-swt-win32-x86_64/build/libs/AppleCommander*.jar archive: false if-no-files-found: error # This is a crude license header check. The ones I tested were susceptible to whitespace differences # and I never got them to work. My primary goal is to ensure the headers exist, so this suffices. license-check: name: License check runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 - name: Look for license phrase run: | outfile=$(mktemp) ./scripts/license-check.sh > ${outfile} if [ -s "${outfile}" ] then echo "License headers missing on the following files:" cat ${outfile} exit 1 else echo "License headers appear to be valid!" fi build-swt-jpackage: name: jpackage for SWT on ${{ matrix.os }}-${{ matrix.arch }} needs: [build-java, license-check] runs-on: ${{ matrix.label }} strategy: matrix: include: - label: ubuntu-latest os: linux arch: x86_64 path: app/gui-swt-linux-x86_64 - label: ubuntu-24.04-arm os: linux arch: aarch64 path: app/gui-swt-linux-aarch64 - label: windows-latest os: windows arch: x86_64 path: app\gui-swt-win32-x86_64 - label: macos-15-intel os: darwin arch: x86_64 path: app/gui-swt-macosx-x86_64 - label: macos-15 os: darwin arch: arm64 path: app/gui-swt-macosx-aarch64 steps: - name: Checkout code uses: actions/checkout@v7 - name: Set up JDK 25 uses: actions/setup-java@v6.2.0 with: java-version: '25' distribution: 'temurin' - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 - name: Build with Gradle # Skipping all tests. SWT image tests fail in the pipeline and ANT tests fail under Windows. run: ./gradlew build -x test - name: Create DMG file (MacOS) if: runner.os == 'macOS' run: ./scripts/build-macos-swt-dmg.sh ${{ matrix.path }} - name: Create MSI file (Windows) if: runner.os == 'Windows' shell: pwsh run: | dotnet tool install --global wix --version 5 wix extension add -g WixToolset.Util.wixext/5.0.0 wix extension add -g WixToolset.Ui.wixext/5.0.0 .\scripts\build-windows-swt-msi.ps1 ${{ matrix.path }} - name: Create DEB file (Linux) if: runner.os == 'Linux' run: ./scripts/build-linux-swt-deb.sh ${{ matrix.path }} - name: Create RPM file (Linux) if: runner.os == 'Linux' run: | sudo apt install -y rpm ./scripts/build-linux-swt-rpm.sh ${{ matrix.path }} - name: Upload DMG if: runner.os == 'macOS' uses: actions/upload-artifact@v7 with: path: AppleCommander-*.dmg archive: false if-no-files-found: error - name: Upload MSI if: runner.os == 'Windows' uses: actions/upload-artifact@v7 with: path: AppleCommander-*.msi archive: false if-no-files-found: error - name: Upload DEB if: runner.os == 'Linux' uses: actions/upload-artifact@v7 with: path: AppleCommander-*.deb archive: false if-no-files-found: error - name: Upload RPM if: runner.os == 'Linux' uses: actions/upload-artifact@v7 with: path: AppleCommander-*.rpm archive: false if-no-files-found: error build-javafx-jpackage: name: jpackage for JavaFX on ${{ matrix.os }}-${{ matrix.arch }} needs: [build-java, license-check] runs-on: ${{ matrix.label }} strategy: matrix: include: - label: ubuntu-latest os: linux arch: x86_64 - label: ubuntu-24.04-arm os: linux arch: aarch64 - label: windows-latest os: windows arch: x86_64 - label: macos-15-intel os: darwin arch: x86_64 - label: macos-15 os: darwin arch: arm64 steps: - name: Checkout code uses: actions/checkout@v7 - name: Set up JDK 25 uses: actions/setup-java@v6.2.0 with: java-version: '25' distribution: 'temurin' - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 - name: Build with Gradle # Skipping all tests. SWT image tests fail in the pipeline and ANT tests fail under Windows. run: ./gradlew build -x test - name: Create DMG file (MacOS) if: runner.os == 'macOS' run: ./scripts/build-macos-javafx-dmg.sh - name: Create MSI file (Windows) if: runner.os == 'Windows' shell: pwsh run: | dotnet tool install --global wix --version 5 wix extension add -g WixToolset.Util.wixext/5.0.0 wix extension add -g WixToolset.Ui.wixext/5.0.0 .\scripts\build-windows-javafx-msi.ps1 - name: Create DEB file (Linux) if: runner.os == 'Linux' run: ./scripts/build-linux-javafx-deb.sh - name: Create RPM file (Linux) if: runner.os == 'Linux' run: | sudo apt install -y rpm ./scripts/build-linux-javafx-rpm.sh - name: Upload DMG if: runner.os == 'macOS' uses: actions/upload-artifact@v7 with: path: AppleCommanderFX-*.dmg archive: false if-no-files-found: error - name: Upload MSI if: runner.os == 'Windows' uses: actions/upload-artifact@v7 with: path: AppleCommanderFX-*.msi archive: false if-no-files-found: error - name: Upload DEB if: runner.os == 'Linux' uses: actions/upload-artifact@v7 with: path: AppleCommanderFX-*.deb archive: false if-no-files-found: error - name: Upload RPM if: runner.os == 'Linux' uses: actions/upload-artifact@v7 with: path: AppleCommanderFX-*.rpm archive: false if-no-files-found: error build-native: name: ac/acx on ${{ matrix.os }}-${{ matrix.arch }} needs: [build-swt-jpackage, build-javafx-jpackage] runs-on: ${{ matrix.label }} strategy: matrix: # See: https://docs.github.com/en/actions/concepts/runners/about-github-hosted-runners#overview-of-github-hosted-runners # ... and follow the links to the related GitHub repositories include: - label: ubuntu-latest os: linux arch: x86_64 - label: ubuntu-24.04-arm os: linux arch: aarch64 - label: windows-latest os: windows arch: x86_64 - label: macos-15-intel os: darwin arch: x86_64 - label: macos-15 os: darwin arch: arm64 steps: - uses: actions/checkout@v7 - uses: graalvm/setup-graalvm@v1 with: java-version: '25' distribution: 'liberica' github-token: ${{ secrets.GITHUB_TOKEN }} native-image-job-reports: 'true' - name: Build ac/acx run: ./gradlew nativeCompile env: # Needed for Windows; not an issue for other OSes GRADLE_OPTS: -Djava.io.tmpdir=${{ runner.temp }} - name: Run UPX uses: crazy-max/ghaction-upx@v4 if: runner.os == 'Linux' with: files: | app/cli-ac/build/native/nativeCompile/ac-* app/cli-acx/build/native/nativeCompile/acx-* - name: Run CLTH tests if: ${{ matrix.os != 'windows' }} shell: bash run: ./scripts/run-clth-tests.sh - name: Upload binary uses: actions/upload-artifact@v7 with: name: ac-${{ matrix.os }}-${{ matrix.arch }} path: app/cli-ac/build/native/nativeCompile/ac-* archive: false - name: Upload binary uses: actions/upload-artifact@v7 with: name: acx-${{ matrix.os }}-${{ matrix.arch }} path: app/cli-acx/build/native/nativeCompile/acx-* archive: false release: name: Create draft release if: github.ref_type == 'tag' needs: [build-java, build-swt-jpackage, build-javafx-jpackage, build-native] runs-on: ubuntu-latest permissions: contents: write steps: - uses: actions/download-artifact@v8 with: merge-multiple: true - uses: softprops/action-gh-release@v3 with: draft: true generate_release_notes: true discussion_category_name: Announcements files: | ac-* acx-* AppleCommander-* AppleCommanderFX-* publish: name: Publish to Maven Central if: github.ref_type == 'tag' needs: [build-java, build-swt-jpackage, build-javafx-jpackage, build-native] runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v7 - name: Set up JDK 25 uses: actions/setup-java@v6.2.0 with: java-version: '25' distribution: 'temurin' - name: Setup Gradle uses: gradle/actions/setup-gradle@v6 - name: Publish with Gradle run: | export ORG_GRADLE_PROJECT_signingKey=$(echo "$GPG_SIGNING_KEY_BASE64" | base64 -d) ./gradlew build publish -x test env: ORG_GRADLE_PROJECT_ossrhUsername: ${{ secrets.OSSRH_USERNAME }} ORG_GRADLE_PROJECT_ossrhPassword: ${{ secrets.OSSRH_TOKEN }} ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_SIGNING_PASSPHRASE }} GPG_SIGNING_KEY_BASE64: ${{ secrets.GPG_SIGNING_KEY_BASE64 }} ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.GPG_SIGNING_KEY_ID }} - name: Setup .netrc file uses: extractions/netrc@v3 with: machine: ossrh-staging-api.central.sonatype.com username: ${{ secrets.OSSRH_USERNAME }} password: ${{ secrets.OSSRH_TOKEN }} - name: Finish publishing run: ./scripts/finish-publishing.sh