From 1e88ba206e041ad44d15a8081c13f5b3f806c8c1 Mon Sep 17 00:00:00 2001 From: rubdev Date: Sat, 9 May 2026 00:48:58 +0200 Subject: [PATCH] added mvn and cicd --- .github/workflows/ci.yml | 33 ++++++++ .gitignore | 5 +- pom.xml | 83 +++++++++++++++++++ .../ordermatching/engine/OrderBookTest.kt | 2 +- 4 files changed, 121 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml create mode 100644 pom.xml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..7e98e93 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,33 @@ +name: CI + +on: + push: + branches: [ "**" ] + pull_request: + branches: [ "**" ] + +jobs: + build-and-test: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up JDK 21 + uses: actions/setup-java@v4 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + + - name: Build and test + run: mvn --batch-mode verify + + - name: Upload test report + if: always() + uses: actions/upload-artifact@v4 + with: + name: test-report + path: target/surefire-reports/ + diff --git a/.gitignore b/.gitignore index d11aa0f..65ecbe6 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ out/ .idea/ build/ .kotlin/ -*.class \ No newline at end of file +*.class + +# Maven +target/ \ No newline at end of file diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..7136efd --- /dev/null +++ b/pom.xml @@ -0,0 +1,83 @@ + + + 4.0.0 + + com.rubenjpdev + order-matching-engine + 1.0.0 + jar + + + 2.1.20 + 5.10.2 + 21 + ${java.version} + ${java.version} + UTF-8 + + + + + + org.jetbrains.kotlin + kotlin-stdlib + ${kotlin.version} + + + + + org.junit.jupiter + junit-jupiter + ${junit.version} + test + + + + + + src/main/java + src/test/java + + + + + org.jetbrains.kotlin + kotlin-maven-plugin + ${kotlin.version} + + + compile + compile + + + src/main/java + + + + + test-compile + test-compile + + + src/test/java + + + + + + ${java.version} + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 3.2.5 + + + + diff --git a/src/test/java/com/rubenjpdev/ordermatching/engine/OrderBookTest.kt b/src/test/java/com/rubenjpdev/ordermatching/engine/OrderBookTest.kt index 469fc86..6a88b5d 100644 --- a/src/test/java/com/rubenjpdev/ordermatching/engine/OrderBookTest.kt +++ b/src/test/java/com/rubenjpdev/ordermatching/engine/OrderBookTest.kt @@ -247,7 +247,7 @@ class OrderBookTest { assertNull(book.asks[101L], "Level 101 must be pruned") assertNotNull(book.asks[102L], "Level 102 must still exist") - assertEquals(101L, book.asks.size.toLong().also { assertEquals(1L, it) }.let { 102L }) + assertEquals(1, book.asks.size, "Only level 102 must remain") } @Test