-
Notifications
You must be signed in to change notification settings - Fork 1
80 lines (74 loc) · 2.59 KB
/
testing.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
name: Tests and docs
on: [push, pull_request]
jobs:
tests:
name: Tests
uses: Bernardo-MG/github-workflow/.github/workflows/python_testing.yml@v1
setup_docs:
name: Doc deployment preparation
needs: tests
outputs:
branchName: ${{ steps.extract_branch.outputs.branchName }}
runs-on: ubuntu-latest
steps:
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Extract branch name
uses: bernardo-mg/extract-branch-name-action@v1
id: extract_branch
deploy_docs:
name: Deploy docs
environment: deployment_site
needs: setup_docs
runs-on: ubuntu-latest
if: ${{ needs.setup_docs.outputs.branchName == 'master' }}
steps:
- name: Check-out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: 'pip'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Tests docs
run: python setup.py test -p docs
- name: Build docs
run: python setup.py build_docs
- name: Deploy docs
run: |
cd ./build/sphinx/html
sshpass -p ${{ secrets.DEPLOY_DOCS_PASSWORD }} scp -o StrictHostKeyChecking=no -P ${{ secrets.DEPLOY_DOCS_PORT }} -r ./* ${{ secrets.DEPLOY_DOCS_USER }}'@'${{ secrets.DEPLOY_DOCS_HOST }}':'${{ secrets.DEPLOY_DOCS_PATH }};
deploy_develop_docs:
name: Deploy development docs
environment: deployment_site
needs: setup_docs
runs-on: ubuntu-latest
if: ${{ needs.setup_docs.outputs.branchName == 'develop' }}
steps:
- name: Check-out
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.9
cache: 'pip'
- name: Update pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Install sshpass
run: sudo apt-get install sshpass
- name: Tests docs
run: python setup.py test -p docs
- name: Build docs
run: python setup.py build_docs
- name: Deploy docs
run: |
cd ./build/sphinx/html
sshpass -p ${{ secrets.DEPLOY_DOCS_DEVELOP_PASSWORD }} scp -o StrictHostKeyChecking=no -P ${{ secrets.DEPLOY_DOCS_PORT }} -r ./* ${{ secrets.DEPLOY_DOCS_DEVELOP_USER }}'@'${{ secrets.DEPLOY_DOCS_HOST }}':'${{ secrets.DEPLOY_DOCS_DEVELOP_PATH }};