This commit is contained in:
Avram Lubkin 2022-11-03 13:35:06 -04:00 коммит произвёл LiliDeng
Родитель 2add730312
Коммит ecd95f6815
1 изменённых файлов: 51 добавлений и 39 удалений

Просмотреть файл

@ -2,60 +2,72 @@ name: CI Workflow
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
Check:
continue-on-error: ${{ matrix.optional || false }}
runs-on: ${{ matrix.os }}
name: >-
${{ matrix.nox-session || matrix.task }}
(${{ matrix.os }}, ${{ matrix.python-version }})
${{ matrix.optional && '[OPTIONAL]' }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
python-version: ["3.8", "3.9", "3.10"]
fail-fast: false
steps:
- name: Checkout repository to $GITHUB_WORKSPACE
uses: actions/checkout@v2
python-version: ['3.9', '3.10']
nox-session: [test, example]
include:
- name: Setup bootstrap Python
- os: ubuntu-latest
python-version: ''
nox-session: ''
task: shellcheck
- os: ubuntu-latest
python-version: '3.8'
nox-session: flake8
- os: ubuntu-latest
python-version: '3.8'
nox-session: mypy
- os: ubuntu-latest
python-version: '3.8'
nox-session: docs
- os: ubuntu-latest
python-version: '3.8'
nox-session: coverage
env:
NOXSESSION: ${{ matrix.nox-session }}
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
if: matrix.python-version
- name: Install Poetry for Linux
if: runner.os == 'Linux'
- name: Install system dependencies
run: |
curl -sSL https://install.python-poetry.org/ | python - --version 1.1.5
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install Poetry for Windows
if: runner.os == 'Windows'
run: |
(Invoke-WebRequest -Uri https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py -UseBasicParsing).Content | python - --version 1.1.5
echo "$env:APPDATA\Python\Scripts" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- name: Install Python dependencies (Linux-only)
if: runner.os == 'Linux'
run: |
sudo apt update
sudo apt install libgirepository1.0-dev libcairo2-dev qemu-utils libvirt-dev
- name: Install Python dependencies
run: make setup
sudo apt install libgirepository1.0-dev
if: startsWith(matrix.os, 'ubuntu')
- name: Run hello-world
run: make run
- name: Install Nox
run: pip install nox toml
if: matrix.nox-session
- name: Run unit tests
run: make test
- name: Calculate code coverage
run: make coverage
if: matrix.python-version == '3.8'
- name: Run black/flake8/isort/mypy
run: make check
if: matrix.python-version == '3.8'
- name: Run Nox
run: nox -v
if: matrix.nox-session
- name: Run ShellCheck
if: runner.os == 'Linux' && matrix.python-version == '3.8'
uses: ludeeus/action-shellcheck@0.5.0
uses: ludeeus/action-shellcheck@1.1.0
if: matrix.task == 'shellcheck'