Skip to content

chore(deps): update dependency pydantic to v2 #1498

chore(deps): update dependency pydantic to v2

chore(deps): update dependency pydantic to v2 #1498

Workflow file for this run

name: tests
on:
push:
branches:
- "main"
- "feature/*"
- "hotfix/*"
- "release/*"
pull_request:
# Allows triggering the workflow manually from the Actions tab
workflow_dispatch:
inputs:
enable_ssh_access:
type: boolean
description: 'Enable ssh access'
required: false
default: false
jobs:
linters:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Configure environment
run: |
echo "::group::Begin snap install"
echo "Installing snaps in the background while running apt and pip..."
sudo snap install --no-wait --classic pyright
sudo snap install --no-wait shellcheck
echo "::endgroup::"
echo "::group::pip install"
python -m pip install 'tox>=4'
echo "::endgroup::"
echo "::group::Create virtual environments for linting processes."
tox run -m lint --notest
echo "::endgroup::"
echo "::group::Wait for snap to complete"
snap watch --last=install
echo "::endgroup::"
- name: Enable ssh access
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.enable_ssh_access }}
with:
limit-access-to-actor: true
- name: Run Linters
run: tox run --skip-pkg-install --no-list-dependencies -m lint
unit-tests:
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python versions on ${{ matrix.platform }}
uses: actions/setup-python@v4
with:
python-version: |
3.8
3.9
3.10
3.11
3.12-dev
cache: 'pip'
- name: Configure environment
run: |
echo "::group::pip install"
python -m pip install 'tox>=4.6'
echo "::endgroup::"
mkdir -p results
- name: Setup Tox environments
run: tox run -m unit-tests --notest
- name: Enable ssh access
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.enable_ssh_access }}
with:
limit-access-to-actor: true
- name: Test with tox
# use `tox` instead of `.tox/.tox/bin/tox` to support Windows
run: tox run --skip-pkg-install --no-list-dependencies --result-json results/tox-${{ matrix.platform }}.json -m unit-tests
env:
PYTEST_ADDOPTS: "--no-header -vv -rN"
- name: Upload code coverage
uses: codecov/codecov-action@v3
with:
directory: ./results/
files: coverage*.xml
- name: Upload test results
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: test-results-${{ matrix.platform }}
path: results/
integration-tests-linux:
strategy:
matrix:
python: [
{system-version: "3.8", tox-version: "py3.8"},
{system-version: "3.10", tox-version: "py3.10"},
{system-version: "3.11", tox-version: "py3.11"},
{system-version: "3.12-dev", tox-version: "py3.12"},
]
# does not work with canonical/setup-lxd github action (see https://github.com/canonical/craft-providers/issues/271)
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python.system-version }}
cache: 'pip'
- name: Configure environment
run: |
echo "::group::pip install"
python -m pip install 'tox>=4.6'
echo "::endgroup::"
echo "::group::Configure LXD"
sudo groupadd --force --system lxd
sudo usermod --append --groups lxd $USER
sudo snap refresh lxd --channel=latest/stable
sudo snap start lxd
sudo lxd waitready --timeout=30
sudo lxd init --auto
# iptables calls from https://github.com/canonical/setup-lxd/blob/main/action.yml
sudo iptables -I DOCKER-USER -i lxdbr0 -j ACCEPT
sudo iptables -I DOCKER-USER -o lxdbr0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
echo "::endgroup::"
- name: Setup Tox environments
run: tox run -e integration-${{ matrix.python.tox-version }} --notest
- name: Enable ssh access
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.enable_ssh_access }}
with:
limit-access-to-actor: true
- name: Run integration tests on Linux
env:
CRAFT_PROVIDERS_TESTS_ENABLE_SNAP_INSTALL: 1
CRAFT_PROVIDERS_TESTS_ENABLE_LXD_INSTALL: 1
CRAFT_PROVIDERS_TESTS_ENABLE_LXD_UNINSTALL: 1
PYTEST_ADDOPTS: "--no-header -vv -rN"
run: |
sg lxd -c "lxc version"
sg lxd -c ".tox/.tox/bin/tox run --skip-pkg-install --no-list-dependencies -e integration-${{ matrix.python.tox-version }}"
integration-tests-macos:
strategy:
matrix:
python: ["3.11"]
runs-on: macos-latest
steps:
- name: Install Multipass
run: |
brew update
brew install multipass
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
cache: 'pip'
- name: Configure environment
run: |
echo "::group::pip install"
python -m pip install 'tox>=4.6'
echo "::endgroup::"
echo "::group::Configure Multipass"
while ! multipass version
do
sleep 1
done
echo "::endgroup::"
- name: Setup Tox environments
run: tox run -e integration-py${{ matrix.python }} --notest
- name: Enable ssh access
uses: mxschmitt/action-tmate@v3
if: ${{ inputs.enable_ssh_access }}
with:
limit-access-to-actor: true
- name: Run integration tests on MacOS
env:
CRAFT_PROVIDERS_TESTS_ENABLE_MULTIPASS_INSTALL: 1
CRAFT_PROVIDERS_TESTS_ENABLE_MULTIPASS_UNINSTALL: 1
PYTEST_ADDOPTS: "--no-header -vv -rN"
run: |
.tox/.tox/bin/tox run --skip-pkg-install --no-list-dependencies -e integration-py${{ matrix.python }}