ci: test check-version action #1145
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: build | |
| on: | |
| push: | |
| branches: | |
| - '**' | |
| paths-ignore: | |
| - 'gradle.properties' | |
| - 'LICENSE' | |
| - 'README.adoc' | |
| - 'docs/**' | |
| tags-ignore: | |
| - 'v*' | |
| workflow_dispatch: | |
| jobs: | |
| version-test: | |
| name: testing version action | |
| runs-on: ubuntu-latest | |
| outputs: | |
| BUILD_VERSION: ${{ env.BUILD_VERSION }} | |
| steps: | |
| # - name: checkout | |
| # uses: actions/checkout@v6 | |
| - name: get version | |
| id: get-version | |
| uses: ./.github/actions/check-version | |
| with: | |
| version-file: 'gradle/libs.versions.toml' | |
| version-path: 'versions.processor' | |
| - name: echo version | |
| shell: bash | |
| run: | | |
| echo BUILD_VERSION="${{steps.get-version.outputs.build-version}}" >> $GITHUB_ENV | |
| cat $GITHUB_ENV | |
| version: | |
| name: check version | |
| runs-on: ubuntu-latest | |
| outputs: | |
| BUILD_VERSION: ${{ env.BUILD_VERSION }} | |
| steps: | |
| - name: Set up Homebrew | |
| id: set-up-homebrew | |
| uses: Homebrew/actions/setup-homebrew@main | |
| - name: checkout | |
| uses: actions/checkout@v6 | |
| - name: install dasel | |
| run: | | |
| brew install dasel | |
| cat $GITHUB_ENV | |
| - name: extract version | |
| run: | | |
| version=`cat gradle/libs.versions.toml | dasel -i toml 'versions.processor'` | |
| echo BUILD_VERSION="${version#projectVersion=}" >> $GITHUB_ENV | |
| cat $GITHUB_ENV | |
| - name: actor | |
| run: echo ${{ github.actor }} ${{ github.actor == 'hauner' }} | |
| test: | |
| name: test | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, windows-latest] | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| submodules: true | |
| - name: set up jdk | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| - name: set up gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: run tests | |
| run: | | |
| ./gradlew javaToolchains check --stacktrace | |
| # -Dorg.gradle.configuration-cache.read-only=true | |
| - name: archive test results | |
| uses: actions/upload-artifact@v7 | |
| if: always() | |
| with: | |
| name: test-results-${{ matrix.os }} | |
| path: '*/build/reports' | |
| check-publish: | |
| needs: [version, test, version-test] | |
| name: check publish | |
| runs-on: ubuntu-latest | |
| if: >- | |
| github.actor != 'dependabot[bot]' && | |
| github.actor == 'hauner' && contains(needs.version.outputs.BUILD_VERSION, 'SNAPSHOT') | |
| steps: | |
| - run: | | |
| echo "should publish ..." | |
| echo version BUILD_VERSION ${{needs.version.outputs.BUILD_VERSION}} | |
| echo version-test BUILD_VERSION ${{needs.version-test.outputs.BUILD_VERSION}} | |
| publish: | |
| needs: [check-publish] | |
| name: publish snapshot | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v6 | |
| - name: set up jdk | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| - name: set up gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: publish snapshot | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ORG_GRADLE_PROJECT_signKey: ${{ secrets.SIGN_KEY }} | |
| ORG_GRADLE_PROJECT_signPwd: ${{ secrets.SIGN_PWD }} | |
| PUBLISH_USER: ${{ secrets.PUBLISH_USER }} | |
| PUBLISH_KEY: ${{ secrets.PUBLISH_KEY }} | |
| run: | | |
| ./gradlew publishToMavenCentral --stacktrace | |
| # -Dorg.gradle.configuration-cache.read-only=true | |
| sonar: | |
| needs: [publish] | |
| name: sonar | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - name: cache sonar | |
| uses: actions/cache@v5 | |
| with: | |
| path: | | |
| ~/.sonar/cache | |
| key: sonar-${{ runner.os }} | |
| restore-keys: | | |
| sonar-${{ runner.os }} | |
| - name: set up jdk | |
| uses: actions/setup-java@v5 | |
| with: | |
| distribution: 'temurin' | |
| java-version: 17 | |
| - name: set up gradle | |
| uses: gradle/actions/setup-gradle@v6 | |
| - name: run sonar | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
| run: | | |
| ./gradlew check sonar --stacktrace | |
| # -Dorg.gradle.configuration-cache.read-only=true |