Skip to content

Commit

Permalink
ci: ensure tests succeed in CI (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau authored Jun 6, 2023
1 parent cf65217 commit 99ebc50
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 13 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ jobs:
sudo snap install --no-wait --classic pyright
sudo snap install --no-wait shellcheck
echo "::endgroup::"
echo "::group::apt-get"
sudo apt-get install -y libapt-pkg-dev
echo "::endgroup::"
echo "::group::pip install"
python -m pip install 'tox>=4' tox-gh
python -m pip install 'tox>=4'
echo "::endgroup::"
echo "::group::Create virtual environments for linting processes."
tox run -m lint --notest
Expand All @@ -37,11 +40,11 @@ jobs:
snap watch --last=install
echo "::endgroup::"
- name: Run Linters
run: tox run -m lint
run: .tox/.tox/bin/tox run -m lint
tests:
strategy:
matrix:
platform: [ubuntu-20.04, ubuntu-22.04]
platform: [ubuntu-20.04, ubuntu-22.04, macos-latest]
runs-on: ${{ matrix.platform }}
steps:
- uses: actions/checkout@v3
Expand All @@ -52,7 +55,6 @@ jobs:
with:
python-version: |
3.8
3.9
3.10
3.11
3.12-dev
Expand All @@ -65,7 +67,7 @@ jobs:
- name: Setup Tox environments
run: tox run -m tests --notest
- name: Test with tox
run: tox run-parallel --parallel all --parallel-no-spinner --skip-pkg-install --result-json results/tox-${{ matrix.platform }}.json -m tests -- --no-header --quiet -rN
run: .tox/.tox/bin/tox run --skip-pkg-install --result-json results/tox-${{ matrix.platform }}.json -m tests -- --no-header --quiet -rN
- name: Upload code coverage
uses: codecov/codecov-action@v3
with:
Expand Down
17 changes: 10 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[project]
name = "starcraft"
name = "craft_application"
dynamic = ["version", "readme"]
dependencies = [

Expand All @@ -9,11 +9,14 @@ classifiers = [
"License :: OSI Approved :: GNU Lesser General Public License (LGPL)",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
]
requires-python = ">=3.8"

[project.scripts]
starcraft-hello = "starcraft:hello"

[project.optional-dependencies]
dev = [
Expand Down Expand Up @@ -93,14 +96,14 @@ omit = ["tests/**"]

[tool.coverage.report]
skip_empty = true
fail_under = 80
#fail_under = 80

[tool.pyright]
strict = ["starcraft"]
strict = ["craft_application"]
pythonVersion = "3.8"
pythonPlatform = "Linux"
venvPath = ".tox"
venv = "py38"
venv = "test-py38"

[tool.mypy]
python_version = "3.8"
Expand All @@ -119,7 +122,7 @@ disallow_untyped_decorators = true
disallow_any_generics = true

[[tool.mypy.overrides]]
module = ["starcraft"]
module = ["craft_application"]
disallow_untyped_defs = true
no_implicit_optional = true

Expand All @@ -130,7 +133,7 @@ strict = false
[tool.ruff]
line-length = 88
target-version = "py38"
src = ["starcraft", "tests"]
src = ["craft_application", "tests"]
extend-exclude = [
"docs",
"__pycache__",
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/test_nothing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_pass():
"""No-op test so integration tests pass"""
2 changes: 2 additions & 0 deletions tests/unit/test_nothing.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
def test_pass():
"""No-op test so unit tests pass"""
3 changes: 2 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tox]
env_list = # Environments to run when called with no parameters.
lint-{black,ruff,pyright,shellcheck,codespell,docs}
test-{py38,py310,py311}
test-{py38,py310,py311,py312}
minversion = 4.5
# Tox will use these requirements to bootstrap a venv if necessary.
# tox-igore-env-name-mismatch allows us to have one virtualenv for all linting.
Expand All @@ -12,6 +12,7 @@ minversion = 4.5
requires =
# renovate: datasource=pypi
tox-ignore-env-name-mismatch>=0.2.0.post2
tox-gh
# Allow tox to access the user's $TMPDIR environment variable if set.
# This workaround is required to avoid circular dependencies for TMPDIR,
# since tox will otherwise attempt to use the environment's TMPDIR variable.
Expand Down

0 comments on commit 99ebc50

Please sign in to comment.