Skip to content

Commit

Permalink
Sync se-tooling-ci-common
Browse files Browse the repository at this point in the history
 * tox.ini
 * .github_workflows/run-tests.yaml
 * .github_workflows/build.yaml
 * renamed snapbuild.yaml and snapfunctionaltest.yaml to align with upstream
  • Loading branch information
dosaboy committed Jul 16, 2024
1 parent e3cfa1e commit 77d9221
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 33 deletions.
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
20 changes: 13 additions & 7 deletions .github/workflows/tests.yaml → .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
File renamed without changes.
35 changes: 17 additions & 18 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 =
Expand All @@ -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}
Expand Down

0 comments on commit 77d9221

Please sign in to comment.