diff --git a/.circleci/.circleci.settings.xml b/.circleci/.circleci.settings.xml deleted file mode 100644 index 6ccd6efe..00000000 --- a/.circleci/.circleci.settings.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - artifactory - ${env.ARTIFACTORY_USERNAME} - ${env.ARTIFACTORY_ACCESS_TOKEN} - - - diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index 841f07ec..00000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,112 +0,0 @@ -# Java Maven CircleCI 2.0 configuration file -# -# Check https://circleci.com/docs/2.0/language-java/ for more details -# -version: 2 -executorType: machine -jobs: - build-and-test: - docker: - - image: circleci/openjdk:8u171-jdk - working_directory: ~/repo - environment: - # Customize the JVM maximum heap limit - MAVEN_OPTS: -Xmx3200m - steps: - - checkout - - # Download and cache dependencies - - restore_cache: - keys: - - v1-dependencies-{{ checksum "pom.xml" }} - # fallback to using the latest cache if no exact match is found - - v1-dependencies- - - - run: - name: maven install - command: mvn clean install -DskipTests - - - run: mvn dependency:go-offline - - - save_cache: - paths: - - ~/.m2 - key: v1-dependencies-{{ checksum "pom.xml" }} - - - run: - name: integration tests - command: mvn clean verify -DskipIntegrationTests=false - - - run: - name: Save test results - command: | - mkdir -p ~/junit/ - find . -type f -regex ".*/target/failsafe-reports/.*xml" -exec cp {} ~/junit/ \; - when: always - - store_test_results: - path: ~/junit - - store_artifacts: - path: ~/junit - - release-docker-image: - machine: true - steps: - - checkout - - run: - name: maven install - command: mvn clean install -DskipTests - - run: - name: Release docker image - command: chmod +x .scripts/build-docker-image.sh && ./.scripts/build-docker-image.sh latest - - release-docker-image-snapshot: - machine: true - steps: - - checkout - - run: - name: maven install - command: mvn clean install -DskipTests - - run: - name: Release docker image - command: chmod +x .scripts/build-docker-image.sh && ./.scripts/build-docker-image.sh snapshot - - publish: - docker: - - image: circleci/openjdk:8u171-jdk - working_directory: ~/repo - environment: - # Customize the JVM maximum heap limit - MAVEN_OPTS: -Xmx3200m - steps: - - checkout - - run: - name: Publish - command: mvn -s ./.circleci/.circleci.settings.xml deploy - -workflows: - version: 2 - build-and-publish: - jobs: - - build-and-test - - publish: - requires: - - build-and-test - filters: - branches: - only: - - master - - development - - release-docker-image-snapshot: - requires: - - build-and-test - filters: - branches: - only: - - development - - release-docker-image: - requires: - - build-and-test - filters: - branches: - only: - - master diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000..039e2724 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,35 @@ +name: Eventeum CI + +on: + push: + branches: [ "master" ] + pull_request: + branches: [ "master" ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'corretto' + cache: maven + + - name: Build with Maven + run: mvn clean package + + - name: Run tests + run: mvn verify + + - name: Check Coverage + run: | + COVERAGE=$(cat coverage/target/site/jacoco-aggregate/index.html | grep -o 'Total.*[0-9]\{1,3\}%' | grep -o '[0-9]\{1,3\}%' | head -1 | sed 's/%//') + if [ "$COVERAGE" -lt 25 ]; then + echo "Coverage below 25%: $COVERAGE%" + exit 1 + fi diff --git a/core/pom.xml b/core/pom.xml index 7224f597..170caa0a 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -69,6 +69,26 @@ + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + jacoco-initialize + + prepare-agent + + + + jacoco-report + test + + report + + + + diff --git a/coverage/pom.xml b/coverage/pom.xml new file mode 100644 index 00000000..dd253714 --- /dev/null +++ b/coverage/pom.xml @@ -0,0 +1,56 @@ + + + 4.0.0 + + io.eventeum + eventeum + ${revision} + + + coverage + + + 21 + 21 + + + + + io.eventeum + eventeum-core + ${revision} + + + io.eventeum + eventeum-privacy-plugin + ${revision} + + + io.eventeum + eventeum-server + ${revision} + + + + + + + org.jacoco + jacoco-maven-plugin + 0.8.12 + + + jacoco-site-aggregate + verify + + report-aggregate + + + + + + + + diff --git a/pom.xml b/pom.xml index 20ca161e..36cff1d2 100644 --- a/pom.xml +++ b/pom.xml @@ -31,6 +31,7 @@ core server privacy-plugin + coverage diff --git a/privacy-plugin/pom.xml b/privacy-plugin/pom.xml index 193ba844..2ffa20f4 100644 --- a/privacy-plugin/pom.xml +++ b/privacy-plugin/pom.xml @@ -82,4 +82,4 @@ - \ No newline at end of file +