-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (88 loc) · 2.55 KB
/
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
name: CI
on: [push, pull_request]
jobs:
format:
runs-on: ubuntu-latest
timeout-minutes: 5
container:
image: google/dart
steps:
- uses: actions/checkout@v2
- name: Ensure idiomatic Dart source code formatting
run: dart format --set-exit-if-changed .
analyze:
runs-on: ubuntu-latest
timeout-minutes: 5
container:
image: google/dart
steps:
- uses: actions/checkout@v2
- name: Get dependencies
run: dart pub get
- name: Ensure no analysis errors
run: dart analyze --fatal-infos --fatal-warnings lib test
test-ubuntu:
runs-on: ubuntu-latest
timeout-minutes: 5
container:
image: google/dart
steps:
- uses: actions/checkout@v2
- name: Run tests
run: dart test
example-dart:
runs-on: ubuntu-latest
timeout-minutes: 5
container:
image: google/dart
steps:
- uses: actions/checkout@v2
- name: Get dependencies
working-directory: ./example
run: dart pub get
- name: Verify example formatted correctly
working-directory: ./example
run: dart format --set-exit-if-changed .
- name: Verify example has no analysis errors
working-directory: ./example
run: dart analyze --fatal-infos --fatal-warnings .
publish:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: [format, analyze, test-ubuntu, example-dart]
if: github.ref == 'refs/heads/master'
# Continue on error doesn't seem to work?
# Using || true for publishing
# continue-on-error: true
container:
image: google/dart
steps:
- uses: actions/checkout@v2
- name: Setup credentials
run: |
mkdir -p ~/.pub-cache
echo ${{ secrets.PUB_CREDENTIALS_JSON }} > ~/.pub-cache/credentials.json
- name: Publish the package to pub.dev
run: dart pub publish --force || true
- name: Delete credentials
run: rm ~/.pub-cache/credentials.json
coverage:
runs-on: ubuntu-latest
timeout-minutes: 5
needs: publish
if: github.ref == 'refs/heads/master'
container:
image: google/dart
steps:
- uses: actions/checkout@v1
- name: Get the package's dependencies
run: dart pub get
- name: Collect coverage
run: |
dart pub global activate test_coverage
dart pub global run test_coverage
- uses: codecov/codecov-action@v1.0.0
with:
flags: unittests
file: coverage/lcov.info
token: ${{ secrets.CODECOV_TOKEN }}