Skip to content

Commit

Permalink
switched from travis to github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
tmbo committed Feb 13, 2020
1 parent a7b41be commit e4926b0
Show file tree
Hide file tree
Showing 10 changed files with 266 additions and 148 deletions.
183 changes: 183 additions & 0 deletions .github/workflows/continous-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
name: Continous Integration

on: [push]

# SECRETS
# - COVERALLS_REPO_TOKEN: can be found on the coveralls page for the repo
# - GH_RELEASE_NOTES_TOKEN: personal access token of `rasabot` github account
# (login for account in 1pw)
# - SLACK_WEBHOOK_TOKEN: token to post to RasaHQ slack account (in 1password)
# - PYPI_TOKEN: publishing token for amn41 account, needs to be maintainer of
# RasaHQ/rasa on pypi (account credentials in 1password)

env:
# needed to fix issues with boto during testing:
# https://github.com/travis-ci/travis-ci/issues/7940
BOTO_CONFIG: /dev/null
PIP_USE_PEP517: false

jobs:
api:
name: API specification
runs-on: ubuntu-latest

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2

- name: Setup Node 🦝
uses: actions/setup-node@v1
with:
node-version: '10.x'

- name: Run Swagger 🕵️‍♀️
run: |
npm install -g swagger-cli
swagger-cli validate docs/_static/spec/action-server.yml
swagger-cli validate docs/_static/spec/rasa.yml
quality:
name: Code Quality
runs-on: ubuntu-latest

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2

- name: Set up Python 3.7 🐍
uses: actions/setup-python@v1
with:
python-version: 3.7

- name: Load Pip Cached Artifacts ⬇
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-3.7-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-3.7-pip-
- name: Install Dependencies 📦
run: |
sudo apt-get -y install libpq-dev
python -m pip install -U 'pip<20'
pip install -r requirements-dev.txt
pip install -e .
- name: Lint Code 🎎
run: |
make lint
- name: Check Types 📚
run: |
make types
- name: Test CLI 🖥
# makes sure we catch any dependency error early. they will create strange
# errors during the docs build, so easier to catch them early on by
# trying to run the `rasa` command once before the docs build.
run: |
rasa --help
# DOES NOT WORK YET DUE TO TENSORFLOW 1.5 (some issue with no tensorflow-cpu verison)
# -> should work with 2.0 and replace the below "Test Docs":
#
# - name: Test Docs
# uses: ammaraskar/[email protected]
# with:
# docs-folder: "docs/"
# repo-token: "${{ secrets.GITHUB_TOKEN }}"
# build-command: "make SPHINXOPTS=\"-W --keep-going -A html_theme=rasabaster\" html"
# pre-build-command: "apt-get update -y && apt-get install -y git"

- name: Test Docs 📃
run: |
pip install -r requirements-docs.txt
pip install -e .[sql]
cd docs && make SPHINXOPTS="-W --keep-going -A html_theme=rasabaster" html
test:
name: Run Tests
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
python-version: [3.6, 3.7]

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2

- name: Set up Python ${{ matrix.python-version }} 🐍
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}

- name: Load Pip Cached Artifacts ⬇
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-${{ matrix.python-version }}-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-${{ matrix.python-version }}-pip-
- name: Install Dependencies 📦
run: |
sudo apt-get update -qq
python -m pip install -U 'pip<20'
pip install -r requirements-dev.txt
pip install -e .
make prepare-tests-ubuntu
pip list
- name: Test Code 🔍
run: |
make test
- name: Send Coverage Report 📊
if: matrix.python-version == 3.6
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_SERVICE_NAME: github-ci
run: |
coveralls
deploy:
name: Deploy to PyPI
runs-on: ubuntu-latest

# deploy will only be run when there is a tag available
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
needs: [quality, test, api] # only run after all other stages succeeded

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2

- name: Set up Python 3.6 🐍
uses: actions/setup-python@v1
with:
python-version: 3.6

- name: Build ⚒️ Distributions
run: |
python3 -m pip install --user --upgrade setuptools wheel
python setup.py sdist bdist_wheel
- name: Publish to PyPI 📦
uses: pypa/gh-action-pypi-publish@37e305e7413032d8422456179fee28fac7d25187
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}

- name: Notify Slack & Publish Release Notes 🗞
env:
GH_RELEASE_NOTES_TOKEN: ${{ secrets.GH_RELEASE_NOTES_TOKEN }}
SLACK_WEBHOOK_TOKEN: ${{ secrets.SLACK_WEBHOOK_TOKEN }}
GITHUB_TAG: ${{ github.ref }}
GITHUB_REPO_SLUG: ${{ github.repository }}
run: |
sudo apt-get -y install pandoc
pip install -U github3.py pypandoc
python3 scripts/publish_gh_release_notes.py
./scripts/ping_slack_about_package_release.sh
62 changes: 62 additions & 0 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Publish Documentation

on:
push:
branches:
- '[0-9]+.[0-9]+.x'
- 'master'
tags:
- '**'

# SECRETS
# - GITHUB_DOCS_KEY: generated locally, added to github repo (public key)
# `ssh-keygen -t rsa -b 4096 -C "Github CI Docs Key" -N "" -f key`
# - GITHUB_TOKEN: (default, from github actions)

jobs:
docs:
name: Build Docs
runs-on: ubuntu-latest

steps:
- name: Checkout git repository 🕝
uses: actions/checkout@v2

- name: Set up Python 3.6 🐍
uses: actions/setup-python@v1
with:
python-version: 3.6

- name: Load PIP Cached artifacts ⬇
uses: actions/cache@v1
with:
path: ~/.cache/pip
key: ${{ runner.os }}-3.6-pip-${{ hashFiles('**/requirements-dev.txt') }}
restore-keys: |
${{ runner.os }}-3.6-pip-
- name: Install Dependencies 📦
env:
RASABASTER: rasabaster-0.7.23.tar.gz
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
curl -sSL -o $RASABASTER "https://storage.googleapis.com/docs-theme/${RASABASTER}?q=$(date +%s%N)"
pip install $RASABASTER
pip install -r requirements.txt
pip install --no-cache-dir -r requirements-docs.txt
pip install git+https://${GITHUB_TOKEN}:[email protected]/RasaHQ/sphinxcontrib-versioning.git@version_list
pip install -e .
pip list
- name: Build & Publish Docs 🏃‍♀️
env:
GITHUB_DOCS_KEY: ${{ secrets.GITHUB_DOCS_KEY }}
run: |
eval "$(ssh-agent -s)"; touch docs_key; chmod 0600 docs_key
echo "$GITHUB_DOCS_KEY" > "docs_key"
ssh-add docs_key
git config --global user.email "[email protected]"
git config --global user.name "GitHub CI"
git remote set-url --push origin "[email protected]:${{github.repository}}"
sphinx-versioning push docs docs . -- -b dirhtml -A html_theme=rasabaster
124 changes: 0 additions & 124 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ prepare-wget-macos:
brew install wget || true

prepare-tests-ubuntu: prepare-tests-files
sudo apt-get -y install graphviz graphviz-dev python3-tk
sudo apt-get -y install graphviz graphviz-dev python-tk

prepare-tests-files:
pip3 install https://github.com/explosion/spacy-models/releases/download/en_core_web_md-2.1.0/en_core_web_md-2.1.0.tar.gz#egg=en_core_web_md==2.1.0 --no-cache-dir -q
Expand Down
Loading

0 comments on commit e4926b0

Please sign in to comment.