diff --git a/.github/workflows/python-package.yaml b/.github/workflows/build.yaml similarity index 73% rename from .github/workflows/python-package.yaml rename to .github/workflows/build.yaml index 637ee1d7b..6d042be58 100644 --- a/.github/workflows/python-package.yaml +++ b/.github/workflows/build.yaml @@ -1,41 +1,39 @@ +# This is a templated file and must be kept up-to-date with the original +# from upstream at https://github.com/canonical/se-tooling-ci-common. name: Python package - on: push: pull_request: branches: [main] workflow_dispatch: - + # We will include this workflow in the ghcr-build-and-publish.yaml workflow. + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_call + workflow_call: jobs: build: runs-on: ubuntu-latest strategy: matrix: - python-version: ['3.8', '3.10', '3.11', '3.12'] - + python-version: ['3.8', '3.10', '3.12'] steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Build package run: | git rev-parse --short HEAD > hotsos/.repo-info python -m pip install --upgrade pip python -m pip install build python -m build - - name: Publish a Python distribution to PyPI uses: pypa/gh-action-pypi-publish@release/v1 if: github.event_name == 'push' && github.ref_name == 'main' && matrix.python-version == '3.8' with: password: ${{ secrets.PYPI_API_TOKEN }} - - name: Upload Python package as CI artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/tests.yaml b/.github/workflows/run-tests.yaml similarity index 77% rename from .github/workflows/tests.yaml rename to .github/workflows/run-tests.yaml index 5047af475..575657e2b 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/run-tests.yaml @@ -1,4 +1,6 @@ -name: Test +# This is a templated file and must be kept up-to-date with the original +# from upstream at https://github.com/canonical/se-tooling-ci-common. +name: Run Tests on: - push - pull_request @@ -8,17 +10,21 @@ jobs: test: strategy: matrix: - python-version: ['3.8', '3.10', '3.11', '3.12'] - os: [ubuntu-22.04, ubuntu-20.04] + python-version: ['3.8', '3.10', '3.12'] + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] exclude: - - os: ubuntu-22.04 - python-version: 3.8 - os: ubuntu-20.04 python-version: '3.10' - os: ubuntu-20.04 - python-version: '3.11' - - os: ubuntu-20.04 python-version: '3.12' + - os: ubuntu-22.04 + python-version: '3.8' + - os: ubuntu-22.04 + python-version: '3.12' + - os: ubuntu-24.04 + python-version: '3.8' + - os: ubuntu-24.04 + python-version: '3.10' runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/snapbuild.yaml b/.github/workflows/snap-build-and-upload.yaml similarity index 80% rename from .github/workflows/snapbuild.yaml rename to .github/workflows/snap-build-and-upload.yaml index 55a4409a8..2567bef36 100644 --- a/.github/workflows/snapbuild.yaml +++ b/.github/workflows/snap-build-and-upload.yaml @@ -1,3 +1,5 @@ +# This is a templated file and must be kept up-to-date with the original +# from upstream at https://github.com/canonical/se-tooling-ci-common. name: Build and publish Snap on: workflow_run: diff --git a/.github/workflows/snapfunctionaltest.yaml b/.github/workflows/snap-functional-test.yaml similarity index 100% rename from .github/workflows/snapfunctionaltest.yaml rename to .github/workflows/snap-functional-test.yaml diff --git a/tox.ini b/tox.ini index 4829c13ee..31c5698f1 100644 --- a/tox.ini +++ b/tox.ini @@ -1,10 +1,8 @@ [tox] skipsdist = True envlist = py3-coverage,coveragereport,pep8,pylint,bashate,yamllint,functional,hotyvalidate -sitepackages = False minversion = 3.18.0 -# Tool configuration [flake8] # H106: Don't put vim configuration in source files # H203: Use assertIs(Not)None to check for None @@ -54,29 +52,17 @@ deps = commands = coverage: coverage erase # This environment can "optionally" gather coverage data with "-coverage" - # suffix. The gathered coverage data is consumed by the "coverage" environment - # which merges the data and then generates coverage reports in HTML and XML - # formats. + # suffix. The gathered coverage data is consumed by the "coverage" + # environment which merges the data and then generates coverage reports in + # HTML and XML formats. stestr run --random --slowest --test-path {[testenv]unit_tests} {posargs} + [testenv:pep8] commands = flake8 -v --exclude=fake_data_root {posargs:{[testenv]pyfiles}} [testenv:pylint] commands = pylint -v --rcfile={toxinidir}/pylintrc {posargs:{[testenv]pyfiles}} -[testenv:bashate] -commands = bashate --verbose {toxinidir}/tools/test/functest.sh - -[testenv:yamllint] -commands = yamllint -c yamllintrc {toxinidir}/hotsos {toxinidir}/tests {posargs} - -[testenv:functional] -allowlist_externals = bash -commands = bash {toxinidir}/tools/test/functest.sh - -[testenv:docs] -commands = sphinx-build -j auto -d {toxinidir}/doc/build/doctrees -b html {toxinidir}/doc/source doc/build/html - [testenv:coveragereport] depends = py3-coverage description = @@ -91,6 +77,19 @@ commands = coverage xml -o cover/coverage.xml coverage erase +[testenv:docs] +commands = sphinx-build -j auto -d {toxinidir}/doc/build/doctrees -b html {toxinidir}/doc/source doc/build/html + +[testenv:bashate] +commands = bashate --verbose {toxinidir}/tools/test/functest.sh + +[testenv:yamllint] +commands = yamllint -c yamllintrc {toxinidir}/hotsos {toxinidir}/tests {posargs} + +[testenv:functional] +allowlist_externals = bash +commands = bash {toxinidir}/tools/test/functest.sh + [testenv:hotyvalidate] setenv = PYTHONPATH={toxinidir} {[testenv]setenv}