-
Notifications
You must be signed in to change notification settings - Fork 324
154 lines (130 loc) · 4.62 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
name: ci
on:
workflow_dispatch:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main
- rc/3.0-mv3
env:
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
steps:
- name: Check out Git repository
uses: actions/checkout@v3.3.0
- name: Install Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18
- name: patch node gyp on windows to support Visual Studio 2019
shell: powershell
if: runner.os == 'Windows'
run: |
npm install --global node-gyp@latest
npm prefix -g | % {npm config set node_gyp "$_\node_modules\node-gyp\bin\node-gyp.js"}
- name: Restore .cache
uses: actions/cache@v3.2.4
id: cache
with:
path: ${{ github.workspace }}/.cache
key: ${{ runner.os }}-${{ hashFiles('package*json', 'package-lock.json', '*config.js') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('package*json', 'package-lock.json', '*config.js') }}
${{ runner.os }}-
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: npm run ci:install
- name: Build
run: npm run ci:build
- name: Show build/
run: du -h build/*
- name: Show dist/bundles/*
run: du -h add-on/dist/bundles/*
- name: Test
run: npm run ci:test
# tests should finish <30s, if it takes longer its a bug - fail fast
timeout-minutes: 5
- name: Lint
# bundles are too big on Windows and fail addon-lint
# but as long we don't build releases on Windows, can be ignored
if: runner.os != 'Windows'
run: npm run ci:lint
# Persist produced binaries and effective config used for building them
# - this is not for releases, but for quick testing during the dev
# - action artifacts can be downloaded for 90 days, then are removed by github
# - binaries in PRs from forks won't be signed
- name: Attach produced packages to Github Action
uses: actions/upload-artifact@v3.1.2
with:
name: built-on-${{ matrix.os }}
path: build/ipfs_companion*.*
if-no-files-found: error
- name: Show Cache
run: du -h ${{ github.workspace }}/.cache/* || true
release-pr:
runs-on: ubuntu-latest
needs: [test]
if: github.ref == 'refs/heads/main' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
steps:
- uses: google-github-actions/release-please-action@v3.7.3
with:
command: manifest-pr
changelog-notes-type: github
release-assets:
runs-on: ubuntu-latest
needs: [test]
if: |
(contains(github.ref, 'refs/tags/') || github.ref == 'refs/heads/rc/3.0-mv3') &&
(github.event_name == 'push' || github.event_name == 'workflow_dispatch')
steps:
- name: Check out Git repository
uses: actions/checkout@v3.3.0
- name: Install Node.js
uses: actions/setup-node@v3.6.0
with:
node-version: 18
- name: Restore .cache
uses: actions/cache@v3.2.4
id: cache
with:
path: ${{ github.workspace }}/.cache
key: ${{ runner.os }}-${{ hashFiles('package*json', 'package-lock.json', '*config.js') }}
restore-keys: |
${{ runner.os }}-${{ hashFiles('package*json', 'package-lock.json', '*config.js') }}
${{ runner.os }}-
- name: Restore node_modules
id: yarn-cache
uses: actions/cache@v3.2.4
with:
path: node_modules
key: ${{ runner.os }}-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.yarn-cache.outputs.cache-hit != 'true'
run: npm run ci:install
- name: Build Stable Release
run: npm run ci:build:stable
- name: Release
uses: softprops/action-gh-release@de2c0eb89ae2a093876385947365aca7b0e5f844
with:
files: build/*.zip
fail_on_unmatched_files: true
generate_release_notes: true
draft: true
append_body: true
body: 'Automated Release, please upload artifacts to respective webstores and mark this draft as released.'