Skip to content
Merged
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
25 changes: 25 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: CI

on:
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: temurin
java-version: 17
- name: Run tests
uses: gradle/gradle-build-action@v2
with:
arguments: clean check
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,21 @@ Copyright (c) 2025 Hicham BAKIR

📌 Note: This project is released under the MIT License. Attribution is appreciated. Use responsibly.

## Building and Testing

Use the Gradle Wrapper to build and test the project:

```bash
./gradlew clean check
```

Tests are organized into:

- **Unit tests** (src/test/groovy)
- **Integration tests** (src/integrationTest/groovy)
- **End-to-end tests** (src/e2eTest/groovy)

## Continuous Integration

A GitHub Actions workflow is configured in `.github/workflows/ci.yml` to run tests on push and pull requests to `main`. Merges to `main` should require passing this CI.

91 changes: 91 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
plugins {
id 'java'
id 'groovy'
id 'org.springframework.boot' version '3.5.3'
id 'io.spring.dependency-management' version '1.1.7'
}

group = 'io.bakir.lab.derivatives'
version = '0.0.1-SNAPSHOT'

java {
toolchain {
languageVersion = JavaLanguageVersion.of(17)
}
}

repositories {
mavenCentral()
}

sourceSets {
integrationTest {
groovy.srcDir file('src/integrationTest/groovy')
resources.srcDir file('src/integrationTest/resources')
compileClasspath += sourceSets.main.output + configurations.testRuntimeClasspath
runtimeClasspath += output + compileClasspath
}
e2eTest {
groovy.srcDir file('src/e2eTest/groovy')
resources.srcDir file('src/e2eTest/resources')
compileClasspath += sourceSets.main.output + configurations.testRuntimeClasspath
runtimeClasspath += output + compileClasspath
}
}

configurations {
integrationTestImplementation.extendsFrom testImplementation
integrationTestRuntimeOnly.extendsFrom testRuntimeOnly
e2eTestImplementation.extendsFrom testImplementation
e2eTestRuntimeOnly.extendsFrom testRuntimeOnly
}

dependencies {
// Spring implementation dependencies
implementation 'org.springframework.boot:spring-boot-starter-web'

// Spring Test dependencies
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.spockframework:spock-spring:2.4-M1-groovy-4.0'
testImplementation 'org.spockframework:spock-core:2.4-M1-groovy-4.0'

// Junit Test dependencies
testImplementation 'org.junit.jupiter:junit-jupiter:5.9.2'
testRuntimeOnly 'org.junit.platform:junit-platform-launcher'

integrationTestImplementation 'org.springframework.boot:spring-boot-starter-test'
integrationTestImplementation 'org.spockframework:spock-spring:2.4-M1-groovy-4.0'
integrationTestImplementation 'org.spockframework:spock-core:2.4-M1-groovy-4.0'

e2eTestImplementation 'org.springframework.boot:spring-boot-starter-test'
e2eTestImplementation 'org.spockframework:spock-spring:2.4-M1-groovy-4.0'
e2eTestImplementation 'org.spockframework:spock-core:2.4-M1-groovy-4.0'
}

tasks.named('test') {
useJUnitPlatform()

testLogging {
events "started", "passed", "skipped", "failed"
}
}

task integrationTest(type: Test) {
description = 'Runs integration tests.'
group = 'verification'
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
shouldRunAfter tasks.test
useJUnitPlatform()
}

task e2eTest(type: Test) {
description = 'Runs end-to-end tests.'
group = 'verification'
testClassesDirs = sourceSets.e2eTest.output.classesDirs
classpath = sourceSets.e2eTest.runtimeClasspath
shouldRunAfter integrationTest
useJUnitPlatform()
}

check.dependsOn integrationTest, e2eTest
Binary file added gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading
Loading