-
Notifications
You must be signed in to change notification settings - Fork 1
executable file
·142 lines (117 loc) · 3.51 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
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
134
135
136
137
138
139
140
141
# https://github.com/dart-lang/setup-dart
name: unittest
on:
push:
branches: [dev]
paths-ignore:
- 'example/*'
- '**.md'
- '**.txt'
pull_request:
branches: [dev]
paths-ignore:
- 'example/*'
- '**.md'
- '**.txt'
jobs:
test:
timeout-minutes: 9
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest] # [ubuntu-latest, macos-latest, windows-latest]
sdk: [2.12.0, 2.16.1] # dart is null-safe since 2.12
platform: [node, vm, chrome]
#sdk: [stable, beta, dev, 2.12.0-29.10.beta]
steps:
- uses: actions/checkout@v2
# - uses: actions/setup-node@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: ${{ matrix.sdk }}
- name: Install dependencies
run: dart pub get
# - name: VM tests
# run: dart test
- name: Tests
run: dart test --platform ${{ matrix.platform }}
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
with:
sdk: 2.12.0
- name: Install dependencies
run: dart pub get
- name: Analyze
run: dart analyze lib --fatal-infos
- name: Publish (dry run)
run: dart pub publish --dry-run
to-staging:
needs: [test, analyze]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Merge current -> master
uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: staging
github_token: ${{ github.token }}
to-master:
if: github.event.head_commit.message=='publish'
needs: [test, analyze]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
# UPDATE MASTER BRANCH
- name: Merge to master branch
uses: devmasx/merge-branch@v1.3.1
with:
type: now
target_branch: master
github_token: ${{ github.token }}
# ADD GITHUB RELEASE
- name: Get version from pubspec.yaml
run: echo "PKGVER=$(sed -n "s/version://p" pubspec.yaml | xargs)" >> $GITHUB_ENV
- name: Publish GitHub release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ env.PKGVER }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
to-pubdev:
needs: to-master
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: dart-lang/setup-dart@v1
- name: Setup PubDev credentials
# data from cat ~/.pub-cache/credentials.json
run: |
mkdir -p ~/.pub-cache
cat <<EOF > ~/.pub-cache/credentials.json
{
"accessToken":"${{ secrets.PUBDEV_ACCESS_TOKEN }}",
"refreshToken":"${{ secrets.PUBDEV_REFRESH_TOKEN }}",
"tokenEndpoint":"https://accounts.google.com/o/oauth2/token",
"scopes": [ "openid", "https://www.googleapis.com/auth/userinfo.email" ],
"expiration": 1570721159347
}
EOF
- name: Patching 'README.md' for PubDev instead of GitHub
run:
.github/patch_readme_for_pubdev.sh
- name: Install dependencies
run: dart pub get
- name: Reformat code
run: dart format .
- name: Analyze reformatted
run: dart analyze --fatal-infos
- name: Unit-tests for reformatted code
run: dart test
- name: Publish package
run:
#pub publish --dry-run
pub publish -f