-
-
Notifications
You must be signed in to change notification settings - Fork 273
191 lines (160 loc) · 4.88 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
name: CI
on:
pull_request:
types: [opened, synchronize, reopened]
push:
branches:
# Match SemVer major release branches, e.g. "2.x" or ".x"
- '[0-9]+.x'
- 'main'
- 'next'
- 'alpha'
- 'beta'
- 'develop'
- '!all-contributors/**'
env:
NODE_VERSION: "16.x"
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Cache node modules
id: cache
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm ci
eslint:
name: Eslint
runs-on: ubuntu-latest
needs: [setup]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Fetch all branches
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/*
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: ESLint
run: npm run ci:lint -- $(git diff --diff-filter d --name-only origin/${{ github.base_ref }}...HEAD -- '*.js' '*.ts' '*.tsx')
typescript:
name: Typescript
runs-on: ubuntu-latest
needs: [setup]
timeout-minutes: 5
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Typescript
run: npm run ci:tsc
tests:
name: Tests
runs-on: ubuntu-latest
needs: [setup]
timeout-minutes: 5
strategy:
matrix:
leaflet: ["1.6.0", "1.7.1", "1.8.0"]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: install specific leaflet version
run: npm install leaflet@${{ matrix.leaflet }}
- name: unit tests
run: npm run ci:test
env:
GATSBY_BING_API_KEY: ${{ secrets.BING_API_KEY }}
GATSBY_GOOGLE_API_KEY: ${{ secrets.GOOGLE_API_KEY }}
GATSBY_LOCATIONIQ_API_KEY: ${{ secrets.LOCATIONIQ_API_KEY }}
GATSBY_OPENCAGE_API_KEY: ${{ secrets.OPENCAGE_API_KEY }}
GATSBY_HERE_API_KEY: ${{ secrets.HERE_API_KEY }}
update-docs:
name: Update docs
if: github.ref == 'refs/heads/develop'
runs-on: ubuntu-latest
needs: [tests, typescript]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE_VERSION }}"
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: setup git config
run: |
git config user.name "GitHub Actions Bot"
git config user.email "<>"
- name: update docs
run: npm run docs:update
release:
needs: [tests, typescript]
if: github.event_name == 'push' && github.repository == 'smeijer/leaflet-geosearch'
runs-on: ubuntu-latest
environment: npm
steps:
- name: Cancel previous runs
uses: styfle/[email protected]
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '${{ env.NODE_VERSION }}'
- name: Cache node modules
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.os }}-node_modules-${{ hashFiles('**/package-lock.json') }}
- name: Build
run: npm run build
- name: Release
uses: cycjimmy/semantic-release-action@v2
with:
semantic_version: 17
branches: |
[
'+([0-9])?(.{+([0-9]),x}).x',
'main',
'next',
'develop',
{ name: 'alpha', prerelease: true },
{ name: 'beta', prerelease: true }
]
env:
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}