-
Notifications
You must be signed in to change notification settings - Fork 11
89 lines (81 loc) · 2.7 KB
/
main.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
name: Test, Lint and Document
on:
push:
branches: [ main ]
tags: [ "*" ]
pull_request:
workflow_dispatch:
jobs:
tests-and-lints:
name: Test and Lint ${{ matrix.python-version }} on ${{ matrix.platform }}
runs-on: ${{ matrix.platform }}
strategy:
matrix:
platform: [ubuntu-latest, macos-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Lint and run tests with Python ${{ matrix.python-version }} on ${{ matrix.platform }}
env:
PLATFORM: ${{ matrix.platform }}
run: |
python -m pip install --upgrade pip tox tox-gh-actions
tox -e lint,test,report-coverage
- name: Upload test results
uses: actions/upload-artifact@v2
with:
name: test-results-${{ matrix.python-version }}-${{ matrix.platform }}
path: |
test-reports/junit.xml
test-reports/cobertura.xml
test-reports/coverage_html
if: ${{ always() }}
documents:
name: "Build and deploy documentation"
needs: tests-and-lints
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: "3.8"
- name: Build documentation
run: |
python -m pip install --upgrade pip tox
tox -e docs
- name: Download test report artifacts into doc site
uses: actions/download-artifact@v2
with:
name: test-results-3.9-macos-latest
path: site
- name: Upload the generated documentation site (TODO for packaging)
uses: actions/upload-artifact@v2
with:
name: changes-docs-${{ github.event.number }}
path: site/
- name: Deploy PR preview to Surge
uses: afc163/surge-preview@v1
id: preview_step
if: github.event_name == 'pull_request'
with:
surge_token: ${{ secrets.SURGE_TOKEN }}
github_token: ${{ secrets.GITHUB_TOKEN }}
dist: site
teardown: 'true'
build: |
echo "mkdocs has built site/ already"
- name: Get the preview_url
run: echo "${{ steps.preview_step.outputs.preview_url }}"
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: github.ref == 'refs/heads/main'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./site
- name: Deploy to Surge
if: github.ref == 'refs/heads/main'
run: |
npx surge site changes.michaeljoseph.surge.sh