Skip to content

Commit

Permalink
Update to github-actions-kotlin-dsl 0.36.0 and use newly available ac…
Browse files Browse the repository at this point in the history
…tion wrappers
  • Loading branch information
Vampire committed Feb 3, 2023
1 parent f8c2328 commit c6f569d
Show file tree
Hide file tree
Showing 8 changed files with 360 additions and 423 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check-action-typing.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
@file:Import("workflow-with-copyright.main.kts")

import it.krzeminski.githubactions.actions.actions.CheckoutV3
import it.krzeminski.githubactions.actions.krzema12.GithubActionsTypingV0
import it.krzeminski.githubactions.actions.krzema12.GithubActionsTypingV1
import it.krzeminski.githubactions.domain.RunnerType.UbuntuLatest
import it.krzeminski.githubactions.domain.triggers.PullRequest
import it.krzeminski.githubactions.domain.triggers.Push
Expand Down Expand Up @@ -47,7 +47,7 @@ workflowWithCopyright(
)
uses(
name = "Check Action Typing",
action = GithubActionsTypingV0()
action = GithubActionsTypingV1()
)
}
}
20 changes: 7 additions & 13 deletions .github/workflows/check-action-typing.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright 2020-2023 Björn Kautler
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# This file was generated using Kotlin DSL (.github/workflows/check-action-typing.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/krzema12/github-workflows-kt
Expand All @@ -22,22 +22,16 @@ on:
pull_request: {}
jobs:
check_yaml_consistency:
name: Check YAML consistency
runs-on: ubuntu-latest
steps:
- id: step-0
name: Check out
uses: actions/checkout@v3
- id: step-1
name: Set up Java in proper version
uses: actions/setup-java@v3
with:
java-version: 17
distribution: zulu
cache: gradle
- id: step-2
name: Execute script
run: rm '.github/workflows/check-action-typing.yaml' && '.github/workflows/check-action-typing.main.kts'
- id: step-3
- id: step-2
name: Consistency check
run: git diff --exit-code '.github/workflows/check-action-typing.yaml'
check_action_typing:
Expand All @@ -54,4 +48,4 @@ jobs:
uses: actions/checkout@v3
- id: step-2
name: Check Action Typing
uses: krzema12/github-actions-typing@v0
uses: krzema12/github-actions-typing@v1
17 changes: 6 additions & 11 deletions .github/workflows/check-dependency-versions.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@

@file:Import("workflow-with-copyright.main.kts")

import it.krzeminski.githubactions.actions.CustomAction
import it.krzeminski.githubactions.actions.actions.CheckoutV3
import it.krzeminski.githubactions.actions.burrunan.GradleCacheActionV1
import it.krzeminski.githubactions.domain.RunnerType.WindowsLatest
import it.krzeminski.githubactions.domain.triggers.Cron
import it.krzeminski.githubactions.domain.triggers.Schedule
Expand Down Expand Up @@ -56,16 +56,11 @@ workflowWithCopyright(
)
uses(
name = "Check Dependency Versions",
action = CustomAction(
actionOwner = "burrunan",
actionName = "gradle-cache-action",
actionVersion = "v1",
inputs = mapOf(
"arguments" to "dependencyUpdates",
"debug" to "false",
"concurrent" to "true",
"gradle-dependencies-cache-key" to "buildSrc/**/Versions.kt"
)
action = GradleCacheActionV1(
arguments = listOf("dependencyUpdates"),
debug = false,
concurrent = true,
gradleDependenciesCacheKey = listOf("buildSrc/**/Versions.kt")
)
)
}
Expand Down
22 changes: 8 additions & 14 deletions .github/workflows/check-dependency-versions.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright 2020-2023 Björn Kautler
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

#
# This file was generated using Kotlin DSL (.github/workflows/check-dependency-versions.main.kts).
# If you want to modify the workflow, please change the Kotlin file and regenerate this YAML file.
# Generated with https://github.com/krzema12/github-workflows-kt
Expand All @@ -22,22 +22,16 @@ on:
- cron: 0 0 * * 5
jobs:
check_yaml_consistency:
name: Check YAML consistency
runs-on: ubuntu-latest
steps:
- id: step-0
name: Check out
uses: actions/checkout@v3
- id: step-1
name: Set up Java in proper version
uses: actions/setup-java@v3
with:
java-version: 17
distribution: zulu
cache: gradle
- id: step-2
name: Execute script
run: rm '.github/workflows/check-dependency-versions.yaml' && '.github/workflows/check-dependency-versions.main.kts'
- id: step-3
- id: step-2
name: Consistency check
run: git diff --exit-code '.github/workflows/check-dependency-versions.yaml'
check_dependency_versions:
Expand All @@ -56,7 +50,7 @@ jobs:
name: Check Dependency Versions
uses: burrunan/gradle-cache-action@v1
with:
arguments: dependencyUpdates
gradle-dependencies-cache-key: buildSrc/**/Versions.kt
debug: false
concurrent: true
gradle-dependencies-cache-key: buildSrc/**/Versions.kt
arguments: dependencyUpdates
53 changes: 26 additions & 27 deletions .github/workflows/test.main.kts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@

@file:Import("workflow-with-copyright.main.kts")

import it.krzeminski.githubactions.actions.CustomAction
import it.krzeminski.githubactions.actions.actions.CacheV3
import it.krzeminski.githubactions.actions.actions.CacheRestoreV3
import it.krzeminski.githubactions.actions.actions.CacheSaveV3
import it.krzeminski.githubactions.actions.actions.CheckoutV3
import it.krzeminski.githubactions.actions.burrunan.GradleCacheActionV1
import it.krzeminski.githubactions.actions.vampire.SetupWslV1
import it.krzeminski.githubactions.actions.vampire.SetupWslV1.Distribution
import it.krzeminski.githubactions.domain.CommandStep
Expand Down Expand Up @@ -127,12 +128,9 @@ workflowWithCopyright(
),
sourceFile = __FILE__
) {
val builtArtifactsCache = CacheV3(
path = listOf(
"action.yml",
"build/distributions/"
),
key = expr { github.run_id }
val builtArtifacts = listOf(
"action.yml",
"build/distributions/"
)

val executeAction = SetupWslV1(
Expand All @@ -154,21 +152,24 @@ workflowWithCopyright(
)
uses(
name = "Build",
action = CustomAction(
actionOwner = "burrunan",
actionName = "gradle-cache-action",
actionVersion = "v1",
inputs = mapOf(
"arguments" to "build --info --stacktrace --scan",
"debug" to "false",
"concurrent" to "true",
"gradle-dependencies-cache-key" to "buildSrc/**/Versions.kt"
)
action = GradleCacheActionV1(
arguments = listOf(
"build",
"--info",
"--stacktrace",
"--scan"
),
debug = false,
concurrent = true,
gradleDependenciesCacheKey = listOf("buildSrc/**/Versions.kt")
)
)
uses(
name = "Save built artifacts to cache",
action = builtArtifactsCache
action = CacheSaveV3(
path = builtArtifacts,
key = expr { github.run_id }
)
)
}

Expand All @@ -184,15 +185,13 @@ workflowWithCopyright(
runsOn = RunnerType.Custom(expr("matrix.environment")),
_customArguments = _customArguments
) {
val restoreBuildArtifacts = uses(
uses(
name = "Restore built artifacts from cache",
action = builtArtifactsCache
)
run(
name = "Fail if cache could not be restored",
condition = "${restoreBuildArtifacts.outputs.cacheHit} == false",
shell = Cmd,
command = "exit 1"
action = CacheRestoreV3(
path = builtArtifacts,
key = expr { github.run_id },
failOnCacheMiss = true
)
)
block()
}
Expand Down
Loading

0 comments on commit c6f569d

Please sign in to comment.