Skip to content

Commit f7f1524

Browse files
committed
Split out the actions
1 parent e22f66e commit f7f1524

File tree

4 files changed

+153
-103
lines changed

4 files changed

+153
-103
lines changed

.github/workflows/gradle-build-develop.yml

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ on:
33
push:
44
branches:
55
- 'develop'
6-
76
env:
87
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
98
RUN_REGION: us-central1
@@ -51,62 +50,3 @@ jobs:
5150
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
5251
with:
5352
arguments: check
54-
# - name: Do SonarQube checks
55-
# uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
56-
# with:
57-
# arguments: sonarqube --info
58-
# env:
59-
# GITHUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
60-
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
61-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
62-
- name: Setup python
63-
run: |
64-
sudo apt-get install python2.7
65-
- name: Export gcloud related env variable
66-
run: export CLOUDSDK_PYTHON="/usr/bin/python2"
67-
# Setup gcloud CLI
68-
- uses: google-github-actions/setup-gcloud@v0
69-
with:
70-
version: "290.0.1"
71-
service_account_key: ${{ secrets.RUN_SA_KEY }}
72-
project_id: ${{ secrets.RUN_PROJECT }}
73-
- name: Auth Configure Docker
74-
run: |-
75-
gcloud --quiet auth configure-docker
76-
- name: Build the Docker image
77-
run: |-
78-
cd server
79-
docker build --tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" .
80-
- name: Push the Docker image to Google Container Registry
81-
run: |-
82-
cd server
83-
docker push "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
84-
- name: Deploy image to Cloud Run
85-
run: |-
86-
gcloud run deploy "$SERVICE_NAME" \
87-
--quiet \
88-
--region "$RUN_REGION" \
89-
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
90-
--memory 1Gi \
91-
--add-cloudsql-instances ${{ secrets.DB_CONNECTION_NAME }} \
92-
--set-env-vars "CLOUD_DB_CONNECTION_NAME=${{ secrets.DB_CONNECTION_NAME }}" \
93-
--set-env-vars "DB_NAME=${{ secrets.DB_NAME }}" \
94-
--set-env-vars "DATASOURCES_DEFAULT_PASSWORD=${{ secrets.DB_PASSWORD }}" \
95-
--set-env-vars "DATASOURCES_DEFAULT_USERNAME=${{ secrets.DB_USERNAME }}" \
96-
--set-env-vars "AES_KEY=${{ secrets.AES_KEY }}" \
97-
--set-env-vars "OAUTH_CLIENT_ID=${{ secrets.OAUTH_CLIENT_ID }}" \
98-
--set-env-vars "OAUTH_CLIENT_SECRET=${{ secrets.OAUTH_CLIENT_SECRET }}" \
99-
--set-env-vars "OAUTH_CALLBACK_URI"=${{ secrets.OAUTH_CALLBACK_URI }} \
100-
--set-env-vars "DIRECTORY_ID=${{ secrets.DIRECTORY_ID }}" \
101-
--set-env-vars "SERVICE_ACCOUNT_CREDENTIALS=${{ secrets.SERVICE_ACCOUNT_CREDENTIALS }}" \
102-
--set-env-vars "GSUITE_SUPER_ADMIN=${{ secrets.GSUITE_SUPER_ADMIN }}" \
103-
--set-env-vars "MJ_APIKEY_PUBLIC=${{ secrets.MJ_APIKEY_PUBLIC }}" \
104-
--set-env-vars "MJ_APIKEY_PRIVATE=${{ secrets.MJ_APIKEY_PRIVATE }}" \
105-
--set-env-vars "GIT_HUB_TOKEN=${{ secrets.GIT_HUB_TOKEN }}" \
106-
--set-env-vars "WEB_ADDRESS=https://checkins-develop-tuvcfzotpq-uc.a.run.app" \
107-
--set-env-vars "[email protected]" \
108-
--set-env-vars "FROM_NAME=Check-Ins - DEVELOP" \
109-
--set-env-vars "^@^MICRONAUT_ENVIRONMENTS=dev,cloud,google,gcp" \
110-
--platform "managed" \
111-
--max-instances 2 \
112-
--allow-unauthenticated

.github/workflows/gradle-build-feature.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,3 @@ jobs:
4747
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
4848
with:
4949
arguments: check
50-
# - name: Do SonarQube checks
51-
# uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
52-
# with:
53-
# arguments: sonarqube --info
54-
# env:
55-
# GITHUB_TOKEN: ${{ secrets.GIT_HUB_TOKEN }}
56-
# SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
57-
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: Gradle Build & Deploy - Develop
2+
on:
3+
push:
4+
branches:
5+
- 'develop'
6+
- 'feature-2532/graal'
7+
env:
8+
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
9+
RUN_REGION: us-central1
10+
SERVICE_NAME: checkins-develop
11+
URL: https://checkins-develop-tuvcfzotpq-uc.a.run.app
12+
jobs:
13+
deploy:
14+
permissions:
15+
contents: 'read'
16+
id-token: 'write'
17+
runs-on: ubuntu-latest
18+
environment:
19+
name: Development
20+
url: ${{ env.URL }}
21+
steps:
22+
- name: '🛒 Checkout'
23+
uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
- name: '📝 Set up Node LTS'
27+
uses: actions/setup-node@v4
28+
with:
29+
node-version: '20'
30+
- name: '☕️ Set up JDK 21'
31+
uses: actions/setup-java@v4
32+
with:
33+
distribution: 'temurin'
34+
java-version: 21
35+
- name: '🪣 Cache Gradle packages'
36+
uses: actions/cache@v4
37+
with:
38+
path: ~/.gradle/caches
39+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
40+
restore-keys: ${{ runner.os }}-gradle
41+
- name: '🐘 Setup Gradle'
42+
uses: gradle/actions/setup-gradle@v4
43+
- name: '🐍 Setup python'
44+
run: |
45+
sudo apt-get install python2.7
46+
- name: '🐍 Export gcloud related env variable'
47+
run: export CLOUDSDK_PYTHON="/usr/bin/python2"
48+
- name: '☁️ Setup gcloud'
49+
uses: google-github-actions/setup-gcloud@v0
50+
with:
51+
version: "290.0.1"
52+
service_account_key: ${{ secrets.RUN_SA_KEY }}
53+
project_id: ${{ secrets.RUN_PROJECT }}
54+
- name: '🐳 Auth Configure Docker'
55+
run: |-
56+
gcloud --quiet auth configure-docker
57+
- name: '🐳 Build the Docker image'
58+
run: |-
59+
cd server
60+
docker build --tag "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" .
61+
- name: '🐳 Push the Docker image to Google Container Registry'
62+
run: |-
63+
cd server
64+
docker push "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
65+
- name: '🏃 Deploy image to Cloud Run'
66+
run: |-
67+
gcloud run deploy "$SERVICE_NAME" \
68+
--quiet \
69+
--region "$RUN_REGION" \
70+
--image "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA" \
71+
--memory 1Gi \
72+
--add-cloudsql-instances ${{ secrets.DB_CONNECTION_NAME }} \
73+
--set-env-vars "CLOUD_DB_CONNECTION_NAME=${{ secrets.DB_CONNECTION_NAME }}" \
74+
--set-env-vars "DB_NAME=${{ secrets.DB_NAME }}" \
75+
--set-env-vars "DATASOURCES_DEFAULT_PASSWORD=${{ secrets.DB_PASSWORD }}" \
76+
--set-env-vars "DATASOURCES_DEFAULT_USERNAME=${{ secrets.DB_USERNAME }}" \
77+
--set-env-vars "AES_KEY=${{ secrets.AES_KEY }}" \
78+
--set-env-vars "OAUTH_CLIENT_ID=${{ secrets.OAUTH_CLIENT_ID }}" \
79+
--set-env-vars "OAUTH_CLIENT_SECRET=${{ secrets.OAUTH_CLIENT_SECRET }}" \
80+
--set-env-vars "OAUTH_CALLBACK_URI"=${{ secrets.OAUTH_CALLBACK_URI }} \
81+
--set-env-vars "DIRECTORY_ID=${{ secrets.DIRECTORY_ID }}" \
82+
--set-env-vars "SERVICE_ACCOUNT_CREDENTIALS=${{ secrets.SERVICE_ACCOUNT_CREDENTIALS }}" \
83+
--set-env-vars "GSUITE_SUPER_ADMIN=${{ secrets.GSUITE_SUPER_ADMIN }}" \
84+
--set-env-vars "MJ_APIKEY_PUBLIC=${{ secrets.MJ_APIKEY_PUBLIC }}" \
85+
--set-env-vars "MJ_APIKEY_PRIVATE=${{ secrets.MJ_APIKEY_PRIVATE }}" \
86+
--set-env-vars "GIT_HUB_TOKEN=${{ secrets.GIT_HUB_TOKEN }}" \
87+
--set-env-vars "WEB_ADDRESS=${{ env.URL }}" \
88+
--set-env-vars "[email protected]" \
89+
--set-env-vars "FROM_NAME=Check-Ins - DEVELOP" \
90+
--set-env-vars "^@^MICRONAUT_ENVIRONMENTS=dev,cloud,google,gcp" \
91+
--platform "managed" \
92+
--max-instances 2 \
93+
--allow-unauthenticated
94+
test:
95+
runs-on: ubuntu-latest
96+
steps:
97+
- name: '🛒 Checkout'
98+
uses: actions/checkout@v4
99+
with:
100+
fetch-depth: 0
101+
- name: '📝 Set up Node LTS'
102+
uses: actions/setup-node@v4
103+
with:
104+
node-version: '20'
105+
- name: '☕️ Set up JDK 21'
106+
uses: actions/setup-java@v4
107+
with:
108+
distribution: 'temurin'
109+
java-version: 21
110+
- name: '🪣 Cache Gradle packages'
111+
uses: actions/cache@v4
112+
with:
113+
path: ~/.gradle/caches
114+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
115+
restore-keys: ${{ runner.os }}-gradle
116+
- name: '🐘 Setup Gradle'
117+
uses: gradle/actions/setup-gradle@v4
118+
- name: '🐘 Run tests with Gradle'
119+
run: ./gradlew check

.github/workflows/gradle-deploy-native-develop.yml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ env:
88
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
99
RUN_REGION: us-central1
1010
SERVICE_NAME: checkins-develop-native
11+
URL: https://checkins-develop-native-832140020593.us-central1.run.app
1112
jobs:
1213
deploy:
1314
permissions:
@@ -16,54 +17,51 @@ jobs:
1617
runs-on: ubuntu-latest
1718
environment:
1819
name: Development - Native
19-
url: https://checkins-develop-native-832140020593.us-central1.run.app
20+
url: ${{ env.URL }}
2021
steps:
21-
- uses: actions/checkout@v4
22+
- name: '🛒 Checkout'
23+
uses: actions/checkout@v4
2224
with:
23-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
24-
- name: Set up Node LTS
25+
fetch-depth: 0
26+
- name: '📝 Set up Node LTS'
2527
uses: actions/setup-node@v4
2628
with:
2729
node-version: '20'
28-
- name: Set up GraalVM 21
30+
- name: '☕️ Set up GraalVM 21'
2931
uses: graalvm/[email protected]
3032
with:
3133
distribution: 'graalvm'
3234
java-version: '21'
33-
- name: Cache Gradle packages
35+
- name: '🪣 Cache Gradle packages'
3436
uses: actions/cache@v4
3537
with:
3638
path: ~/.gradle/caches
3739
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
3840
restore-keys: ${{ runner.os }}-gradle
39-
- name: Setup Gradle
41+
- name: '🐘 Setup Gradle'
4042
uses: gradle/actions/setup-gradle@v4
41-
# - name: Setup python
42-
# run: |
43-
# sudo apt-get install python2.7
44-
# - name: Export gcloud related env variable
45-
# run: export CLOUDSDK_PYTHON="/usr/bin/python2"
46-
- id: 'auth'
47-
uses: 'google-github-actions/auth@v2'
43+
- name: '🐍 Setup python'
44+
run: |
45+
sudo apt-get install python2.7
46+
- name: '🐍 Export gcloud related env variable'
47+
run: export CLOUDSDK_PYTHON="/usr/bin/python2"
48+
- name: '☁️ Setup gcloud'
49+
uses: google-github-actions/setup-gcloud@v0
4850
with:
49-
project_id: 'oci-intern-2019'
50-
workload_identity_provider: 'projects/832140020593/locations/global/workloadIdentityPools/github/providers/my-repo'
51-
- name: 'Set up Cloud SDK'
52-
uses: 'google-github-actions/setup-gcloud@v2'
53-
with:
54-
version: '>= 363.0.0'
55-
- name: 'Auth Configure Docker'
56-
run: |-
57-
gcloud --quiet auth configure-docker
58-
- name: Build a native docker image
51+
version: "290.0.1"
52+
service_account_key: ${{ secrets.RUN_SA_KEY }}
53+
project_id: ${{ secrets.RUN_PROJECT }}
54+
- name: '🐳 Auth Configure Docker'
55+
run: gcloud --quiet auth configure-docker
56+
- name: '🐳 Build the Native Docker image'
5957
run: ./gradlew dockerBuildNative
6058
env:
61-
VITE_APP_API_URL: https://checkins-develop-native-832140020593.us-central1.run.app
62-
- name: Push the Docker image to Google Container Registry
59+
VITE_APP_API_URL: ${{ env.URL }}
60+
- name: '🐳 Push the Docker image to Google Container Registry'
6361
run: |-
6462
cd server
6563
docker push "gcr.io/$PROJECT_ID/$SERVICE_NAME:$GITHUB_SHA"
66-
- name: Deploy image to Cloud Run
64+
- name: '🏃 Deploy image to Cloud Run'
6765
run: |-
6866
gcloud run deploy "$SERVICE_NAME" \
6967
--quiet \
@@ -85,7 +83,7 @@ jobs:
8583
--set-env-vars "MJ_APIKEY_PUBLIC=${{ secrets.MJ_APIKEY_PUBLIC }}" \
8684
--set-env-vars "MJ_APIKEY_PRIVATE=${{ secrets.MJ_APIKEY_PRIVATE }}" \
8785
--set-env-vars "GIT_HUB_TOKEN=${{ secrets.GIT_HUB_TOKEN }}" \
88-
--set-env-vars "WEB_ADDRESS=https://checkins-develop-native-832140020593.us-central1.run.app" \
86+
--set-env-vars "WEB_ADDRESS=${{ env.URL }}" \
8987
--set-env-vars "[email protected]" \
9088
--set-env-vars "FROM_NAME=Check-Ins - DEVELOP" \
9189
--set-env-vars "^@^MICRONAUT_ENVIRONMENTS=dev,cloud,google,gcp" \
@@ -95,25 +93,26 @@ jobs:
9593
test:
9694
runs-on: ubuntu-latest
9795
steps:
98-
- uses: actions/checkout@v4
96+
- name: '🛒 Checkout'
97+
uses: actions/checkout@v4
9998
with:
100-
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
101-
- name: Set up Node LTS
99+
fetch-depth: 0
100+
- name: '📝 Set up Node LTS'
102101
uses: actions/setup-node@v4
103102
with:
104103
node-version: '20'
105-
- name: Set up GraalVM 21
104+
- name: '☕️ Set up GraalVM 21'
106105
uses: graalvm/[email protected]
107106
with:
108107
distribution: 'graalvm'
109108
java-version: '21'
110-
- name: Cache Gradle packages
109+
- name: '🪣 Cache Gradle packages'
111110
uses: actions/cache@v4
112111
with:
113112
path: ~/.gradle/caches
114113
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
115114
restore-keys: ${{ runner.os }}-gradle
116-
- name: Setup Gradle
115+
- name: '🐘 Setup Gradle'
117116
uses: gradle/actions/setup-gradle@v4
118-
- name: Run tests with Gradle
117+
- name: '🐘 Run tests with Gradle'
119118
run: ./gradlew nativeTest

0 commit comments

Comments
 (0)