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

Add workflow to check CAIPs #182

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
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
40 changes: 40 additions & 0 deletions .ci/check_caips.main.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#!/usr/bin/env kotlin

@file:Repository("https://jitpack.io")
@file:DependsOn("com.github.komputing:XIP-checker:0.0.1")

import org.komputing.dipchecker.CheckConfig
import org.komputing.dipchecker.checkDate
import org.komputing.dipchecker.checkFolder
import java.io.File
import kotlin.system.exitProcess

val config = CheckConfig("caip",
mapOf(
"title" to { },
"status" to { value ->
if (!listOf("Draft", "Active", "Review", "Final", "Superseded").contains(value)) throw IllegalArgumentException("Invalid status $value")
},
"type" to { value ->
if (!listOf("Meta", "Standard").contains(value)) throw IllegalArgumentException("Invalid type $value")
},
"author" to { },
"created" to { checkDate(it) }),
mapOf(
"requires" to {
if (!(Regex("\\[[0-9]+(, [0-9]+)*\\]").matches(it) || (Regex("[0-9]+").matches(it)))) throw IllegalArgumentException("Invalid requires $it")
},
"discussions-to" to { },
"superseded-by" to { },
"updated" to { checkDate(it) }
)
)

try {
println(checkFolder(File("CAIPs"), config))
} catch (e: Exception) {
println("Validation of CAIPs failed")
println("Reason: " + e.message)
exitProcess(1)
}

12 changes: 12 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
name: CI
on:
push:
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: fwilhe2/setup-kotlin@main
- run: kotlin .ci/check_caips.main.kts
2 changes: 1 addition & 1 deletion CAIPs/caip-27.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ status: Draft
type: Standard
created: 2020-12-12
updated: 2022-11-16
requires: ["2", "25", "171"]
requires: [2, 25, 171]
---

## Simple Summary
Expand Down