mybuddy/.github/workflows/ci.yml

97 lines
3.0 KiB
YAML

name: CI
env:
DOKKU_GIT_REMOTE_URL: 'ssh://dokku@dokku.baby-buddy.net:22/demo'
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
- run: npm install --location=global gulp-cli
- run: npm install
- run: gulp lint
- run: gulp coverage
- name: Submit results to Coveralls
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.github_token }}
flag-name: test-python-${{ matrix.python-version }}
parallel: true
coveralls-finish:
needs: test
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: AndreMiras/coveralls-python-action@develop
with:
github-token: ${{ secrets.github_token }}
parallel-finished: true
deploy-review-app:
needs: test
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'opened'
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master
with:
command: review-apps:create
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}
review_app_name: pr-${{ github.event.pull_request.number }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
destroy-review-app:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request' && github.event.action == 'closed'
steps:
- name: Destroy the review app
uses: dokku/github-action@master
with:
command: review-apps:destroy
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}
review_app_name: pr-${{ github.event.pull_request.number }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}
deploy-docs:
needs: test
runs-on: ubuntu-latest
environment:
name: documentation
url: https://docs.baby-buddy.net
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
- name: Deploy docs
uses: mhausenblas/mkdocs-deploy-gh-pages@master
env:
GITHUB_TOKEN: ${{ secrets.github_token }}
REQUIREMENTS: docs/requirements.txt
deploy-demo:
needs: test
runs-on: ubuntu-latest
environment:
name: demo
url: https://demo.baby-buddy.net
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to dokku
uses: dokku/github-action@master
with:
git_remote_url: ${{ env.DOKKU_GIT_REMOTE_URL }}
ssh_private_key: ${{ secrets.DOKKU_SSH_PRIVATE_KEY }}