-
Notifications
You must be signed in to change notification settings - Fork 155
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #125 from MycroftAI/feature/github-actions
Run unit tests in Github Actions
- Loading branch information
Showing
6 changed files
with
103 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | ||
|
||
name: Python package | ||
|
||
on: | ||
push: | ||
branches: [ master ] | ||
pull_request: | ||
branches: [ master ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
python-version: [3.6, 3.7, 3.8, 3.9] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
python setup.py install | ||
python -m pip install -r test-requirements.txt | ||
- name: Lint with flake8 | ||
run: | | ||
# stop the build if there are Python syntax errors or undefined names | ||
# Code style checks disabled until the style of the project is set. | ||
./run_tests.sh lint | ||
- name: Test with pytest | ||
run: | | ||
./run_tests.sh test |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#! /bin/bash | ||
|
||
ADAPT_DIR=$(dirname $0) | ||
|
||
do_lint () { | ||
flake8 "${ADAPT_DIR}/adapt" --select=E9,F63,F7,F82 --show-source && \ | ||
flake8 "${ADAPT_DIR}/test" --select=E9,F63,F7,F82 --show-source | ||
} | ||
|
||
do_test () { | ||
pytest "${ADAPT_DIR}/test/"* | ||
} | ||
|
||
show_help () { | ||
echo "Tests for adapt." | ||
echo "If no arguments are given, both test and linting is performed." | ||
echo "Otherwise the argument will determine which part is performed." | ||
echo "" | ||
echo " Usage: $0 [test/lint]" | ||
echo "" | ||
echo "Arguments:" | ||
echo " test: Only run the tests." | ||
echo " lint: Only perform codestyle and static analysis." | ||
} | ||
|
||
if [[ $# == 0 ]]; then | ||
do_lint || exit $? # Exit on failure | ||
do_test || exit $? # Exit on failure | ||
elif [[ $# == 1 ]]; then | ||
if [[ $1 == "lint" ]]; then | ||
do_lint | ||
elif [[ $1 == "test" ]]; then | ||
do_test | ||
else | ||
show_help | ||
fi | ||
else | ||
show_help | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
xmlrunner==1.7.7 | ||
flake8 | ||
pytest | ||
-r requirements.txt |