diff --git a/.ci/check_caips.main.kts b/.ci/check_caips.main.kts new file mode 100755 index 00000000..1c274682 --- /dev/null +++ b/.ci/check_caips.main.kts @@ -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) +} + diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..0a43adef --- /dev/null +++ b/.github/workflows/ci.yml @@ -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 \ No newline at end of file diff --git a/CAIPs/caip-27.md b/CAIPs/caip-27.md index 76a5db12..1eca88cd 100644 --- a/CAIPs/caip-27.md +++ b/CAIPs/caip-27.md @@ -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