Skip to content

Commit

Permalink
Setup continuous integration using GitHub Actions
Browse files Browse the repository at this point in the history
Run tests (pytest) and linter (black) in the CI.

The main problem is that GitHub Actions runners don't have a terminal
which is necessary for ncurses. This can be "hacked" by using the
'script' command which creates a pseudo-terminal. Also, ncurses requires
the TERM env variable to be set.

For now, we only test for Python 3.10, can add more versions in future.
  • Loading branch information
viktormalik committed Feb 6, 2023
1 parent 5610b63 commit c9ce911
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Continuous Integration

on: [push, pull_request]

jobs:
build-test:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.10"]


steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .[test]
- name: Build Docker image for tests
run: docker build -t test example/
- name: Run tests
run: |
export TERM=xterm-256color && script -e -c "pytest -v"
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable

0 comments on commit c9ce911

Please sign in to comment.