Repository navigation
133 lines (114 loc) · 4.27 KB
/
Copy pathci.yml
File metadata and controls
133 lines (114 loc) · 4.27 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: CI
on:
push:
branches: [development, master, main]
paths:
- 'app/**'
- 'packages/**'
- 'tools/generate_icons.py'
- 'packaging/windows/assets/**'
- '.github/workflows/**'
- '.github/scripts/**'
- 'codecov.yml'
pull_request:
branches: [development, master, main]
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
FLUTTER_VERSION: '3.41.2'
jobs:
icons:
name: Platform icon assets
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.12'
- name: Install icon tools
run: |
sudo apt-get update
sudo apt-get install -y librsvg2-bin
python -m pip install pillow==12.0.0
- name: Check platform dimensions, artwork and safe zones
run: python tools/generate_icons.py --check
quality:
name: Code quality checks
runs-on: ubuntu-latest
defaults:
run:
working-directory: app
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Flutter
uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
cache: true
- name: Install dependencies
run: flutter pub get --enforce-lockfile
- name: Check formatting
run: dart format --output=none --set-exit-if-changed .
- name: Analyze code
run: flutter analyze --no-fatal-warnings --no-fatal-infos
- name: Install JUnit converter
run: dart pub global activate junitreport 2.0.2
- name: Check report normalization
run: python3 -m unittest discover -s ../.github/scripts -p 'test_*.py'
- name: Run tests with coverage
id: tests
run: |
mkdir -p build/test-results
flutter test --coverage --file-reporter json:build/test-results/tests.json
- name: Generate JUnit report
if: ${{ !cancelled() && (steps.tests.outcome == 'success' || steps.tests.outcome == 'failure') }}
run: |
python3 ../.github/scripts/normalize_test_report.py \
build/test-results/tests.json build/test-results/tests.junit.json
dart pub global run junitreport:tojunit \
--input build/test-results/tests.junit.json \
--output build/test-results/junit.xml \
--base "$PWD/" \
--package app
test -s build/test-results/junit.xml
- name: Save test results
if: ${{ !cancelled() && hashFiles('app/build/test-results/tests.json') != '' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: client-test-results-${{ github.run_attempt }}
path: app/build/test-results/
if-no-files-found: error
retention-days: 14
- name: Upload test results to Codecov
if: ${{ !cancelled() && hashFiles('app/build/test-results/junit.xml') != '' }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
report_type: test_results
files: app/build/test-results/junit.xml
flags: client
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
disable_search: true
- name: Validate coverage report
if: ${{ !cancelled() && (steps.tests.outcome == 'success' || steps.tests.outcome == 'failure') }}
run: test -s coverage/lcov.info
- name: Save coverage report
if: ${{ !cancelled() && hashFiles('app/coverage/lcov.info') != '' }}
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: client-coverage-${{ github.run_attempt }}
path: app/coverage/lcov.info
if-no-files-found: error
retention-days: 14
- name: Upload coverage to Codecov
if: ${{ !cancelled() && hashFiles('app/coverage/lcov.info') != '' }}
uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1
with:
files: app/coverage/lcov.info
flags: client
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
disable_search: true