Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding flake8, pytest, tox, and github actions #59

Merged
merged 14 commits into from
Dec 18, 2023
Merged
27 changes: 27 additions & 0 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Tests

on:
- push
- pull_request

jobs:
test:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest]
MarcCote marked this conversation as resolved.
Show resolved Hide resolved
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should upgrade to the latest version of these actions. These versions rely on some outdated dependencies that GitHub is likely going to be removing from their runners soon.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gotcha. Should have used a more up to date tutorial 😭

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, do you mean I should use v4 instead of v2?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay things should be good now. Now i just need to get the tests passing lol

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify, do you mean I should use v4 instead of v2?

The latest version of setup-python is actually v5. v4 uses a newer but still EOL version of Node.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh okay. I thought I saw v4 in the docs.

with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run:
python -m pip install --upgrade pip
pip install tox tox-gh-actions
- name: Test with tox
run: tox
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
include LICENSE
include README.md
include requirements.txt
include requirements-dev.txt

include scienceworld/scienceworld-*.jar
include scienceworld/object_type_ids.tsv
2 changes: 2 additions & 0 deletions requirements-dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,5 @@ pre-commit
py4j
pytest
twine
flake8
tox
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,6 @@
install_requires=open('requirements.txt').readlines(),
extras_require={
'webserver': open('requirements.txt').readlines() + ['pywebio'],
'testing': open(f'{BASEPATH}/requirements-dev.txt').readlines(),
},
)
24 changes: 24 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
[tox]
minversion = 3.8.0
envlist = py38, py39, py310, py311, py312, flake8

[gh-actions]
python =
3.8: py38, flake8
3.9: py39, flake8
3.10: py310, flake8
3.11: py311, flake8
3.12: py312, flake8

[testenv]
setenv =
PYTHONPATH = {toxinidir}
deps =
-r{toxinidir}/requirements-dev.txt
commands =
pytest --basetemp={envtmpdir}

[testenv:flake8]
basepython = python3.10
deps = flake8
commands = flake8