From b3bccc82a5059992198924eeeb0694a883337761 Mon Sep 17 00:00:00 2001 From: Petri Tuomola Date: Thu, 4 Nov 2021 14:30:37 +0800 Subject: [PATCH] FINERACT-1428: Introduce GitHub Actions as CI --- .github/workflows/build-docker.yml | 20 ++++++++++ .github/workflows/build.yml | 38 +++++++++++++++++++ .../workflows/gradle-wrapper-validation.yml | 10 ----- .github/workflows/sonarqube.yml | 32 ++++++++++++++++ 4 files changed, 90 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/build-docker.yml create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/gradle-wrapper-validation.yml create mode 100644 .github/workflows/sonarqube.yml diff --git a/.github/workflows/build-docker.yml b/.github/workflows/build-docker.yml new file mode 100644 index 000000000..782ae6e91 --- /dev/null +++ b/.github/workflows/build-docker.yml @@ -0,0 +1,20 @@ +name: Fineract Docker build + +on: [push] + +jobs: + build: + runs-on: ubuntu-20.04 + + steps: + - uses: actions/checkout@v2 + - name: Build the image + run: docker-compose build + - name: Start the stack + run: docker-compose up -d + - name: Wait for stack to come up + run: sleep 60 + - name: Check health + run: curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/health + - name: Check info + run: (( $(curl -f -k --retry 5 --retry-connrefused --connect-timeout 30 --retry-delay 30 https://localhost:8443/fineract-provider/actuator/info | wc --chars) > 100 )) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..4b7887a5a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,38 @@ +name: Fineract Gradle build +on: [push] + +jobs: + build: + runs-on: ubuntu-20.04 + env: + TZ: Asia/Kolkata + steps: + - name: Set up cache + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Checkout + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'zulu' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + - name: Set up MySQL 5.7 + uses: mirromutth/mysql-action@v1.1 + with: + mysql version: '5.7' + mysql root password: 'mysql' + - name: Initialise databases + run: | + ./gradlew --no-daemon -q createDB -PdbName=fineract_tenants + ./gradlew --no-daemon -q createDB -PdbName=fineract_default + - name: Build & Test + run: ./gradlew --no-daemon -q --console=plain licenseMain licenseTest check build test --fail-fast doc diff --git a/.github/workflows/gradle-wrapper-validation.yml b/.github/workflows/gradle-wrapper-validation.yml deleted file mode 100644 index 405a2b306..000000000 --- a/.github/workflows/gradle-wrapper-validation.yml +++ /dev/null @@ -1,10 +0,0 @@ -name: "Validate Gradle Wrapper" -on: [push, pull_request] - -jobs: - validation: - name: "Validation" - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: gradle/wrapper-validation-action@v1 diff --git a/.github/workflows/sonarqube.yml b/.github/workflows/sonarqube.yml new file mode 100644 index 000000000..c186d0543 --- /dev/null +++ b/.github/workflows/sonarqube.yml @@ -0,0 +1,32 @@ +name: Fineract Sonarqube +on: [push] + +jobs: + build: + runs-on: ubuntu-20.04 + env: + TZ: Asia/Kolkata + SONAR_ORGANIZATION: apache + SONAR_HOST_URL: https://sonarcloud.io + SONAR_TOKEN: "Q2E9ijK+9+R6nkb9o2FQrKUiAozp0325mlGfM25rGV3mCRPyWR/lU8o48r2eaBEX8SEvMvXIO3XXD9SPyUX2+svLz0MOMdfZfNveg6jmcHNRjkzzBK0bMIIGbEH/YqJ+psl4nDmlDd6IK4685/1JSRUJLqeKKK2ulixm6PXcmwZWeKD6TjyXsW50zz3yYIOuROHzys/M6H05h1dZD3j6ztnRsjbr7SmqFEVWSRgEd/aAs+HZB9Fv1xN66csRoQUQKgzoBO9egAQcel65Av0Bf+pOQuzVDVyXNohZEYia02MCGlC6OFvtL7xIXGf/vo02RdnlN4Jnma6P37TaNrmpk2e+EGJaZHmL9cb98+Zc39uPb7qEZkMfDdKrW6QVRtScSuCJzpY58WRgTS0jLCxsDBAMfsrIvWbHntFZL9q5aEkFgecj0pg9u6WHxgA8cuPUY5QzHQo9fEUxNJHGJHQ2FkafLniqJp7DVbsyQHmEggaTrGGrketeYvCbSR1oOnBgImUwzjIV9/zOdd10Wzi8x9HsmzrGBPSBaO4fBxjC1LZwdyue2a2+oKvBqpAGcLpGaCRfHTh2yPXhZW4bw11rOmQxgtOQVBXhveciWAUQuVXIak+RZnu/zRvnul9sZ6bb1hEUPkpUypk+FDeLm8T7y2A++u/jBam2vLc0iff5xtA=" + steps: + - name: Set up cache + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} + restore-keys: | + ${{ runner.os }}-gradle- + - name: Checkout + uses: actions/checkout@v2 + - name: Set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'zulu' + - name: Validate Gradle wrapper + uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b + - name: Sonarqube + run: ./gradlew --no-daemon --console=plain -Dsonar.verbose=true -Dsonar.login=$SONAR_TOKEN -Dsonar.host.url=$SONAR_HOST_URL -Dsonar.organization=$SONAR_ORGANIZATION --info -x rat -x test -x spotbugsMain -x spotbugsTest -x spotbugsGenerated -x licenseMain -x licenseTest -x checkstyleMain -x checkstyleTest --info --stacktrace build sonarqube