Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use GitHub Actions for checks #885

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions .github/pkl-workflows/CheckActionsConverted.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/[email protected]#/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"
}
}
}
}
63 changes: 63 additions & 0 deletions .github/pkl-workflows/Checks.pkl
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
amends "package://pkg.pkl-lang.org/github.com/stefma/pkl-gha/[email protected]#/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"
}
}
}
}
}
21 changes: 21 additions & 0 deletions .github/workflows/CheckActionsConverted.generated.yml
Original file line number Diff line number Diff line change
@@ -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
40 changes: 40 additions & 0 deletions .github/workflows/Checks.generated.yml
Original file line number Diff line number Diff line change
@@ -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'