From 18afb46e7540fd6e4ead8bfa30ac386d8f2c5176 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Moraleda=20Mohedano?= Date: Sat, 26 Oct 2024 11:52:18 +0200 Subject: [PATCH] Remove CircleCI and replace it with GitHub actions (#102) --- .circleci/config.yml | 44 ----------------- .github/workflows/ci.yml | 48 +++++++++++++++++++ .../org/jfleet/util/DatabaseContainers.java | 14 +++--- 3 files changed, 56 insertions(+), 50 deletions(-) delete mode 100644 .circleci/config.yml create mode 100644 .github/workflows/ci.yml diff --git a/.circleci/config.yml b/.circleci/config.yml deleted file mode 100644 index eb55438..0000000 --- a/.circleci/config.yml +++ /dev/null @@ -1,44 +0,0 @@ -version: 2.1 -jobs: - build: - docker: - - image: eclipse-temurin:17.0.10_7-jdk-jammy - - working_directory: ~/repo - - environment: - # Customize the JVM maximum heap limit - JVM_OPTS: -Xmx3200m - TERM: dumb - - steps: - - checkout - - - run: ./gradlew test --console=plain -i - - # Jacoco and codecov - - run: ./gradlew jacocoTestReport - - run: bash <(curl -s https://codecov.io/bash) - - build-latest: - docker: - - image: eclipse-temurin:17.0.10_7-jdk-jammy - - working_directory: ~/repo - - environment: - # Customize the JVM maximum heap limit - JVM_OPTS: -Xmx3200m - TERM: dumb - - steps: - - checkout - - - run: ./gradlew test -Pmysql8 --console=plain -i - -workflows: - version: 2.0 - build-multiple: - jobs: - - build - - build-latest diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..80fd8e4 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,48 @@ +name: JFleet CI/CD + +on: [push, pull_request] + +jobs: + build: + runs-on: ubuntu-latest + env: + # Customize the JVM maximum heap limit + JVM_OPTS: -Xmx3200m + TERM: dumb + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + - name: Build with Gradle + run: ./gradlew test --console=plain -i + # Jacoco and codecov + - name: Jacoco + run: ./gradlew jacocoTestReport + - name: codecov + run: bash <(curl -s https://codecov.io/bash) + + build-latest: + runs-on: ubuntu-latest + env: + # Customize the JVM maximum heap limit + JVM_OPTS: -Xmx3200m + TERM: dumb + steps: + - name: Checkout sources + uses: actions/checkout@v4 + - name: Setup Java + uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 17 + - name: Build with Gradle + run: ./gradlew test -Pmysql8 --console=plain -i + # Jacoco and codecov + - name: Jacoco + run: ./gradlew jacocoTestReport + - name: codecov + run: bash <(curl -s https://codecov.io/bash) diff --git a/jfleet-core/src/test/java/org/jfleet/util/DatabaseContainers.java b/jfleet-core/src/test/java/org/jfleet/util/DatabaseContainers.java index 8e84f70..dd19ac7 100644 --- a/jfleet-core/src/test/java/org/jfleet/util/DatabaseContainers.java +++ b/jfleet-core/src/test/java/org/jfleet/util/DatabaseContainers.java @@ -7,6 +7,7 @@ import static org.jfleet.parameterized.IsMySql5Condition.isMySql5Present; import java.util.HashMap; +import java.util.List; import java.util.Map; import org.jfleet.parameterized.Databases; @@ -23,13 +24,14 @@ public class DatabaseContainers { private static final Map> map = new HashMap<>(); static { - map.put(Postgres, createPostgresContainer()); - map.put(JdbcPosgres, createPostgresContainer()); - map.put(MySql, createMySqlContainer()); - map.put(JdbcMySql, createMySqlContainer()); + PostgreSQLContainer postgresContainer = createPostgresContainer(); + MySQLContainer mysqlContainer = createMySqlContainer(); + map.put(Postgres, postgresContainer); + map.put(JdbcPosgres, postgresContainer); + map.put(MySql, mysqlContainer); + map.put(JdbcMySql, mysqlContainer); - // Start all containers sequentially or some will not be properly initialized - map.values().forEach(GenericContainer::start); + List.of(postgresContainer, mysqlContainer).parallelStream().forEach(GenericContainer::start); } public static JdbcDatabaseContainer getContainer(Databases database) {