feat(plugin): add mergeVariants to report KMP artifacts under their root coordinate
#1149
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
| # Thanks to https://github.com/coil-kt/coil/blob/master/.github/workflows/ci.yml | |
| name: CI | |
| on: | |
| push: | |
| tags: | |
| - '*' | |
| pull_request: | |
| jobs: | |
| publish_archives: | |
| name: Publish Archives | |
| if: startsWith(github.ref, 'refs/tags/') | |
| strategy: | |
| matrix: | |
| os: [ macos-latest ] # , ubuntu-latest, windows-latest | |
| runs-on: ${{matrix.os}} | |
| steps: | |
| - name: Checkout the repo | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: | | |
| 17 | |
| 21 | |
| - name: Copy CI gradle.properties | |
| run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6 | |
| - name: Cache konan | |
| uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6 | |
| with: | |
| path: ~/.konan | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }} | |
| restore-keys: | | |
| gradle-${{ runner.os }}- | |
| - name: Release Plugin | |
| if: matrix.os == 'macos-latest' && !contains(github.ref, '+') | |
| run: | | |
| cd plugin-build | |
| ./gradlew publishPlugins --no-configuration-cache | true | |
| env: | |
| GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }} | |
| GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }} | |
| - name: Publish the macOS artifacts | |
| if: matrix.os == 'macos-latest' | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| run: | | |
| ./gradlew aboutlibraries-core:publishAllPublicationsToMavenCentralRepository --no-daemon -Plibrary_core_only --no-configure-on-demand --no-parallel --no-configuration-cache | |
| ./gradlew aboutlibraries-compose:publishAllPublicationsToMavenCentralRepository -x test -x lint -Plibrary_compose_only --no-configure-on-demand --no-parallel --no-configuration-cache | |
| ./gradlew aboutlibraries-compose-m2:publishAllPublicationsToMavenCentralRepository -x test -x lint -Plibrary_compose_only --no-configure-on-demand --no-parallel --no-configuration-cache | |
| ./gradlew aboutlibraries-compose-m3:publishAllPublicationsToMavenCentralRepository -x test -x lint -Plibrary_compose_m3_only --no-configure-on-demand --no-parallel --no-configuration-cache | |
| ./gradlew aboutlibraries-compose-wear-m3:publishAllPublicationsToMavenCentralRepository -x test -x lint -Plibrary_compose_wear_m3_only --no-configure-on-demand --no-parallel --no-configuration-cache | |
| - name: Publish the windows artifact | |
| if: matrix.os == 'windows-latest' | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| run: ./gradlew aboutlibraries-core:publishMingwX64PublicationToMavenCentralRepository -Plibrary_core_only --no-configure-on-demand --no-parallel --no-configuration-cache | |
| - name: Publish the linux artifact | |
| if: matrix.os == 'ubuntu-latest' | |
| env: | |
| ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.NEXUS_USERNAME }} | |
| ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.NEXUS_PASSWORD }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_KEY_ID }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} | |
| ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} | |
| run: | | |
| ./gradlew aboutlibraries-core:publishLinuxX64PublicationToMavenCentralRepository -Plibrary_core_only --no-configure-on-demand --no-parallel --no-configuration-cache | |
| build: | |
| name: Build | |
| runs-on: macos-latest | |
| permissions: | |
| contents: read | |
| security-events: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| fetch-depth: 100 | |
| - uses: actions/setup-java@b6effb05e454b25005698d916606bdc6ffcbf961 # v5 | |
| with: | |
| distribution: 'zulu' | |
| java-version: | | |
| 17 | |
| 21 | |
| - name: Setup Gradle | |
| uses: gradle/actions/setup-gradle@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6 | |
| - name: Validate gradle wrapper | |
| uses: gradle/actions/wrapper-validation@9c971963bec38e04b3d30dcc455b5382be2fdbfb # v6 | |
| - name: Copy CI gradle.properties | |
| run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
| - name: Run Gradle Plugin Tests | |
| run: | | |
| cd plugin-build | |
| ./gradlew test | |
| - name: Publish Test Report | |
| uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6 | |
| if: success() || failure() # always run even if the previous step fails | |
| with: | |
| report_paths: 'plugin-build/plugin/build/test-results/test/TEST-*.xml' | |
| - name: Publish plugin locally | |
| run: | | |
| cd plugin-build | |
| ./gradlew publishToMavenLocal --no-configuration-cache | |
| - name: Run Lint on Gradle Plugin | |
| run: | | |
| ./gradlew plugin-build:plugin:lint | |
| - name: Build Debug | |
| run: ./gradlew :sample:android:assembleDebug | |
| - name: Run Api Validation | |
| if: github.event_name == 'pull_request' | |
| run: ./gradlew apiCheck | |
| - name: Run Tests | |
| run: | | |
| ./gradlew :sample:android:verifyPaparazzi | |
| - name: Publish Test Report | |
| if: false && (failure() || success()) && github.event_name == 'pull_request' | |
| uses: mikepenz/action-junit-report@d9f48fc87bc235f7e214acf696ca5abc0a986f16 # v6 | |
| with: | |
| report_paths: '**/sample/android/build/test-results/testDebugUnitTest/TEST-*.xml' | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| fail_on_failure: true | |
| annotate_only: true | |
| detailed_summary: true | |
| - name: Archive Test Report | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: "Test-Artifacts" | |
| path: "sample/android/build/reports/paparazzi/debug/" | |
| - name: Run Lint | |
| if: github.event_name == 'pull_request' | |
| run: ./gradlew lintDebug | |
| - name: Upload Lint SARIF (aboutlibraries) | |
| if: always() && github.event_name == 'pull_request' && hashFiles('aboutlibraries/build/reports/lint-results-debug.sarif') != '' | |
| uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4 | |
| with: | |
| sarif_file: 'aboutlibraries/build/reports/lint-results-debug.sarif' | |
| category: lint-aboutlibraries | |
| - name: Upload Lint SARIF (aboutlibraries-compose-wear-m3) | |
| if: always() && github.event_name == 'pull_request' && hashFiles('aboutlibraries-compose-wear-m3/build/reports/lint-results-debug.sarif') != '' | |
| uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4 | |
| with: | |
| sarif_file: 'aboutlibraries-compose-wear-m3/build/reports/lint-results-debug.sarif' | |
| category: lint-aboutlibraries-compose-wear-m3 | |
| - name: Upload Lint SARIF (app) | |
| if: always() && github.event_name == 'pull_request' && hashFiles('app/build/reports/lint-results-debug.sarif') != '' | |
| uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4 | |
| with: | |
| sarif_file: 'app/build/reports/lint-results-debug.sarif' | |
| category: lint-app | |
| - name: Upload Lint SARIF (sample/android) | |
| if: always() && github.event_name == 'pull_request' && hashFiles('sample/android/build/reports/lint-results-debug.sarif') != '' | |
| uses: github/codeql-action/upload-sarif@f205ea1c3313d32999d8d6a48b4f6530d4437b38 # v4 | |
| with: | |
| sarif_file: 'sample/android/build/reports/lint-results-debug.sarif' | |
| category: lint-sample-android | |
| - name: Prepare Keystore and Local. | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: | | |
| echo "${{ secrets.KEYSTORE }}" > opensource.jks.asc | |
| gpg -d --passphrase "${{ secrets.KEYSTORE_PASSPHRASE }}" --batch "opensource.jks.asc" > "sample/android/opensource.jks" | |
| - name: Build Release App | |
| if: startsWith(github.ref, 'refs/tags/') | |
| run: ./gradlew sample:android:assembleRelease sample:android:bundleRelease -P"com.mikepenz.android.signing.enabled"="true" -P"com.mikepenz.android.signing.storeFile"="opensource.jks" -P"com.mikepenz.android.signing.storePassword"="${{ secrets.STORE_PASSWORD }}" -P"com.mikepenz.android.signing.keyAlias"="${{ secrets.KEY_ALIAS }}" -P"com.mikepenz.android.signing.keyPassword"="${{ secrets.KEY_PASSWORD }}" | |
| - name: Collect artifacts | |
| run: | | |
| COLLECT_PWD=${PWD} | |
| mkdir -p "artifacts" | |
| find . -name "*-staging.apk" -type f -exec cp {} "artifacts" \; | |
| find . -name "*-release.apk" -type f -exec cp {} "artifacts" \; | |
| find . -name "*-release.aab" -type f -exec cp {} "artifacts" \; | |
| - name: Archive Artifacts | |
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7 | |
| with: | |
| name: "App-Artifacts" | |
| path: artifacts/* | |
| release: | |
| name: Release | |
| runs-on: ubuntu-latest | |
| needs: build | |
| if: startsWith(github.ref, 'refs/tags/') | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7 | |
| with: | |
| fetch-depth: 100 | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8 | |
| with: | |
| name: "App-Artifacts" | |
| path: artifacts | |
| - name: Build Changelog | |
| id: github_release | |
| uses: mikepenz/release-changelog-builder-action@c9bcd8238b6f41e05561348339429d360b1c0247 # v6 | |
| with: | |
| configuration: ".github/config/configuration.json" | |
| ignorePreReleases: ${{ !contains(github.ref, '-') }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Release | |
| uses: mikepenz/action-gh-release@2a00e201320fb618d8e705a736286b2e31aa48e2 # v3 | |
| with: | |
| body: ${{steps.github_release.outputs.changelog}} | |
| prerelease: ${{ contains(github.ref, '-rc') || contains(github.ref, '-b') || contains(github.ref, '-a') }} | |
| files: artifacts/* | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |