Merge pull request #1301 from fiterlatam/SU-199 #1373
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sumas DEV CI | |
on: [push] | |
jobs: | |
integration-tests: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14.0 | |
env: | |
POSTGRES_DB: fineract_tenants | |
POSTGRES_PASSWORD: postgres | |
POSTGRES_USER: postgres | |
ports: | |
- 5432:5432 | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | |
with: | |
fetch-depth: 0 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@387ac29b308b003ca37ba93a6cab5eb57c8f5f93 | |
with: | |
java-version: '17' | |
distribution: 'zulu' | |
cache: gradle | |
- name: Setup Gradle | |
uses: gradle/gradle-build-action@v3 | |
- name: Boot Run Test Server | |
env: | |
FINERACT_DEFAULT_TENANTDB_UID: postgres | |
FINERACT_DEFAULT_TENANTDB_PWD: postgres | |
FINERACT_HIKARI_JDBC_URL: jdbc:postgresql://localhost:5432/fineract_tenants | |
FINERACT_HIKARI_DRIVER_SOURCE_CLASS_NAME: org.postgresql.Driver | |
FINERACT_LOGGING_LEVEL: WARN | |
FINERACT_DEFAULT_TENANTDB_PORT: 5432 | |
FINERACT_DEFAULT_TENANTDB_HOSTNAME: localhost | |
FINERACT_HIKARI_USERNAME: postgres | |
FINERACT_HIKARI_PASSWORD: postgres | |
FINERACT_SERVER_PORT: 8443 | |
FINERACT_DEFAULT_TENANTDB_NAME: fineract_default | |
run: | | |
gradle wrapper | |
./gradlew wrapper --gradle-version=8.5 | |
./gradlew wrapper --version | |
./gradlew dropPGDB -PdbName=$FINERACT_DEFAULT_TENANTDB_NAME -PdbUserName=$FINERACT_HIKARI_USERNAME -PdbUserPassword=$FINERACT_HIKARI_PASSWORD -PjdbcURL=$FINERACT_HIKARI_JDBC_URL | |
./gradlew createPGDB -PdbName=$FINERACT_DEFAULT_TENANTDB_NAME -PdbUserName=$FINERACT_HIKARI_USERNAME -PdbUserPassword=$FINERACT_HIKARI_PASSWORD -PjdbcURL=$FINERACT_HIKARI_JDBC_URL | |
./gradlew spotlessCheck | |
./gradlew --no-daemon --console=plain :fineract-provider:bootRun -q -x rat -x compileTestJava -x test --info & curl --connect-timeout 5 --retry 120 --retry-delay 5 --retry-connrefused -k https://localhost:8443/fineract-provider/actuator/health | |
- name: Run Integration Tests | |
run: | | |
./gradlew --no-daemon --console=plain :integration-tests:cleanTest :integration-tests:test -PcargoDisabled --info | |
./gradlew --stop | |
continuous-integration: | |
if: github.ref == 'refs/heads/fiter/sumas/dev' | |
needs: [integration-tests] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Configure Git | |
run: git fetch --unshallow || true | |
- uses: kamiazya/setup-graphviz@v1 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.LATAM_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.LATAM_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-2 | |
- id: commit | |
uses: pr-mpt/actions-commit-hash@v1 | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v1 | |
- name: Replace client specific configs | |
run: | | |
chmod +x .github/scripts/replace-client-specific-configs.sh | |
./.github/scripts/replace-client-specific-configs.sh | |
- name: Build, tag, and push image to Amazon ECR | |
env: | |
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
ECR_REPOSITORY: latam-backend | |
IMAGE_TAG: ${{ steps.commit.outputs.short }} | |
run: | | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:sumas_$IMAGE_TAG . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:sumas_$IMAGE_TAG | |
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:sumas_latest . | |
docker push $ECR_REGISTRY/$ECR_REPOSITORY:sumas_latest |