Skip to content

Commit

Permalink
Run tests daily, update tox.ini
Browse files Browse the repository at this point in the history
  • Loading branch information
carlcsaposs-canonical committed Feb 15, 2023
1 parent 1e2ddbe commit 3bba29d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
name: integration and other tests
# Copyright 2022 Canonical Ltd.
# See LICENSE file for licensing details.
name: Tests

on:
workflow_call:
pull_request:
schedule:
- cron: '0 12 * * 3'
- cron: '53 0 * * *' # Daily at 00:53 UTC
# Triggered on push to branch "main" by .github/workflows/release.yaml
workflow_call:

jobs:
lint:
Expand All @@ -13,7 +16,8 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install dependencies
- name: Install tox
# TODO: Consider replacing with custom image on self-hosted runner OR pinning version
run: python3 -m pip install tox
- name: Run linters
run: tox -e lint
run: tox run -e lint
2 changes: 2 additions & 0 deletions tests/integration/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Copyright 2023 Canonical Ltd.
# See LICENSE file for licensing details.
27 changes: 13 additions & 14 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,25 @@
# See LICENSE file for licensing details.

[tox]
skipsdist=True
no_package = True
skip_missing_interpreters = True
envlist = lint, unit
env_list = lint, unit

[vars]
tst_path = {toxinidir}/tests/
all_path = {toxinidir}
tests_path = {tox_root}/tests
all_path = {[vars]tests_path}

[testenv]
setenv =
PYTHONPATH = {toxinidir}:{toxinidir}/lib
set_env =
PYTHONPATH = {tox_root}/lib
PYTHONBREAKPOINT=ipdb.set_trace
PY_COLORS=1
passenv =
pass_env =
PYTHONPATH
CHARM_BUILD_DIR
MODEL_SETTINGS

[testenv:fmt]
[testenv:format]
description = Apply coding style standards to code
deps =
black
Expand All @@ -42,9 +42,9 @@ deps =
isort
codespell
commands =
codespell {toxinidir} --skip {toxinidir}/.git --skip {toxinidir}/.tox \
--skip {toxinidir}/build --skip {toxinidir}/lib --skip {toxinidir}/venv \
--skip {toxinidir}/.mypy_cache --skip {toxinidir}/LICENSE
codespell {tox_root} --skip {tox_root}/.git --skip {tox_root}/.tox \
--skip {tox_root}/build --skip {tox_root}/lib --skip {tox_root}/venv \
--skip {tox_root}/.mypy_cache --skip {tox_root}/LICENSE
# pflake8 wrapper supports config from pyproject.toml
pflake8 {[vars]all_path}
isort --check-only --diff {[vars]all_path}
Expand All @@ -56,7 +56,6 @@ deps =
juju=2.9.38.1
pytest
pytest-operator>0.17.0
-r{toxinidir}/requirements.txt
-r {tox_root}/requirements.txt
commands =
pytest -v --tb native --ignore={[vars]tst_path}unit --log-cli-level=INFO -s {posargs} \
--durations=0
pytest -v --tb native --log-cli-level=INFO -s {posargs} {[vars]tests_path}/integration/test_bundle.py

0 comments on commit 3bba29d

Please sign in to comment.