diff --git a/.github/workflows/android_pr_check.yml b/.github/workflows/android_pr_check.yml index 6a3a7cef8..8a9c73a53 100644 --- a/.github/workflows/android_pr_check.yml +++ b/.github/workflows/android_pr_check.yml @@ -1,14 +1,24 @@ -name: Android Pull Request Check +name: Android - Pull Request Check + on: pull_request: branches: [ main ] - types: [opened, synchronize, reopened, ready_for_review] - # Allows you to run this workflow manually from the Actions tab + types: [opened, synchronize, reopened, ready_for_review] + paths: + - 'FloconAndroid/**' + - '.github/workflows/android_pr_check.yml' workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: build: - name: Build FloconAndroid + name: Build and Test runs-on: ubuntu-latest steps: - name: Check out code @@ -23,6 +33,6 @@ jobs: - name: Set up Gradle uses: gradle/actions/setup-gradle@v5 - - name: Build with Gradle + - name: Run tests and assemble working-directory: FloconAndroid - run: ./gradlew assemble + run: ./gradlew test assemble diff --git a/.github/workflows/create_desktop_builds.yml b/.github/workflows/create_desktop_builds.yml deleted file mode 100644 index bf9280882..000000000 --- a/.github/workflows/create_desktop_builds.yml +++ /dev/null @@ -1,86 +0,0 @@ -name: Build Desktop App - -on: - # Allows you to run this workflow manually from the Actions tab - workflow_dispatch: - -jobs: - build: - runs-on: ${{ matrix.os }} - strategy: - matrix: - include: - - os: macos-15-intel # runner Intel (x64) - arch: x64 - - os: macos-latest - - steps: - - name: Checkout source - uses: actions/checkout@v4 - - - name: Set up temurin JDK - uses: actions/setup-java@v4 - with: - distribution: 'temurin' - java-version: '21' - token: ${{ secrets.GITHUB_TOKEN }} - - - - name: Set up Gradle - uses: gradle/gradle-build-action@v2 - with: - gradle-version: '8.12' - - - name: Generate aboutlibraries - working-directory: FloconDesktop - run: ./gradlew composeApp:exportLibraryDefinitions -PaboutLibraries.outputFile=src/commonMain/composeResources/files/aboutlibraries.json - - - name: Build with Gradle - working-directory: FloconDesktop - run: ./gradlew packageDistributionForCurrentOS packageUberJarForCurrentOS - env: - PROJECT_VERSION_NAME: "1.0.0" - - - name: Rename macOS arm64 dmg - if: matrix.os == 'macos-latest' - run: | - mv FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg FloconDesktop/composeApp/build/compose/binaries/main/dmg/macos-arm64.dmg - - - name: Upload macOS arm64 artifact - if: matrix.os == 'macos-latest' - uses: actions/upload-artifact@v4 - with: - name: macos-arm64-dmg - path: FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg - - - name: Rename macOS x64 dmg - if: matrix.os == 'macos-15-intel' - run: | - mv FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg FloconDesktop/composeApp/build/compose/binaries/main/dmg/macos-x64.dmg - - - name: Upload macOS x64 artifact - if: matrix.os == 'macos-15-intel' - uses: actions/upload-artifact@v4 - with: - name: macos-x64-dmg - path: FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg - - release: - needs: build - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Checkout source - uses: actions/checkout@v4 - - - name: Download macOS artifact - uses: actions/download-artifact@v4 - with: - name: macos-arm64-dmg - - - name: Download macOS artifact - uses: actions/download-artifact@v4 - with: - name: macos-x64-dmg \ No newline at end of file diff --git a/.github/workflows/desktop_pr_check.yml b/.github/workflows/desktop_pr_check.yml index d3504c2b3..111d81fa7 100644 --- a/.github/workflows/desktop_pr_check.yml +++ b/.github/workflows/desktop_pr_check.yml @@ -1,4 +1,5 @@ -name: Desktop Pull Request Check +name: Desktop - Pull Request Check + on: pull_request: branches: [ main ] @@ -6,12 +7,18 @@ on: paths: - 'FloconDesktop/**' - '.github/workflows/desktop_pr_check.yml' - # Allows you to run this workflow manually from the Actions tab workflow_dispatch: +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +permissions: + contents: read + jobs: build: - name: Build FloconDesktop + name: Build and Test runs-on: ubuntu-latest steps: - name: Check out code @@ -26,6 +33,6 @@ jobs: - name: Set up Gradle uses: gradle/actions/setup-gradle@v5 - - name: Build with Gradle + - name: Run tests and assemble working-directory: FloconDesktop - run: ./gradlew assemble + run: ./gradlew allTests assemble diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 467191bfe..1dee74d0b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,21 +1,34 @@ -name: docs +name: Docs - Build and Deploy on: push: branches: - - master - main + paths: + - 'docs/**' + - 'mkdocs.yml' + - '.github/workflows/docs.yml' pull_request: branches: - - master - main + paths: + - 'docs/**' + - 'mkdocs.yml' + - '.github/workflows/docs.yml' + +concurrency: + group: docs-${{ github.ref }} + cancel-in-progress: true permissions: - contents: write + contents: read jobs: deploy: + name: Deploy to GitHub Pages runs-on: ubuntu-latest + permissions: + contents: write steps: - name: Checkout repository uses: actions/checkout@v6 diff --git a/.github/workflows/publish_android.yml b/.github/workflows/publish_android.yml index 8c045c2a7..636ebdbe7 100644 --- a/.github/workflows/publish_android.yml +++ b/.github/workflows/publish_android.yml @@ -1,34 +1,53 @@ -name: Publish Android libs to maven MavenCentral +name: Android - Publish to MavenCentral + on: release: - types: [released, prereleased] - # Allows you to run this workflow manually from the Actions tab + types: [published, released, prereleased] workflow_dispatch: + inputs: + version: + description: 'Release version (e.g. 1.9.6). Leave empty to use tag ref' + required: false + type: string + +permissions: + contents: read + jobs: publish: - name: Release build and publish - runs-on: macOS-latest + name: Publish to MavenCentral + runs-on: ubuntu-latest steps: - name: Check out code uses: actions/checkout@v6 + - name: Set up JDK 21 uses: actions/setup-java@v5 with: distribution: 'zulu' java-version: 21 + + - name: Set up Gradle + uses: gradle/actions/setup-gradle@v5 + + - name: Run unit tests + working-directory: FloconAndroid + run: ./gradlew test + - name: Check release # be sure op and no-op versions are building working-directory: FloconAndroid run: ./gradlew :sample-android-only:assemble + - name: Publish to MavenCentral - run: | - ./gradlew \ - publishToMavenCentral \ - --no-configuration-cache working-directory: FloconAndroid env: - PROJECT_VERSION_NAME: ${{ github.ref_name }} + PROJECT_VERSION_NAME: ${{ inputs.version || github.ref_name }} ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALUSERNAME }} ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ORG_GRADLE_PROJECT_MAVENCENTRALPASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYID }} ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEYPASSWORD }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGINMEMORYKEY }} + run: | + ./gradlew \ + publishToMavenCentral \ + --no-configuration-cache diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 12da0306c..14f462771 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,197 +1,108 @@ -name: Build Desktop App then create a new release +name: Desktop - Build and Release on: release: types: [published] + workflow_dispatch: + inputs: + version: + description: 'Release version tag (e.g. 1.9.6). Leave empty to use git tag/branch ref' + required: false + type: string + draft: + description: 'Create as draft release' + required: false + type: boolean + default: false jobs: build: + name: Build (${{ matrix.platform }}) runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: include: - - os: macos-15-intel # runner Intel (x64) - arch: x64 - jdk_url: "https://corretto.aws/downloads/latest/amazon-corretto-17-x64-macos-jdk.pkg" - - os: macos-latest + - os: macos-15-intel + platform: macos-x64 + - os: macos-latest + platform: macos-arm64 - os: ubuntu-latest + platform: linux-x64 - os: windows-latest + platform: windows-x64 steps: - name: Checkout source uses: actions/checkout@v6 - - name: Set up temurin JDK + - name: Set up JDK 21 uses: actions/setup-java@v5 with: distribution: 'temurin' java-version: '21' - token: ${{ secrets.GITHUB_TOKEN }} - - name: Set up Gradle - uses: gradle/gradle-build-action@v2 - with: - gradle-version: '8.12' + uses: gradle/actions/setup-gradle@v5 - name: Install rpmbuild (Linux) if: matrix.os == 'ubuntu-latest' run: sudo apt-get update && sudo apt-get install -y rpm - # - name: Generate aboutlibraries - # working-directory: FloconDesktop - # run: ./gradlew composeApp:exportLibraryDefinitions -PaboutLibraries.outputFile=src/commonMain/composeResources/files/aboutlibraries.json - - name: Build with Gradle working-directory: FloconDesktop run: ./gradlew packageDistributionForCurrentOS packageUberJarForCurrentOS env: - PROJECT_VERSION_NAME: ${{ github.ref_name }} - - # Upload OS-specific artifacts - - name: Upload Linux deb artifact - if: matrix.os == 'ubuntu-latest' - uses: actions/upload-artifact@v4 - with: - name: linux-deb - path: FloconDesktop/composeApp/build/compose/binaries/main/deb/*.deb + PROJECT_VERSION_NAME: ${{ inputs.version || github.ref_name }} - - name: Upload Linux rpm artifact - if: matrix.os == 'ubuntu-latest' - uses: actions/upload-artifact@v4 - with: - name: linux-rpm - path: FloconDesktop/composeApp/build/compose/binaries/main/rpm/*.rpm - - - name: Rename macOS x64 dmg - if: matrix.os == 'macos-15-intel' + - name: Prepare and rename artifacts + shell: bash run: | - mv FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg FloconDesktop/composeApp/build/compose/binaries/main/dmg/macos-x64.dmg - - - name: Rename macOS arm64 dmg - if: matrix.os == 'macos-latest' - run: | - mv FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg FloconDesktop/composeApp/build/compose/binaries/main/dmg/macos-arm64.dmg - - - name: Upload macOS arm64 artifact - if: matrix.os == 'macos-latest' - uses: actions/upload-artifact@v4 - with: - name: macos-arm64-dmg - path: FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg - - - name: Upload macOS x64 artifact - if: matrix.os == 'macos-15-intel' - uses: actions/upload-artifact@v4 - with: - name: macos-x64-dmg - path: FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg - - - name: Upload Windows artifact - if: matrix.os == 'windows-latest' - uses: actions/upload-artifact@v4 - with: - name: windows-msi - path: FloconDesktop/composeApp/build/compose/binaries/main/msi/*.msi - - - name: Upload Linux Release Jar - if: matrix.os == 'ubuntu-latest' - uses: actions/upload-artifact@v4 - with: - name: linux-jar - path: FloconDesktop/composeApp/build/compose/jars/*.jar - - - name: Upload macOS arm64 Release Jar - if: matrix.os == 'macos-latest' - uses: actions/upload-artifact@v4 - with: - name: macos-arm64-jar - path: FloconDesktop/composeApp/build/compose/jars/*.jar - - - name: Upload macOS x64 Release Jar - if: matrix.os == 'macos-15-intel' - uses: actions/upload-artifact@v4 - with: - name: macos-x64-jar - path: FloconDesktop/composeApp/build/compose/jars/*.jar - - - name: Upload Windows Release Jar - if: matrix.os == 'windows-latest' + mkdir -p dist + if [ "${{ matrix.platform }}" = "macos-arm64" ]; then + mv FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg dist/Flocon-macos-arm64.dmg + mv FloconDesktop/composeApp/build/compose/jars/*.jar dist/Flocon-macos-arm64.jar + elif [ "${{ matrix.platform }}" = "macos-x64" ]; then + mv FloconDesktop/composeApp/build/compose/binaries/main/dmg/*.dmg dist/Flocon-macos-x64.dmg + mv FloconDesktop/composeApp/build/compose/jars/*.jar dist/Flocon-macos-x64.jar + elif [ "${{ matrix.platform }}" = "linux-x64" ]; then + mv FloconDesktop/composeApp/build/compose/binaries/main/deb/*.deb dist/ + mv FloconDesktop/composeApp/build/compose/binaries/main/rpm/*.rpm dist/ + mv FloconDesktop/composeApp/build/compose/jars/*.jar dist/Flocon-linux-x64.jar + elif [ "${{ matrix.platform }}" = "windows-x64" ]; then + mv FloconDesktop/composeApp/build/compose/binaries/main/msi/*.msi dist/ + mv FloconDesktop/composeApp/build/compose/jars/*.jar dist/Flocon-windows-x64.jar + fi + + - name: Upload platform artifacts uses: actions/upload-artifact@v4 with: - name: windows-jar - path: FloconDesktop/composeApp/build/compose/jars/*.jar + name: desktop-${{ matrix.platform }} + path: dist/* + retention-days: 3 release: + name: Publish Release needs: build runs-on: ubuntu-latest permissions: contents: write steps: - - name: Checkout source - uses: actions/checkout@v4 - - # Download artifacts from all platforms - - name: Download Linux deb artifact - uses: actions/download-artifact@v4 - with: - name: linux-deb - - - name: Download Linux rpm artifact - uses: actions/download-artifact@v4 - with: - name: linux-rpm - - - name: Download macOS arm64 artifact - uses: actions/download-artifact@v4 - with: - name: macos-arm64-dmg - - - name: Download macOS x64 artifact - uses: actions/download-artifact@v4 - with: - name: macos-x64-dmg - - - name: Download Windows artifact - uses: actions/download-artifact@v4 - with: - name: windows-msi - - - name: Download Linux jar - uses: actions/download-artifact@v4 - with: - name: linux-jar - - - name: Download macOS arm64 jar - uses: actions/download-artifact@v4 - with: - name: macos-arm64-jar - - - name: Download macOS x64 jar - uses: actions/download-artifact@v4 - with: - name: macos-x64-jar - - - name: Download Windows jar + - name: Download all platform artifacts uses: actions/download-artifact@v4 with: - name: windows-jar + path: release-assets + merge-multiple: true - # List downloaded artifacts - - name: Check downloaded artifacts - run: ls -R + - name: List downloaded artifacts + run: ls -la release-assets - # Create GitHub Release - - name: Create GitHub Release - uses: softprops/action-gh-release@v1 + - name: Upload to GitHub Release + uses: softprops/action-gh-release@v3 with: - generate_release_notes: true - files: | - *.deb - *.rpm - *.dmg - *.msi - *.jar + draft: ${{ inputs.draft || false }} + tag_name: ${{ inputs.version || github.ref_name }} + files: release-assets/* env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}