Skip to content

Merge pull request #2520 from objectcomputing/bugfix-update-micronaut… #1116

Merge pull request #2520 from objectcomputing/bugfix-update-micronaut…

Merge pull request #2520 from objectcomputing/bugfix-update-micronaut… #1116

name: Gradle Build & Deploy - Develop
on:
push:
branches:
- 'develop'
env:
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
RUN_REGION: us-central1
SERVICE_NAME: checkins-develop
jobs:
build:
runs-on: ubuntu-latest
environment:
name: Development
url: https://checkins-develop-tuvcfzotpq-uc.a.run.app/
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up Node LTS
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'temurin' # See 'Supported distributions' for available options
java-version: 21
- name: Cache SonarQube packages
uses: actions/cache@v4
with:
path: ~/.sonar/cache
key: ${{ runner.os }}-sonar
restore-keys: ${{ runner.os }}-sonar
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Validate Gradle wrapper
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
- name: Build with Gradle
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
with:
arguments: assemble
env:
VITE_APP_API_URL: https://checkins-develop-tuvcfzotpq-uc.a.run.app
- name: Gradle runs tests
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
with:
arguments: check
# - name: Do SonarQube checks
# uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
# with:
# arguments: sonarqube --info
# env:
# GITHUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: Setup python
run: |
sudo apt-get install python2.7
- name: Export gcloud related env variable
run: export CLOUDSDK_PYTHON="/usr/bin/python2"
# Setup gcloud CLI
- uses: google-github-actions/setup-gcloud@v0
with:
version: "290.0.1"
service_account_key: ${{ secrets.RUN_SA_KEY }}
project_id: ${{ secrets.RUN_PROJECT }}
- name: Auth Configure Docker
run: |-
gcloud --quiet auth configure-docker
- name: Build the Docker image
run: |-
cd server
docker build --tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" .
- name: Push the Docker image to Google Container Registry
run: |-
cd server
docker push "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
- name: Deploy image to Cloud Run
run: |-
gcloud run deploy "$SERVICE_NAME" \
--quiet \
--region "$RUN_REGION" \
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
--memory 1Gi \
--add-cloudsql-instances ${{ secrets.DB_CONNECTION_NAME }} \
--set-env-vars "CLOUD_DB_CONNECTION_NAME=${{ secrets.DB_CONNECTION_NAME }}" \
--set-env-vars "DB_NAME=${{ secrets.DB_NAME }}" \
--set-env-vars "DATASOURCES_DEFAULT_PASSWORD=${{ secrets.DB_PASSWORD }}" \
--set-env-vars "DATASOURCES_DEFAULT_USERNAME=${{ secrets.DB_USERNAME }}" \
--set-env-vars "AES_KEY=${{ secrets.AES_KEY }}" \
--set-env-vars "OAUTH_CLIENT_ID=${{ secrets.OAUTH_CLIENT_ID }}" \
--set-env-vars "OAUTH_CLIENT_SECRET=${{ secrets.OAUTH_CLIENT_SECRET }}" \
--set-env-vars "OAUTH_CALLBACK_URI"=${{ secrets.OAUTH_CALLBACK_URI }} \
--set-env-vars "DIRECTORY_ID=${{ secrets.DIRECTORY_ID }}" \
--set-env-vars "TYPE=${{ secrets.SA_KEY_TYPE }}" \
--set-env-vars "PROJECT_ID=${{ secrets.RUN_PROJECT }}" \
--set-env-vars "PRIVATE_KEY_ID=${{ secrets.SA_PRIVATE_KEY_ID }}" \
--set-env-vars "PRIVATE_KEY=${{ secrets.SA_PRIVATE_KEY }}" \
--set-env-vars "CLIENT_EMAIL=${{ secrets.SA_CLIENT_EMAIL }}" \
--set-env-vars "CLIENT_ID=${{ secrets.SA_CLIENT_ID }}" \
--set-env-vars "AUTH_URI=${{ secrets.SA_AUTH_URI }}" \
--set-env-vars "TOKEN_URI=${{ secrets.SA_TOKEN_URI }}" \
--set-env-vars "AUTH_PROVIDER_X509_CERT_URL=${{ secrets.SA_AUTH_PROVIDER_X509_CERT_URL }}" \
--set-env-vars "CLIENT_X509_CERT_URL=${{ secrets.SA_CLIENT_X509_CERT_URL }}" \
--set-env-vars "GSUITE_SUPER_ADMIN=${{ secrets.GSUITE_SUPER_ADMIN }}" \
--set-env-vars "MJ_APIKEY_PUBLIC=${{ secrets.MJ_APIKEY_PUBLIC }}" \
--set-env-vars "MJ_APIKEY_PRIVATE=${{ secrets.MJ_APIKEY_PRIVATE }}" \
--set-env-vars "GIT_HUB_TOKEN=${{ secrets.GIT_HUB_TOKEN }}" \
--set-env-vars "WEB_ADDRESS=https://checkins-develop-tuvcfzotpq-uc.a.run.app" \
--set-env-vars "FROM_ADDRESS=kimberlinm@objectcomputing.com" \
--set-env-vars "FROM_NAME=Check-Ins - DEVELOP" \
--set-env-vars "^@^MICRONAUT_ENVIRONMENTS=dev,cloud,google,gcp" \
--platform "managed" \
--max-instances 2 \
--allow-unauthenticated