-
Notifications
You must be signed in to change notification settings - Fork 44
170 lines (158 loc) · 5.06 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
name: CI
on:
release:
types: [published]
push:
pull_request:
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
jobs:
build-javascript:
runs-on: ubuntu-latest
env:
working-directory: bindings/javascript
strategy:
matrix:
browser: ["firefox", "chrome", "electron"]
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- uses: actions/setup-node@v1
- name: Install dependencies
run: npm install
working-directory: ${{env.working-directory}}
- name: Build module
run: npm run build
working-directory: ${{env.working-directory}}
- name: Run Cypress tests
uses: cypress-io/github-action@v1
with:
working-directory: ${{env.working-directory}}
start: npm run start_test_server
wait-on: "http://localhost:8080"
browser: ${{ matrix.browser }}
build-rust:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo build
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- uses: actions-rs/cargo@v1
with:
command: build
args: --verbose
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
- uses: actions-rs/cargo@v1
with:
command: test
args: --verbose --all-features
build-python:
runs-on: ${{ matrix.os }}
env:
working-directory: bindings/python
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
python-version: [3.6, 3.7, 3.8]
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install GSED (if needed) # needed by update_version.sh
if: github.event_name == 'release' && matrix.os == 'macos-latest'
run: |
brew install gnu-sed
- name: Update version (if release) # only needed for python since we store artifacts, others are rebuilt
if: github.event_name == 'release'
run: |
bash update_version.sh ${{ github.event.release.tag_name }}
- name: Install
run: |
python -m pip install --upgrade pip
make install
working-directory: ${{env.working-directory}}
- name: Build
run: |
make build
working-directory: ${{env.working-directory}}
- name: Test
run: |
make test
working-directory: ${{env.working-directory}}
- name: Upload wheel as artifact
uses: actions/upload-artifact@v2
with:
name: python-wheel
path: bindings/python/target/wheels/*
nightly-release:
runs-on: ubuntu-latest
needs: [build-javascript, build-rust, build-python]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/download-artifact@v2
with:
name: python-wheel
path: python-wheel
- uses: "marvinpinto/action-automatic-releases@latest"
with:
repo_token: "${{ secrets.GITHUB_TOKEN }}"
automatic_release_tag: "latest"
prerelease: true
title: "Nightly Build"
files: |
python-wheel/*.whl
publish:
runs-on: ubuntu-latest
needs: [build-javascript, build-rust, build-python]
if: github.event_name == 'release'
steps:
- uses: actions/checkout@v2
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Set up Python 3.8
uses: actions/setup-python@v1
with:
python-version: 3.8
- run: |
pip install twine==3.2
- uses: actions/download-artifact@v2
with:
name: python-wheel
path: python-wheel
- name: Update version
run: |
bash update_version.sh ${{ github.event.release.tag_name }}
- name: Run release script
run: |
bash release.sh
env:
CARGO_KEY: ${{ secrets.CARGO_KEY }}
TWINE_PASSWORD: ${{ secrets.TWINE_PASSWORD }}
TWINE_USERNAME: ${{ secrets.TWINE_USERNAME }}
WHEEL_DIR: python-wheel
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: v${{ github.event.release.tag_name }}
branch: master