-
Notifications
You must be signed in to change notification settings - Fork 179
153 lines (147 loc) · 4.69 KB
/
api-test-lint-deploy.yaml
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
# This workflow runs tests and lint on pull requests that touch the api/
# project or its CI configuration.
name: 'API test/lint/deploy'
on:
# Most of the time, we run on pull requests, which lets us handle external PRs
pull_request:
paths:
- 'api/**/*'
- 'Makefile'
- 'shared-data/**/*'
- '!shared-data/js/**'
- 'hardware/**/*'
- '.github/workflows/api-test-lint-deploy.yaml'
- '.github/actions/python/**/*'
- '.github/workflows/utils.js'
push:
paths:
- 'api/**'
- 'Makefile'
- 'shared-data/**/*'
- '!shared-data/js/**/*'
- 'hardware/**/*'
- '.github/workflows/api-test-lint-deploy.yaml'
- '.github/actions/python/**/*'
- '.github/workflows/utils.js'
branches:
- 'edge'
- 'release'
- '*hotfix*'
tags:
- 'v*'
workflow_dispatch:
defaults:
run:
shell: bash
jobs:
lint:
name: 'opentrons package linting'
timeout-minutes: 10
runs-on: 'ubuntu-18.04'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '14'
- uses: 'actions/setup-python@v2'
with:
python-version: '3.7'
- uses: './.github/actions/python/setup'
with:
project: 'api'
- name: Lint with opentrons_hardware
run: make -C api lint
test:
name: 'opentrons package tests on ${{ matrix.os }}, python ${{ matrix.python }}'
timeout-minutes: 30
needs: [lint]
strategy:
matrix:
os: ['windows-2019', 'ubuntu-18.04', 'macos-latest']
# TODO(mc, 2022-02-24): expand this matrix to 3.8 and 3.9,
# preferably in a nightly cronjob on edge or something
python: ['3.7', '3.10']
with-ot-hardware: ['true', 'false']
exclude:
- os: 'windows-2019'
with-ot-hardware: 'true'
- os: 'macos-latest'
with-ot-hardware: 'true'
- os: 'macos-latest'
python: '3.10'
- python: '3.10'
with-ot-hardware: 'true'
runs-on: '${{ matrix.os }}'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '14'
- uses: 'actions/setup-python@v2'
with:
python-version: ${{ matrix.python }}
- name: 'set complex environment variables'
uses: actions/[email protected]
with:
script: |
const { buildComplexEnvVars, } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- uses: './.github/actions/python/setup'
with:
project: 'api'
python-version: ${{ matrix.python }}
- if: ${{ matrix.with-ot-hardware == 'false' }}
name: Remove OT-3 hardware package
run: make -C api setup-ot2
env:
OT_VIRTUALENV_VERSION: ${{ matrix.python }}
- if: ${{ matrix.with-ot-hardware == 'false' }}
name: Test without opentrons_hardware
run: make -C api test-ot2
- if: ${{ matrix.with-ot-hardware == 'true' }}
name: Test with opentrons_hardware
run: make -C api test-cov
- name: Ensure assets build
run: make -C api sdist wheel
- name: Upload coverage report
uses: 'codecov/codecov-action@v2'
with:
files: ./api/coverage.xml
flags: api
deploy:
name: 'deploy opentrons package'
needs: [test]
runs-on: 'ubuntu-18.04'
if: github.event_name == 'push'
steps:
- uses: 'actions/checkout@v2'
- uses: 'actions/setup-node@v1'
with:
node-version: '14'
- uses: 'actions/setup-python@v2'
with:
python-version: '3.7'
- name: 'set complex environment variables'
uses: actions/[email protected]
with:
script: |
const { buildComplexEnvVars, } = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/utils.js`)
buildComplexEnvVars(core, context)
- uses: './.github/actions/python/setup'
with:
project: 'api'
# creds and repository configuration for deploying python wheels
- if: ${{ !env.OT_TAG }}
name: 'upload to test pypi'
uses: './.github/actions/python/pypi-deploy'
with:
project: 'api'
repository_url: 'https://test.pypi.org/legacy/'
password: '${{ secrets.OT_TEST_PYPI_PASSWORD }}'
- if: startsWith(env.OT_TAG, 'v')
name: 'upload to real pypi'
uses: './.github/actions/python/pypi-deploy'
with:
project: 'api'
repository_url: 'https://upload.pypi.org/legacy/'
password: '${{ secrets.OT_PYPI_PASSWORD }}'