Skip to content

Iterated ComputeExpectsActualsTest structure #347

Iterated ComputeExpectsActualsTest structure

Iterated ComputeExpectsActualsTest structure #347

Workflow file for this run

name: CI/CD
on:
workflow_dispatch:
push:
branches:
- main
pull_request:
branches:
- main
release:
types: [ published ]
permissions:
checks: write
pull-requests: write
jobs:
compute-projects:
name: Compute projects
runs-on: ubuntu-latest
outputs:
projects: ${{ steps.compute-projects.outputs.projects }}
steps:
- name: Checkout
uses: actions/checkout@v6
- id: compute-projects
run: |
PROJECTS=$(echo "plugin"; find "demo-project" -mindepth 1 -maxdepth 1 -type d | tr '/' ':')
PROJECTS_JSON=$(echo "$PROJECTS" | jq -R . | sort | jq -sc .)
echo "projects=$PROJECTS_JSON" >> "$GITHUB_OUTPUT"
build:
name: Build (${{ matrix.project }})
needs: compute-projects
runs-on: ${{ contains(matrix.project, 'kmp') && 'macos' || 'ubuntu' }}-latest
strategy:
fail-fast: false
matrix:
project: ${{ fromJSON(needs.compute-projects.outputs.projects) }}
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup host
uses: ./.github/actions/setup-host
with:
gradle-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Test & Build
run: ./gradlew ${{ matrix.project }}:build
- name: Publish Test Report
if: ${{ !cancelled() }}
uses: gmazzo/publish-report-annotations@v1
with:
checkName: Test Results (${{ matrix.project }})
build-passed:
name: Build passed
runs-on: ubuntu-latest
needs: build
if: ${{ !cancelled() }}
steps:
- name: Build has passed
if: ${{ needs.build.result != 'success' }}
run: |
echo "Build was not successful!"
exit 1
publish:
name: Publish
runs-on: ubuntu-latest
needs: build
if: ${{ !cancelled() && !github.event.repository.fork && !github.event.pull_request.head.repo.fork }}
steps:
- name: Checkout
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Setup host
uses: ./.github/actions/setup-host
with:
gradle-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }}
- name: Build
run: ./gradlew build
- name: Coverage report
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: '**/build/reports/jacoco/**/*.xml'
- name: Publish
env:
ORG_GRADLE_PROJECT_RELEASE_SIGNING_ENABLED: true
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }}
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONARTYPE_KEY }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONARTYPE_PASSWORD }}
ORG_GRADLE_PROJECT_gitVersionForceSnapshot: ${{ github.event_name != 'release' }}
GRADLE_PUBLISH_KEY: ${{ secrets.GRADLE_PUBLISH_KEY }}
GRADLE_PUBLISH_SECRET: ${{ secrets.GRADLE_PUBLISH_SECRET }}
run: ./gradlew publish
actionlint:
name: Validate Workflows
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Download actionlint
shell: bash
run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash)
- name: Check workflow files
shell: bash
run: ./actionlint -color -format '{{range $err := .}}::error file={{$err.Filepath}},line={{$err.Line}},col={{$err.Column}}::{{$err.Message}}%0A```%0A{{replace $err.Snippet "\\n" "%0A"}}%0A```\n{{end}}' -ignore 'SC2016:'