Skip to content

Commit 3279b14

Browse files
committed
Try to set up a workflow... Don't deploy if tests fail
1 parent 5ff7e91 commit 3279b14

6 files changed

+76
-168
lines changed

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

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,14 @@ on:
33
push:
44
branches:
55
- 'develop'
6-
env:
7-
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
8-
RUN_REGION: us-central1
9-
SERVICE_NAME: checkins-develop
6+
- 'feature-**/*'
7+
- 'bugfix-**/*'
8+
- 'chore-**/*'
9+
- 'doc-**/*'
10+
- 'hotfix-**/*'
11+
- 'dependabot/**/*'
1012
jobs:
11-
build:
13+
build-and-test:
1214
runs-on: ubuntu-latest
1315
environment:
1416
name: Development
@@ -38,15 +40,16 @@ jobs:
3840
path: ~/.gradle/caches
3941
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
4042
restore-keys: ${{ runner.os }}-gradle
41-
- name: Validate Gradle wrapper
43+
- name: '🐳 Validate Gradle Wrapper'
4244
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
43-
- name: Build with Gradle
44-
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
45-
with:
46-
arguments: assemble
47-
env:
48-
VITE_APP_API_URL: https://checkins-develop-tuvcfzotpq-uc.a.run.app
49-
- name: Gradle runs tests
45+
- name: '🐳 Gradle run tests'
5046
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
5147
with:
5248
arguments: check
49+
deploy:
50+
runs-on: ubuntu-latest
51+
needs: [build-and-test]
52+
if: github.ref == 'refs/heads/develop' || github.ref == 'feature-2532/graal'
53+
steps:
54+
- name: '🚀 Deploy Image to Cloud Run'
55+
uses: './.github/workflows/gradle-deploy-develop.yml'

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

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Gradle Build & Deploy - Develop
2+
on:
3+
push:
4+
branches:
5+
- 'develop'
6+
- 'feature-**/*'
7+
- 'bugfix-**/*'
8+
- 'chore-**/*'
9+
- 'doc-**/*'
10+
- 'hotfix-**/*'
11+
- 'dependabot/**/*'
12+
jobs:
13+
build-and-test:
14+
runs-on: ubuntu-latest
15+
environment:
16+
name: Development - Native
17+
url: https://checkins-develop-tuvcfzotpq-uc.a.run.app/
18+
steps:
19+
- name: '🛒 Checkout'
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
- name: '📝 Set up Node LTS'
24+
uses: actions/setup-node@v4
25+
with:
26+
node-version: '20'
27+
- name: '☕️ Set up GraalVM 21'
28+
uses: graalvm/[email protected]
29+
with:
30+
distribution: 'graalvm'
31+
java-version: '21'
32+
- name: '🪣 Cache SonarQube packages'
33+
uses: actions/cache@v4
34+
with:
35+
path: ~/.sonar/cache
36+
key: ${{ runner.os }}-sonar
37+
restore-keys: ${{ runner.os }}-sonar
38+
- name: '🪣 Cache Gradle packages'
39+
uses: actions/cache@v4
40+
with:
41+
path: ~/.gradle/caches
42+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
43+
restore-keys: ${{ runner.os }}-gradle
44+
- name: '🐳 Validate Gradle Wrapper'
45+
uses: gradle/wrapper-validation-action@e6e38bacfdf1a337459f332974bb2327a31aaf4b
46+
- name: '🐳 Gradle run native tests'
47+
uses: gradle/gradle-build-action@4137be6a8bf7d7133955359dbd952c0ca73b1021
48+
with:
49+
arguments: nativeTest
50+
deploy:
51+
runs-on: ubuntu-latest
52+
needs: [build-and-test]
53+
if: github.ref == 'refs/heads/develop' || github.ref == 'feature-2532/graal'
54+
steps:
55+
- name: '🚀 Deploy Native Image to Cloud Run'
56+
uses: './.github/workflows/gradle-deploy-native-develop.yml'

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

Lines changed: 0 additions & 44 deletions
This file was deleted.

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

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
name: Gradle Build & Deploy - Develop
1+
name: Gradle Deploy - Develop
22
on:
3-
push:
4-
branches:
5-
- 'develop'
6-
- 'feature-2532/graal'
3+
workflow_call:
74
env:
85
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
96
RUN_REGION: us-central1
@@ -92,29 +89,3 @@ jobs:
9289
--platform "managed" \
9390
--max-instances 2 \
9491
--allow-unauthenticated
95-
test:
96-
runs-on: ubuntu-latest
97-
steps:
98-
- name: '🛒 Checkout'
99-
uses: actions/checkout@v4
100-
with:
101-
fetch-depth: 0
102-
- name: '📝 Set up Node LTS'
103-
uses: actions/setup-node@v4
104-
with:
105-
node-version: '20'
106-
- name: '☕️ Set up JDK 21'
107-
uses: actions/setup-java@v4
108-
with:
109-
distribution: 'temurin'
110-
java-version: 21
111-
- name: '🪣 Cache Gradle packages'
112-
uses: actions/cache@v4
113-
with:
114-
path: ~/.gradle/caches
115-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
116-
restore-keys: ${{ runner.os }}-gradle
117-
- name: '🐘 Setup Gradle'
118-
uses: gradle/actions/setup-gradle@v4
119-
- name: '🐘 Run tests with Gradle'
120-
run: ./gradlew check

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

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
name: Gradle Build & Deploy - Native - Develop
1+
name: Gradle Deploy - Native - Develop
22
on:
3-
push:
4-
branches:
5-
- 'develop'
6-
- 'feature-2532/graal'
3+
workflow_call:
74
env:
85
PROJECT_ID: ${{ secrets.RUN_PROJECT }}
96
RUN_REGION: us-central1
@@ -90,29 +87,3 @@ jobs:
9087
--platform "managed" \
9188
--max-instances 2 \
9289
--allow-unauthenticated
93-
test:
94-
runs-on: ubuntu-latest
95-
steps:
96-
- name: '🛒 Checkout'
97-
uses: actions/checkout@v4
98-
with:
99-
fetch-depth: 0
100-
- name: '📝 Set up Node LTS'
101-
uses: actions/setup-node@v4
102-
with:
103-
node-version: '20'
104-
- name: '☕️ Set up GraalVM 21'
105-
uses: graalvm/[email protected]
106-
with:
107-
distribution: 'graalvm'
108-
java-version: '21'
109-
- name: '🪣 Cache Gradle packages'
110-
uses: actions/cache@v4
111-
with:
112-
path: ~/.gradle/caches
113-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
114-
restore-keys: ${{ runner.os }}-gradle
115-
- name: '🐘 Setup Gradle'
116-
uses: gradle/actions/setup-gradle@v4
117-
- name: '🐘 Run tests with Gradle'
118-
run: ./gradlew nativeTest

0 commit comments

Comments
 (0)