fix(app) fix work dir in managed runs #287
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, linting, etc. | |
on: | |
push: | |
branches: | |
- "main" | |
- "feature/*" | |
- "hotfix/*" | |
- "release/*" | |
pull_request: | |
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.11' | |
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::apt-get" | |
sudo apt update | |
sudo apt-get install -y libapt-pkg-dev | |
echo "::endgroup::" | |
echo "::group::pip install" | |
python -m pip install tox | |
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: Run Linters | |
run: .tox/.tox/bin/tox run --skip-pkg-install --no-list-dependencies -m lint | |
tests: | |
strategy: | |
matrix: | |
platform: [ubuntu-20.04, ubuntu-22.04] | |
runs-on: ${{ matrix.platform }} | |
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.10 | |
3.11 | |
3.12-dev | |
cache: 'pip' | |
- name: Setup LXD | |
uses: canonical/[email protected] | |
with: | |
channel: latest/stable | |
- name: Configure environment | |
run: | | |
echo "::group::apt-get" | |
sudo apt update | |
sudo apt-get install -y libapt-pkg-dev | |
echo "::endgroup::" | |
echo "::group::pip install" | |
python -m pip install tox | |
echo "::endgroup::" | |
mkdir -p results | |
- name: Setup Tox environments | |
run: tox run -m tests --notest | |
- name: Test with tox | |
run: .tox/.tox/bin/tox run --skip-pkg-install --no-list-dependencies --result-json results/tox-${{ matrix.platform }}.json -m 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-macos: | |
strategy: | |
matrix: | |
python: [ | |
{system-version: "3.11", tox-version: "py311"}, | |
] | |
runs-on: macos-latest | |
steps: | |
- name: Install Multipass early | |
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.system-version }} | |
cache: 'pip' | |
- name: Install Tox | |
run: | | |
echo "::group::pip install" | |
python -m pip install 'tox>=4.6' | |
echo "::endgroup::" | |
- name: Setup Tox environments | |
run: tox run -e integration-${{ matrix.python.tox-version }} --notest | |
- name: Wait for multipass | |
run: | | |
while ! multipass version | |
do | |
sleep 2 | |
done | |
- name: Run integration tests on MacOS | |
env: | |
PYTEST_ADDOPTS: "--no-header -vv -rN" | |
run: | | |
.tox/.tox/bin/tox run --skip-pkg-install --no-list-dependencies -e integration-${{ matrix.python.tox-version }} |