Skip to content

Commit

Permalink
Add mocked-plans tox environment
Browse files Browse the repository at this point in the history
Add mocked-plans tox environment and job in GitHub workflows.
I also remove usage of boots-actions, since it's old and not
maintained.
  • Loading branch information
rgildein committed Mar 28, 2024
1 parent 0c028c7 commit 1eb84a4
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 13 deletions.
56 changes: 47 additions & 9 deletions .github/workflows/check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,53 @@ concurrency:

jobs:
lint-unit:
name: Lint checkers and unit tests
uses: canonical/bootstack-actions/.github/workflows/lint-unit.yaml@v2
strategy:
fail-fast: false
matrix:
python-version: ['3.10']
with:
python-version: ${{ matrix.python-version }}
tox-version: '<4'
name: Lint checkers and Unit tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run lint checkers
run: tox -e lint
- name: Run unit tests
run: tox -e unit
- name: Save PR number to file
run: echo ${{ github.event.number }} > PR_NUMBER.txt
- name: Archive PR number
uses: actions/upload-artifact@v3
with:
name: PR_NUMBER
path: PR_NUMBER.txt
- name: Archive code coverage results
uses: actions/upload-artifact@v3
with:
name: coverage-report
path: ./tests/unit/report/coverage.xml

mocked-plans:
name: Mocked plans tests
needs: lint-unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install tox
- name: Run unit tests
run: tox -e mocked-plans

snap-build:
name: Build snap package
Expand Down
5 changes: 1 addition & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
# This is a template `pyproject.toml` file for snaps
# This file is managed by bootstack-charms-spec and should not be modified
# within individual snap repos. https://launchpad.net/bootstack-charms-spec

[tool.flake8]
ignore = ["C901", "D100", "D101", "D102", "D103", "W503", "W504"]
exclude = ['.eggs', '.git', '.tox', '.venv', '.build', 'build', 'report', 'docs']
Expand Down Expand Up @@ -106,6 +102,7 @@ quiet-level = 3
check-filenames = true

[tool.pytest.ini_options]
addopts = "--ignore=tests/unit/apps_planning"
filterwarnings = [
"ignore::RuntimeWarning",
]
4 changes: 4 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ deps = .[unittests]
commands = pytest {toxinidir}/tests/unit \
{posargs:-v --cov --cov-report=term-missing --cov-report=html --cov-report=xml}

[testenv:mocked-plans]
deps = .[unittests]
commands = pytest {toxinidir}/tests/unit/apps_planning {posargs:-s -vv}

[testenv:func]
changedir = {toxinidir}/tests/functional
deps = .[functests]
Expand Down

0 comments on commit 1eb84a4

Please sign in to comment.