Update main.yml #292
This file contains 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: Main | |
on: | |
push: | |
branches: | |
- main | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
checks: write | |
statuses: write | |
pages: write | |
id-token: write | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
detekt: | |
name: Detekt - Main | |
runs-on: macos-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Detekt - Main | |
run: ./gradlew detektAll | |
- name: Fix path in logs | |
uses: richardrigutins/[email protected] | |
if: ${{ !cancelled() }} | |
with: | |
files: ${{ github.workspace }}/**/build/reports/detekt/*.xml | |
search-text: ${{ github.workspace }}/ | |
replacement-text: '' | |
- name: Publish detekt results | |
if: ${{ !cancelled()}} | |
uses: gmazzo/[email protected] | |
with: | |
reports: ${{ github.workspace }}/**/build/reports/detekt/*.xml | |
checkName: Detekt | |
token: ${{ github.token }} | |
workflowSummary: true | |
warningsAsErrors: false | |
checksSummary: full | |
failOnError: true | |
ktlint: | |
name: Ktlint - Main | |
runs-on: macos-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Ktlint - Main | |
run: ./gradlew ktlintCheck | |
- name: Fix path in logs | |
uses: richardrigutins/[email protected] | |
if: ${{ !cancelled() }} | |
with: | |
files: ${{ github.workspace }}/**/build/reports/ktlint/**/*.xml | |
search-text: ${{ github.workspace }}/ | |
replacement-text: '' | |
- name: Publish ktlint results | |
if: ${{ !cancelled()}} | |
uses: gmazzo/[email protected] | |
with: | |
reports: ${{ github.workspace }}/**/build/reports/ktlint/**/*.xml | |
checkName: Ktlint | |
token: ${{ github.token }} | |
workflowSummary: true | |
warningsAsErrors: false | |
checksSummary: full | |
failOnError: true | |
build-lib-base: | |
name: Build base - Main | |
if: ${{ success() }} | |
needs: [ detekt, ktlint ] | |
runs-on: macos-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Build | |
continue-on-error: ${{ matrix.config.continueOnError }} | |
run: ./gradlew :ui-base:build | |
build-lib-ui: | |
strategy: | |
matrix: | |
config: [ | |
{ target: tiles, module: ui-tiles, task: build, continueOnError: false }, | |
{ target: tiles expanded, module: ui-tiles-extended, task: build, continueOnError: false }, | |
] | |
name: Build ${{ matrix.config.target }} - Main | |
if: ${{ success() }} | |
needs: [ detekt, build-lib-base ] | |
runs-on: macos-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Build | |
continue-on-error: ${{ matrix.config.continueOnError }} | |
run: ./gradlew :${{ matrix.config.module }}:${{ matrix.config.task }} | |
build-sample: | |
strategy: | |
matrix: | |
config: [ | |
{ target: android, module: androidApp , os: ubuntu-latest, tasks: assembleDebug, continueOnError: false }, | |
{ target: iOS, module: iosApp , os: macos-latest, tasks: compileKotlinIosArm64, continueOnError: false }, | |
{ target: js, module: jsApp , os: ubuntu-latest, tasks: jsBrowserDistribution, continueOnError: false }, | |
{ target: wasm, module: wasmApp , os: ubuntu-latest, tasks: wasmJsBrowserDistribution, continueOnError: false }, | |
{ target: desktop, module: desktopApp , os: ubuntu-latest, tasks: assemble, continueOnError: false } | |
] | |
if: ${{ success() }} | |
needs: [ build-lib-ui ] | |
runs-on: ${{ matrix.config.os }} | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Build sample ${{ matrix.config.target }} - Main | |
continue-on-error: ${{ matrix.config.continueOnError }} | |
run: ./gradlew :samples:${{ matrix.module }}:${{ matrix.config.tasks }} | |
check-sign: | |
name: Check signature - Main | |
if: ${{ success() }} | |
needs: [ build-sample ] | |
runs-on: macos-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Check signature - Main | |
run: ./gradlew signReleasePublication -Psigning.secretKeyRingFile=../secrets.gpg -Psigning.keyId=${{ secrets.GPG_KEY_NAME }} -Psigning.password=${{ secrets.GPG_PASSPHRASE }} | |
fake-publish: | |
name: Fake publish - Main | |
if: ${{ success() }} | |
needs: [ build-sample ] | |
runs-on: macos-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Publish to MavenLocal | |
run: ./gradlew publishToMavenLocal -Psigning.secretKeyRingFile=../secrets.gpg -Psigning.keyId=${{ secrets.GPG_KEY_NAME }} -Psigning.password=${{ secrets.GPG_PASSPHRASE }} | |
publish-dry: | |
name: Dry run publish - Main | |
if: ${{ success() }} | |
needs: [ check-sign, build-sample ] | |
runs-on: macos-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Publish to MavenCentral (dry) | |
run: ./gradlew publishAndReleaseToMavenCentral --no-configuration-cache --max-workers 1 -Psigning.secretKeyRingFile=../secrets.gpg -Psigning.keyId=${{ secrets.GPG_KEY_NAME }} -Psigning.password=${{ secrets.GPG_PASSPHRASE }} -PmavenCentralUsername=${{ secrets.OSSRH_USERNAME }} -PmavenCentralPassword=${{ secrets.OSSRH_PASSWORD }} --dry-run | |
# Deployment job | |
deploy: | |
name: Deploy to Github pages | |
if: ${{ success() }} | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: [ build-sample ] | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v4 | |
- name: Set up JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: adopt | |
java-version: 17 | |
- name: Build sample JS - Main | |
run: ./gradlew wasmJsBrowserDistribution | |
- name: Build dokka - Main | |
run: ./gradlew dokkaGeneratePublicationHtml | |
- name: Copy dokka html to dist | |
run: cp -r docs/html composeApp/build/dist/wasmJs/productionExecutable/dokka | |
- name: Upload your page as github pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: composeApp/build/dist/wasmJs/productionExecutable/ | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |