-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (65 loc) · 1.94 KB
/
cicd.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: SafeZones CI/CD
on:
push:
branches: [ "develop" ]
pull_request:
branches: [ "develop" ]
env:
DEV_API_URL: http://localhost:8080
STAGING_API_URL: https://staging.api.safezones.com
PRODUCTION_API_URL: https://api.safezones.com
jobs:
backend:
name: Build & Test Backend (Maven)
runs-on: macos-latest
env:
SPRING_PROFILES_ACTIVE: dev
DATABASE_URL: jdbc:mysql://localhost:3306/dev_db
DATABASE_USER: root
DATABASE_PASSWORD: root
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Cache Maven Dependencies
uses: actions/cache@v3
with:
path: ~/.m2
key: maven-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
restore-keys: maven-${{ runner.os }}-
- name: Build Spring Boot App
working-directory: ./backend
run: mvn clean package -DskipTests
- name: Run Tests
working-directory: ./backend
run: mvn test
frontend:
name: Build & Test Flutter App
runs-on: macos-latest
strategy:
matrix:
env: [dev, staging, production]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.x'
cache: true
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Install Dependencies
working-directory: ./frontend
run: flutter pub get
- name: Generate Environment File
working-directory: ./frontend
run: |
echo "API_URL=${{ matrix.env == 'dev' && env.DEV_API_URL || matrix.env == 'staging' && env.STAGING_API_URL || env.PRODUCTION_API_URL }}" > .env