Skip to content

Commit b0eee10

Browse files
committed
Test package with GitHub Actions.
1 parent 34fee4b commit b0eee10

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
3+
4+
name: Python package
5+
6+
on: [push, pull_request]
7+
8+
jobs:
9+
build:
10+
11+
runs-on: ubuntu-20.04
12+
strategy:
13+
matrix:
14+
python-version: ['3.6', '3.7', '3.8', '3.9']
15+
16+
steps:
17+
- uses: actions/checkout@v2
18+
with:
19+
fetch-depth: 0 # Needed for git describe to find tags.
20+
- name: Checkout submodules
21+
run: |
22+
git submodule update --init --recursive --depth 1
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v2
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
- name: Install APT dependencies
28+
run: |
29+
sudo apt update
30+
sudo apt install libsdl2-dev
31+
- name: Install Python dependencies
32+
run: |
33+
python -m pip install --upgrade pip
34+
python -m pip install flake8 mypy pytest pytest-cov pytest-benchmark black
35+
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
36+
- name: Initialize package
37+
run: |
38+
python setup.py check # Creates tcod/version.py.
39+
- name: Lint with flake8
40+
run: |
41+
# stop the build if there are Python syntax errors or undefined names
42+
flake8 tcod/ --count --select=E9,F63,F7,F82 --show-source --statistics
43+
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44+
flake8 tcod/ --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
45+
- name: Check type hints with MyPy
46+
run: |
47+
mypy tcod/
48+
- name: Check formatting with Black
49+
run: |
50+
black --check tcod/
51+
- name: Build package.
52+
run: |
53+
python setup.py develop # Install the package in-place.
54+
- name: Test with pytest
55+
uses: GabrielBB/xvfb-action@v1
56+
with:
57+
run: |
58+
pytest

0 commit comments

Comments
 (0)