github: add unit-tests job #82
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
- push | |
- pull_request | |
permissions: | |
contents: read | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
lint: | |
name: Lint | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v4 | |
- name: Lint shell files | |
uses: ludeeus/action-shellcheck@master | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip tox | |
- name: Lint Python files | |
run: | | |
tox -e lint | |
- name: Typecheck Python files | |
run: | | |
tox -e check | |
unit-tests: | |
name: Unit tests | |
runs-on: ubuntu-22.04 | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v4 | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip tox | |
- name: Run unit tests | |
run: | | |
tox -e testing | |
tests: | |
name: Tests | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: ["3.8", "3.10", "3.12"] | |
track: ["latest/edge", "5.21/edge", "5.0/edge"] | |
os: ["24.04"] | |
include: | |
# 4.0/* isn't supported on 24.04 | |
- python-version: "3.8" | |
track: "4.0/edge" | |
os: "22.04" | |
runs-on: ubuntu-${{ matrix.os }} | |
steps: | |
- name: Repository checkout | |
uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setup LXD | |
uses: canonical/setup-lxd@main | |
with: | |
channel: ${{ matrix.track }} | |
- name: Install dependencies | |
run: | | |
set -x | |
pip install --upgrade pip tox codecov | |
- name: Coverage | |
run: | | |
tox -e coverage | |
codecov | |
- name: Integration | |
run: | | |
integration/run-integration-tests | |
publish: | |
name: Publish | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.event.ref, 'refs/tags') | |
permissions: | |
contents: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Create Release | |
uses: ncipollo/release-action@v1 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
name: Release ${{ github.ref }} | |
generateReleaseNotes: true |