Skip to content

Commit 0423973

Browse files
committed
Improve CI/CD
1 parent def3b81 commit 0423973

18 files changed

+292
-334
lines changed

.envrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
dotenv_if_exists .env

.github/scripts/commit_release_changes.sh

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

.github/scripts/decrypt_android_secrets.sh

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

.github/workflows/android_production_release.yml

Lines changed: 28 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -9,31 +9,27 @@ concurrency:
99
cancel-in-progress: true
1010

1111
env:
12-
branch: "master"
13-
java_version: "12.x"
14-
ruby_path: "./vendor/bundle"
12+
working_directory: android
13+
java_version: "17.x"
14+
java_distribution: "zulu"
15+
ruby_version: "3.3.4"
1516

1617
jobs:
1718
deploy_android:
1819
name: Deploy to Play Store
1920
runs-on: ubuntu-latest
2021
steps:
21-
# Set up
22-
- uses: actions/checkout@v3
22+
- uses: actions/checkout@v4
23+
24+
- uses: ruby/setup-ruby@v1
2325
with:
24-
ref: ${{ env.branch }}
25-
- uses: actions/setup-java@v1
26+
ruby-version: ${{ env.ruby_version }}
27+
working-directory: ${{ env.working_directory }}
28+
bundler-cache: true
29+
- uses: actions/setup-java@v4
2630
with:
2731
java-version: ${{ env.java_version }}
28-
- name: Initialize environment variables from FVM config
29-
uses: kuhnroyal/flutter-fvm-config-action@v1
30-
- name: Cache ruby dependencies
31-
uses: actions/cache@v2
32-
with:
33-
path: ${{ env.ruby_path }}
34-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
35-
restore-keys: |
36-
${{ runner.os }}-gems-
32+
distribution: ${{ env.java_distribution }}
3733
- name: Cache Gradle packages
3834
uses: actions/cache@v2
3935
with:
@@ -43,19 +39,24 @@ jobs:
4339
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
4440
restore-keys: |
4541
${{ runner.os }}-gradle-
46-
- name: Cache Flutter dependencies
47-
uses: actions/cache@v2
48-
with:
49-
path: /opt/hostedtoolcache/flutter
50-
key: ${{ runner.os }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
51-
- name: Decrypt keys
52-
run: sh ./.github/scripts/decrypt_android_secrets.sh
53-
env:
54-
ANDROID_KEYS_SECRET_PASSPHRASE: ${{ secrets.ANDROID_KEYS_SECRET_PASSPHRASE }}
55-
- uses: subosito/flutter-action@v2
42+
43+
- name: Initialize environment variables from FVM config
44+
uses: kuhnroyal/flutter-fvm-config-action@v2
45+
- name: Set up Flutter
46+
uses: subosito/flutter-action@v2
5647
with:
5748
channel: ${{ env.FLUTTER_CHANNEL }}
5849
flutter-version: ${{ env.FLUTTER_VERSION }}
50+
cache: true
51+
52+
- name: Install tools
53+
run: ./tool/install.sh
54+
55+
# Decrypt secrets
56+
- name: Decrypt secrets
57+
run: ./tool/decrypt_android_secrets.sh
58+
env:
59+
ANDROID_KEYS_SECRET_PASSPHRASE: ${{ secrets.ANDROID_KEYS_SECRET_PASSPHRASE }}
5960

6061
# Flutter actions
6162
- run: flutter doctor
@@ -68,8 +69,7 @@ jobs:
6869
uses: maierj/[email protected]
6970
with:
7071
lane: beta
71-
subdirectory: android
72-
bundle-install-path: ${{ env.ruby_path }}
72+
subdirectory: ${{ env.working_directory }}
7373

7474
# Clean up unnecessary gradle cache
7575
- name: Cleanup Gradle Cache

.github/workflows/ios_production_release.yml

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -9,45 +9,32 @@ concurrency:
99
cancel-in-progress: true
1010

1111
env:
12-
branch: "master"
13-
java_version: "12.x"
14-
ruby_path: "./vendor/bundle"
15-
ruby_version: "2.7.2"
12+
working_directory: ios
13+
ruby_version: "3.3.4"
1614

1715
jobs:
1816
deploy_ios:
1917
name: Deploy beta build to TestFlight
2018
runs-on: macos-latest
2119
steps:
22-
# Set up
23-
- uses: actions/checkout@v1
24-
with:
25-
ref: ${{ env.branch }}
20+
- uses: actions/checkout@v4
21+
2622
- uses: ruby/setup-ruby@v1
2723
with:
2824
ruby-version: ${{ env.ruby_version }}
25+
working-directory: ${{ env.working_directory }}
2926
bundler-cache: true
30-
- uses: actions/setup-java@v1
31-
with:
32-
java-version: ${{ env.java_version }}
27+
3328
- name: Initialize environment variables from FVM config
34-
uses: kuhnroyal/flutter-fvm-config-action@v1
35-
- name: Cache ruby dependencies
36-
uses: actions/cache@v2
37-
with:
38-
path: ${{ env.ruby_path }}
39-
key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
40-
restore-keys: |
41-
${{ runner.os }}-gems-
42-
- name: Cache Flutter dependencies
43-
uses: actions/cache@v2
44-
with:
45-
path: /Users/runner/hostedtoolcache/flutter
46-
key: ${{ runner.os }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
29+
uses: kuhnroyal/flutter-fvm-config-action@v2
4730
- uses: subosito/flutter-action@v2
4831
with:
4932
channel: ${{ env.FLUTTER_CHANNEL }}
5033
flutter-version: ${{ env.FLUTTER_VERSION }}
34+
cache: true
35+
36+
- name: Install tools
37+
run: ./tool/install.sh
5138

5239
# Flutter actions
5340
- run: flutter doctor
@@ -60,8 +47,7 @@ jobs:
6047
uses: maierj/[email protected]
6148
with:
6249
lane: beta
63-
subdirectory: ios
64-
bundle-install-path: ${{ env.ruby_path }}
50+
subdirectory: ${{ env.working_directory }}
6551
env:
6652
APP_STORE_CONNECT_TEAM_ID: ${{ secrets.APP_STORE_CONNECT_TEAM_ID }}
6753
DEVELOPER_APP_ID: ${{ secrets.DEVELOPER_APP_ID }}

.github/workflows/main.yml

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -14,30 +14,24 @@ concurrency:
1414
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
1515
cancel-in-progress: true
1616

17-
env:
18-
java_version: "12.x"
19-
2017
jobs:
2118
default_run:
2219
name: Format, Analyze and Test
2320
runs-on: ubuntu-latest
24-
2521
steps:
26-
- uses: actions/checkout@v3
27-
- uses: actions/setup-java@v1
28-
with:
29-
java-version: ${{ env.java_version }}
22+
- uses: actions/checkout@v4
23+
3024
- name: Initialize environment variables from FVM config
31-
uses: kuhnroyal/flutter-fvm-config-action@v1
32-
- name: Cache Flutter dependencies
33-
uses: actions/cache@v2
34-
with:
35-
path: /opt/hostedtoolcache/flutter
36-
key: ${{ runner.os }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
37-
- uses: subosito/flutter-action@v1
25+
uses: kuhnroyal/flutter-fvm-config-action@v2
26+
- uses: subosito/flutter-action@v2
3827
with:
3928
channel: ${{ env.FLUTTER_CHANNEL }}
4029
flutter-version: ${{ env.FLUTTER_VERSION }}
30+
cache: true
31+
32+
- name: Install tools
33+
run: ./tool/install.sh
34+
4135
- run: flutter doctor
4236
- run: flutter pub get
4337
- run: dart format --set-exit-if-changed -l 120 lib
@@ -46,14 +40,10 @@ jobs:
4640
- run: flutter test --no-pub --coverage --test-randomize-ordering-seed random
4741

4842
- name: Clean-up lcov
49-
run: |
50-
dart pub global activate clean_coverage
51-
clean_coverage clean --exclusions '**/generated/*' coverage/lcov.info
52-
clean_coverage clean --exclusions '**/presentation/theme/*' coverage/lcov.info
53-
clean_coverage clean --exclusions '**/presentation/constants/*' coverage/lcov.info
54-
clean_coverage clean --exclusions '**/*_mock_impl.dart' coverage/lcov.info
43+
run: ./tool/clean_coverage.sh
5544

5645
- name: Upload coverage to codecov
57-
uses: codecov/codecov-action@v1
46+
uses: codecov/codecov-action@v4
5847
with:
48+
token: ${{ secrets.CODECOV_TOKEN }}
5949
fail_ci_if_error: true

.github/workflows/production_release.yml

Lines changed: 20 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,24 @@ concurrency:
2828
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
2929
cancel-in-progress: true
3030

31-
env:
32-
branch: "master"
33-
java_version: "12.x"
34-
3531
jobs:
3632
sanity_check:
3733
name: Format, Analyse & Test
3834
runs-on: ubuntu-latest
3935
steps:
40-
- uses: actions/checkout@v3
41-
with:
42-
ref: ${{ env.branch }}
43-
- uses: actions/setup-java@v1
44-
with:
45-
java-version: ${{ env.java_version }}
36+
- uses: actions/checkout@v4
37+
4638
- name: Initialize environment variables from FVM config
47-
uses: kuhnroyal/flutter-fvm-config-action@v1
48-
- name: Cache Flutter dependencies
49-
uses: actions/cache@v2
50-
with:
51-
path: /opt/hostedtoolcache/flutter
52-
key: ${{ runner.os }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
39+
uses: kuhnroyal/flutter-fvm-config-action@v2
5340
- uses: subosito/flutter-action@v2
5441
with:
5542
channel: ${{ env.FLUTTER_CHANNEL }}
5643
flutter-version: ${{ env.FLUTTER_VERSION }}
44+
cache: true
45+
46+
- name: Install tools
47+
run: ./tool/install.sh
48+
5749
- run: flutter doctor
5850
- run: flutter pub get
5951

@@ -72,25 +64,21 @@ jobs:
7264
name: Create release
7365
runs-on: ubuntu-latest
7466
steps:
75-
# Set up
76-
- uses: actions/checkout@v3
67+
- uses: actions/checkout@v4
7768
with:
78-
ref: ${{ env.branch }}
7969
token: ${{ secrets.API_TOKEN_GITHUB }}
80-
- uses: actions/setup-java@v1
81-
with:
82-
java-version: ${{ env.java_version }}
70+
8371
- name: Initialize environment variables from FVM config
84-
uses: kuhnroyal/flutter-fvm-config-action@v1
85-
- name: Cache Flutter dependencies
86-
uses: actions/cache@v2
87-
with:
88-
path: /opt/hostedtoolcache/flutter
89-
key: ${{ runner.os }}-flutter-install-cache-${{ env.FLUTTER_VERSION }}
72+
uses: kuhnroyal/flutter-fvm-config-action@v2
9073
- uses: subosito/flutter-action@v2
9174
with:
9275
channel: ${{ env.FLUTTER_CHANNEL }}
9376
flutter-version: ${{ env.FLUTTER_VERSION }}
77+
cache: true
78+
79+
- name: Install tools
80+
run: ./tool/install.sh
81+
9482
- run: flutter doctor
9583
- run: flutter pub get
9684

@@ -102,11 +90,10 @@ jobs:
10290
10391
# Commit version changes
10492
- name: Commit Release Changes
105-
working-directory: .github/scripts
106-
run: sh ./commit_release_changes.sh
107-
env:
108-
TOKEN: ${{ secrets.API_TOKEN_GITHUB }}
109-
BRANCH: ${{ env.branch }}
93+
uses: stefanzweifel/git-auto-commit-action@v5
94+
with:
95+
commit_message: '[BUILD] ${{ env.TAG }} [skip ci]'
96+
file_pattern: pubspec.yaml
11097

11198
# Create release entry & Trigger deployment
11299
- name: Create Release Entry

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,5 @@ app.*.map.json
5454
.fvm/
5555

5656
.last_build_id
57+
58+
.env

bin/.gitignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)