diff --git a/.github/pkl-workflows/CheckActionsConverted.pkl b/.github/pkl-workflows/CheckActionsConverted.pkl new file mode 100644 index 000000000..40810c24a --- /dev/null +++ b/.github/pkl-workflows/CheckActionsConverted.pkl @@ -0,0 +1,37 @@ +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" + +name = "Check Pkl Actions Converted" + +on { + push {} +} + +jobs { + ["check-actions-converted"] { + name = "Check Actions converted" + `runs-on` = "ubuntu-latest" + steps { + new { + name = "Checkout" + uses = "actions/checkout@v4" + } + new { + name = "Install pkl" + uses = "pkl-community/setup-pkl@v0" + with { + ["pkl-version"] = "0.27.0" + } + } + new { + name = "Convert pkl actions to yaml" + run = """ + pkl eval .github/pkl-workflows/*.pkl -o .github/workflows/%{moduleName}.generated.yml + """ + } + new { + name = "Verify if pkl actions are converted" + run = "git diff --exit-code" + } + } + } +} diff --git a/.github/pkl-workflows/Checks.pkl b/.github/pkl-workflows/Checks.pkl new file mode 100644 index 000000000..2dba734c5 --- /dev/null +++ b/.github/pkl-workflows/Checks.pkl @@ -0,0 +1,63 @@ +amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/com.github.action@0.0.4#/GitHubAction.pkl" + +name = "Checks" + +on { + push {} + pull_request {} +} + +jobs { + ["gradle-checks"] { + permissions = new { + checks = "write" + } + strategy { + matrix { + ["os"] { + "ubuntu-latest" + "windows-latest" + } + ["jdk"] { + "17" + "21" + } + } + } + `runs-on` = "${{ matrix.os }}" + steps { + new { + name = "Checkout" + uses = "actions/checkout@v4" + with { + ["fetch-depth"] = 0 + } + } + new { + name = "Setup JDK" + uses = "actions/setup-java@v4" + with { + ["distribution"] = "adopt" + ["java-version"] = "${{ matrix.jdk }}" + } + } + new { + name = "Setup Gradle" + uses = "gradle/actions/setup-gradle@v4" + } + new { + name = "Gradle check" + run = "./gradlew --info --stacktrace check" + } + new { + name = "Report test results" + uses = "mikepenz/action-junit-report@v5" + `if` = "${{ always() }}" + with { + ["check_name"] = "Test Results JDK ${{ matrix.jdk }} on ${{ matrix.os }}" + ["report_paths"] = "**/build/test-results/test/*.xml" + } + } + } + } +} diff --git a/.github/workflows/CheckActionsConverted.generated.yml b/.github/workflows/CheckActionsConverted.generated.yml new file mode 100644 index 000000000..eeb7c8446 --- /dev/null +++ b/.github/workflows/CheckActionsConverted.generated.yml @@ -0,0 +1,21 @@ +# Do not modify! +# This file was generated from a template using https://github.com/StefMa/pkl-gha + +name: Check Pkl Actions Converted +'on': + push: {} +jobs: + check-actions-converted: + name: Check Actions converted + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Install pkl + uses: pkl-community/setup-pkl@v0 + with: + pkl-version: 0.27.0 + - name: Convert pkl actions to yaml + run: pkl eval .github/pkl-workflows/*.pkl -o .github/workflows/%{moduleName}.generated.yml + - name: Verify if pkl actions are converted + run: git diff --exit-code diff --git a/.github/workflows/Checks.generated.yml b/.github/workflows/Checks.generated.yml new file mode 100644 index 000000000..40c354682 --- /dev/null +++ b/.github/workflows/Checks.generated.yml @@ -0,0 +1,40 @@ +# Do not modify! +# This file was generated from a template using https://github.com/StefMa/pkl-gha + +name: Checks +'on': + pull_request: {} + push: {} +jobs: + gradle-checks: + strategy: + matrix: + os: + - ubuntu-latest + - windows-latest + jdk: + - '17' + - '21' + permissions: + checks: write + runs-on: ${{ matrix.os }} + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Setup JDK + uses: actions/setup-java@v4 + with: + distribution: adopt + java-version: ${{ matrix.jdk }} + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v4 + - name: Gradle check + run: ./gradlew --info --stacktrace check + - name: Report test results + if: ${{ always() }} + uses: mikepenz/action-junit-report@v5 + with: + check_name: Test Results JDK ${{ matrix.jdk }} on ${{ matrix.os }} + report_paths: '**/build/test-results/test/*.xml'