-
Notifications
You must be signed in to change notification settings - Fork 1
101 lines (82 loc) · 2.6 KB
/
test-analyze.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
# ==================================================
# This is the main worflow for testing and analyzing
# the code.
# ==================================================
name: CI
on:
pull_request:
types: [opened, synchronize]
branches:
- project/**
- release/**
- main
workflow_dispatch:
env:
flutter_version: "3.7.9"
flutter_channel: "stable"
java_version: "12.x"
jobs:
analyze:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Fetch code from repository
uses: actions/checkout@v2
- name: Setup the Flutter environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
flutter-version: ${{ env.flutter_version }}
- name: Setup Melos
run: |
# Disable fvm
sed -i 's|sdkPath:|#sdkPath:|g' melos.yaml
# Activate melos
dart pub global activate melos
- name: Get Flutter dependencies
run: melos get
- name: Check for any formatting issues
run: melos format
- name: Build generated code
run: melos build --no-select
- name: Statically analyze the Dart code
run: melos analyze
test:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Fetch code from repository
uses: actions/checkout@v2
- name: Setup the Flutter environment
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
cache-key: "flutter-:os:-:channel:-:version:-:arch:-:hash:"
cache-path: "${{ runner.tool_cache }}/flutter/:channel:-:version:-:arch:"
flutter-version: ${{ env.flutter_version }}
- name: Setup Melos
run: |
# Disable fvm
sed -i 's|sdkPath:|#sdkPath:|g' melos.yaml
# Activate melos
dart pub global activate melos
- name: Get Flutter dependencies
run: melos get
- name: Run tests and generate coverage
run: melos test
- name: Get code coverage files
id: get_codecov_files
run: |
echo "CODECOV_FILES=$(
find . -name 'lcov.info' -print0 | tr '\0' , | sed 's/,$//'
)" >> $GITHUB_OUTPUT
- name: Upload coverage to codecov
uses: codecov/codecov-action@v3
with:
verbose: true
fail_ci_if_error: true
file: ${{ steps.get_codecov_files.outputs.CODECOV_FILES }}