|
1 | | -name: Testing and validation |
| 1 | +name: Tests and docs |
2 | 2 |
|
3 | 3 | on: [push, pull_request] |
4 | 4 |
|
5 | 5 | jobs: |
6 | | - test: |
| 6 | + tests: |
| 7 | + name: Tests |
| 8 | + uses: Bernardo-MG/github-workflow/.github/workflows/python_testing.yml@develop |
7 | 9 |
|
| 10 | + setup_docs: |
| 11 | + name: Doc deployment preparation |
| 12 | + needs: tests |
| 13 | + outputs: |
| 14 | + branchName: ${{ steps.extract_branch.outputs.branchName }} |
8 | 15 | runs-on: ubuntu-latest |
9 | | - strategy: |
10 | | - matrix: |
11 | | - python-version: [3.6, 3.7, 3.8, 3.9] |
12 | 16 |
|
| 17 | + steps: |
| 18 | + - name: Install sshpass |
| 19 | + run: sudo apt-get install sshpass |
| 20 | + - name: Extract branch name |
| 21 | + uses: bernardo-mg/extract-branch-name-action@v1 |
| 22 | + id: extract_branch |
| 23 | + |
| 24 | + deploy_docs: |
| 25 | + name: Deploy development docs |
| 26 | + environment: deployment_site |
| 27 | + needs: setup_docs |
| 28 | + runs-on: ubuntu-latest |
| 29 | + if: ${{ needs.setup_docs.outputs.branchName == 'master' }} |
| 30 | + steps: |
| 31 | + - name: Check-out |
| 32 | + uses: actions/checkout@v2 |
| 33 | + - name: Set up Python |
| 34 | + uses: actions/setup-python@v2 |
| 35 | + with: |
| 36 | + python-version: 3.9 |
| 37 | + cache: 'pip' |
| 38 | + - name: Update pip |
| 39 | + run: python -m pip install --upgrade pip |
| 40 | + - name: Install dependencies |
| 41 | + run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 42 | + - name: Install sshpass |
| 43 | + run: sudo apt-get install sshpass |
| 44 | + - name: Tests docs |
| 45 | + run: python setup.py test -p docs |
| 46 | + - name: Build docs |
| 47 | + run: python setup.py build_docs |
| 48 | + - name: Deploy docs |
| 49 | + run: | |
| 50 | + cd ./build/sphinx/html |
| 51 | + 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 }}; |
| 52 | +
|
| 53 | + deploy_develop_docs: |
| 54 | + name: Deploy development docs |
| 55 | + environment: deployment_site |
| 56 | + needs: setup_docs |
| 57 | + runs-on: ubuntu-latest |
| 58 | + if: ${{ needs.setup_docs.outputs.branchName == 'develop' }} |
13 | 59 | steps: |
14 | 60 | - name: Check-out |
15 | 61 | uses: actions/checkout@v2 |
16 | | - - name: Set up Python ${{ matrix.python-version }} |
| 62 | + - name: Set up Python |
17 | 63 | uses: actions/setup-python@v2 |
18 | 64 | with: |
19 | | - python-version: ${{ matrix.python-version }} |
| 65 | + python-version: 3.9 |
| 66 | + cache: 'pip' |
| 67 | + - name: Update pip |
| 68 | + run: python -m pip install --upgrade pip |
20 | 69 | - name: Install dependencies |
| 70 | + run: if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
| 71 | + - name: Install sshpass |
| 72 | + run: sudo apt-get install sshpass |
| 73 | + - name: Tests docs |
| 74 | + run: python setup.py test -p docs |
| 75 | + - name: Build docs |
| 76 | + run: python setup.py build_docs |
| 77 | + - name: Deploy docs |
21 | 78 | run: | |
22 | | - python -m pip install --upgrade pip |
23 | | - pip install flake8 pytest |
24 | | - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi |
25 | | - - name: Run all tests |
26 | | - run: python setup.py test -p py${{ matrix.python-version }} |
| 79 | + cd ./build/sphinx/html |
| 80 | + 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 }}; |
0 commit comments