Combine GitHub Actions

This commit is contained in:
XhmikosR
2020-02-10 21:10:38 +02:00
parent 09fe7564c1
commit df15f06e27
2 changed files with 26 additions and 27 deletions

86
.github/workflows/ci.yml vendored Normal file
View File

@@ -0,0 +1,86 @@
name: CI
env:
CI: true
NODE: 12.x
PYTHON_VERSION: '3.7'
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v1
with:
python-version: '${{ env.PYTHON_VERSION }}'
architecture: 'x64'
- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/requirements.txt') }}
restore-keys: ${{ runner.os }}-pip-${{ env.PYTHON_VERSION }}-${{ hashFiles('**/requirements.txt') }}
- name: Install Python dependencies
run: python3 -m pip install -r requirements.txt
- name: Build docs
run: mkdocs build --clean
- name: Upload docs
uses: actions/upload-artifact@v1
with:
name: docs
path: ./site/
test:
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "${{ env.NODE }}"
- name: Install npm dependencies
run: npm ci
- name: Download docs
uses: actions/download-artifact@v1
with:
name: docs
path: ./site/
- name: Test
run: npm test
deploy:
runs-on: ubuntu-latest
needs: [build, test]
if: github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v2
- name: Download docs
uses: actions/download-artifact@v1
with:
name: docs
path: ./site/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
emptyCommits: false
personal_token: ${{ secrets.PERSONAL_TOKEN }}
publish_branch: gh-pages
publish_dir: ./site/