-
Notifications
You must be signed in to change notification settings - Fork 0
114 lines (100 loc) · 2.87 KB
/
flutter-ci.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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Flutter CI/CD
on:
push:
branches:
- main
- development
- merge/testing
pull_request:
branches:
- main
- development
- merge/testing
jobs:
build:
environment: firebase
name: Build, Test e Checkstyle
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Java 17
uses: actions/setup-java@v3
with:
distribution: 'temurin' # Puoi scegliere 'zulu' o 'adopt' se preferisci
java-version: '17'
- name: Set up Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: '3.24'
channel: 'stable'
- name: Set up Android SDK
uses: android-actions/setup-android@v2
with:
api-levels: 31
build-tools: 31.0.0
- name: Create private config file
run: |
mkdir -p ./src/android/app
cat <<EOF > ./src/android/app/google-services.json
{
"project_info": {
"project_number": "${{ secrets.PROJECT_NUMBER }}",
"project_id": "civiconnect-13aeb",
"storage_bucket": "civiconnect-13aeb.firebasestorage.app"
},
"client": [
{
"client_info": {
"mobilesdk_app_id": "${{ secrets.MOBILESDK_APP_ID }}",
"android_client_info": {
"package_name": "it.unisa.civiconnect"
}
},
"oauth_client": [],
"api_key": [
{
"current_key": "${{ secrets.CURRENT_KEY }}"
}
],
"services": {
"appinvite_service": {
"other_platform_oauth_client": []
}
}
}
],
"configuration_version": "1"
}
EOF
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: 3.x
- name: Validate and Fix JSON
run: |
for file in $(find . -name '*.json'); do
echo "Processing $file"
python3 -m json.tool "$file" > "${file}_fixed" || exit 1
mv "${file}_fixed" "$file"
done
- name: Install dependencies
working-directory: src # Specifica la cartella src
run: flutter pub get
- name: Run Checkstyle (Linter)
working-directory: src
run: flutter analyze
- name: Run tests
working-directory: src
run: flutter test
- name: Build APK
working-directory: src
run: flutter build apk --release
env:
APIKEY_ANDROID: ${{ secrets.APIKEY_ANDROID }}
#APIKEY_IOS: ${{ secrets.APIKEY_IOS }}
#APIKEY_MAC: ${{ secrets.APIKEY_MAC }}
#APIKEY_WEB: ${{ secrets.APIKEY_WEB }}
#APIKEY_WIN: ${{ secrets.APIKEY_WIN }}
- name: Clean up
run: rm src/android/app/google-services.json