-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from yschimke/workflow
Add build and test workflow
- Loading branch information
Showing
3 changed files
with
89 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/usr/bin/env kotlin | ||
|
||
@file:DependsOn("io.github.typesafegithub:github-workflows-kt:1.11.0") | ||
|
||
import io.github.typesafegithub.workflows.actions.actions.CheckoutV4 | ||
import io.github.typesafegithub.workflows.actions.actions.SetupJavaV4 | ||
import io.github.typesafegithub.workflows.actions.gradle.GradleBuildActionV3 | ||
import io.github.typesafegithub.workflows.domain.RunnerType.UbuntuLatest | ||
import io.github.typesafegithub.workflows.domain.triggers.PullRequest | ||
import io.github.typesafegithub.workflows.domain.triggers.Push | ||
import io.github.typesafegithub.workflows.dsl.workflow | ||
import io.github.typesafegithub.workflows.yaml.writeToFile | ||
|
||
workflow( | ||
name = "Build workflow", | ||
on = listOf( | ||
Push(branches = listOf("main")), | ||
PullRequest(), | ||
), | ||
sourceFile = __FILE__.toPath(), | ||
) { | ||
job(id = "build-and-test", runsOn = UbuntuLatest) { | ||
uses(name = "Check out", action = CheckoutV4()) | ||
uses( | ||
name = "Setup Java", | ||
action = SetupJavaV4(distribution = SetupJavaV4.Distribution.Temurin, javaVersion = "17") | ||
) | ||
uses( | ||
name = "Build", | ||
action = GradleBuildActionV3( | ||
arguments = "test", | ||
) | ||
) | ||
} | ||
}.writeToFile() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# This file was generated using Kotlin DSL (.github/workflows/build_workflow.main.kts). | ||
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file. | ||
# Generated with https://github.com/typesafegithub/github-workflows-kt | ||
|
||
name: 'Build workflow' | ||
on: | ||
push: | ||
branches: | ||
- 'main' | ||
pull_request: {} | ||
jobs: | ||
check_yaml_consistency: | ||
name: 'Check YAML consistency' | ||
runs-on: 'ubuntu-latest' | ||
steps: | ||
- id: 'step-0' | ||
name: 'Check out' | ||
uses: 'actions/checkout@v4' | ||
- id: 'step-1' | ||
name: 'Execute script' | ||
run: 'rm ''.github/workflows/build_workflow.yaml'' && ''.github/workflows/build_workflow.main.kts''' | ||
- id: 'step-2' | ||
name: 'Consistency check' | ||
run: 'git diff --exit-code ''.github/workflows/build_workflow.yaml''' | ||
build-and-test: | ||
runs-on: 'ubuntu-latest' | ||
needs: | ||
- 'check_yaml_consistency' | ||
steps: | ||
- id: 'step-0' | ||
name: 'Check out' | ||
uses: 'actions/checkout@v4' | ||
- id: 'step-1' | ||
name: 'Setup Java' | ||
uses: 'actions/setup-java@v4' | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
- id: 'step-2' | ||
name: 'Build' | ||
uses: 'gradle/gradle-build-action@v3' | ||
with: | ||
arguments: 'test' |
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