From f51d555bc611b4aede8b69a0f1f17823a0f1c1f9 Mon Sep 17 00:00:00 2001 From: Martin Azpillaga Aldalur Date: Tue, 27 Feb 2024 13:04:40 +0100 Subject: [PATCH] test in github ci with Java 17 and 18 --- .github/workflows/check.yml | 27 +++++++++++++++++++ ast/build.gradle.kts | 6 +++++ ast/src/test/kotlin/TestAST.kt | 2 +- language-server/build.gradle.kts | 2 +- .../com/strumenta/kuki/TestLanguageServer.kt | 12 ++++----- settings.gradle.kts | 1 - 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..1773f4f --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,27 @@ +name: Checks + +on: [push] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + java: ['17', '18'] + fail-fast: false + name: Base checks (Java ${{ matrix.Java }}) + + steps: + + - uses: actions/checkout@v1 + - name: Setup java + uses: actions/setup-java@v2 + with: + distribution: 'adopt' + java-version: ${{ matrix.java }} + + - name: Test + run: ./gradlew check --stacktrace + + diff --git a/ast/build.gradle.kts b/ast/build.gradle.kts index 674c078..fd1a101 100644 --- a/ast/build.gradle.kts +++ b/ast/build.gradle.kts @@ -20,4 +20,10 @@ tasks.compileKotlin { tasks.test { useJUnitPlatform() +} + +tasks { + named("compileTestKotlin") { + dependsOn("generateTestGrammarSource") + } } \ No newline at end of file diff --git a/ast/src/test/kotlin/TestAST.kt b/ast/src/test/kotlin/TestAST.kt index 56f3623..8414c8d 100644 --- a/ast/src/test/kotlin/TestAST.kt +++ b/ast/src/test/kotlin/TestAST.kt @@ -27,7 +27,7 @@ class TestAST { @Test fun testPastaCarbonara() { - val code = File("../examples/Pasta carbonara.kuki").readText() + val code = File("../examples/Spaghetti carbonara.kuki").readText() val parser = KukiKolasuParser() val parsingResult = parser.parse(code) diff --git a/language-server/build.gradle.kts b/language-server/build.gradle.kts index a7e8135..2af798f 100644 --- a/language-server/build.gradle.kts +++ b/language-server/build.gradle.kts @@ -1,4 +1,4 @@ plugins { id("org.jetbrains.kotlin.jvm") version "1.8.22" - id("com.strumenta.kolasu.languageserver.plugin") version "1.0.0" + id("com.strumenta.kolasu.language-server-plugin") version "1.0.0" } \ No newline at end of file diff --git a/language-server/src/test/kotlin/com/strumenta/kuki/TestLanguageServer.kt b/language-server/src/test/kotlin/com/strumenta/kuki/TestLanguageServer.kt index 989d2d8..2e1a0e3 100644 --- a/language-server/src/test/kotlin/com/strumenta/kuki/TestLanguageServer.kt +++ b/language-server/src/test/kotlin/com/strumenta/kuki/TestLanguageServer.kt @@ -8,8 +8,8 @@ import java.io.File import java.nio.file.Paths class TestAST : TestKolasuServer(KukiKolasuParser(), language = "kuki", fileExtensions = listOf("kuki")) { - private var example = Paths.get("..", "examples", "cookies.kuki").toUri().toString() - private val code = File(Paths.get("..", "examples", "cookies.kuki").toUri()).readText() + private var example = Paths.get("..", "examples", "Almond cookies.kuki").toUri().toString() + private val code = File(Paths.get("..", "examples", "Almond cookies.kuki").toUri()).readText() @Test fun testLanguageServer() { expectDiagnostics(0) @@ -20,14 +20,14 @@ class TestAST : TestKolasuServer(KukiKolasuParser(), language = "kuki", val recipe = outline.children.first() - assertEquals(9, recipe.children.size) + assertEquals(12, recipe.children.size) assertEquals("Named tree", outline.name) - assertEquals("Almond", recipe.children.first().name) + assertEquals("almond", recipe.children.first().name) - val definition = definition(example, Position(11, 15)) + val definition = definition(example, Position(13, 15)) assertNotNull(definition) - val references = references(example, Position(11, 15), true) + val references = references(example, Position(13, 15), true) assertNotNull(references) } } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index 11a1cf2..8740f84 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -2,7 +2,6 @@ rootProject.name = "kuki" pluginManagement { repositories { - mavenLocal() gradlePluginPortal() } }