-
Notifications
You must be signed in to change notification settings - Fork 7
68 lines (66 loc) · 2.21 KB
/
test.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
# Run the project's test suite, in online and offline mode
name: Tests
on: # yamllint disable-line rule:truthy
push:
branches: [master, main, '*.*', 'staging*']
pull_request:
# The branches below must be a subset of the branches above
branches: [master, main, '*.*', 'staging*']
jobs:
test:
name: Test Python ${{ matrix.python-version }} ${{ matrix.os }} ${{ matrix.online }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python-version: '3.9'
online: 'ONLINE'
- os: ubuntu-latest
python-version: '3.9'
- os: ubuntu-latest
python-version: '3.7'
- os: ubuntu-latest
python-version: 'pypy-3.7'
- os: windows-latest
python-version: '3.8'
- os: macos-latest
python-version: '3.8'
steps:
- name: Checkout branch
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Create virtualenv
uses: syphar/restore-virtualenv@v1
id: env
- name: Print basic Python info
shell: python
run: |
import sys
print(sys.executable, sys.version, sep='\n')
- name: Install baseline deps
run: python -m pip install --upgrade pip setuptools wheel
- name: Install build deps
run: python -m pip install --upgrade -r requirements-build.txt
- name: Build package
run: python -bb -X dev -W error -m build
- name: Install wheel
shell: bash
run: 'echo dist/*.whl | xargs -I % pip install --upgrade %[test]'
- name: Pip check
run: pip check
- name: Run offline tests
run: python -bb -X dev -W error -m pytest
- name: Run online tests
if: matrix.online == 'ONLINE' && (! contains(github.base_ref, 'staging'))
env:
praw_client_id: ${{ secrets.TESTBOT_CLIENT_ID }}
praw_client_secret: ${{ secrets.TESTBOT_CLIENT_SECRET }}
praw_refresh_token: ${{ secrets.TESTBOT_REFRESH_TOKEN }}
run: 'python -bb -X dev -W error -m pytest --run-online -m "online"'
- name: Twine check
run: twine check --strict dist/*