Skip to content

Feature/proxy uri

Feature/proxy uri #50

Workflow file for this run

name: CI
on:
push:
branches: [ main, feature/**, hotfix/**, release/**, bugfix/**, chore/**, refactor/** ]
pull_request:
branches: [ main ]
workflow_dispatch:
concurrency:
group: ci-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements-dev.txt
- name: Install ShellCheck
run: |
sudo apt-get update
sudo apt-get install -y shellcheck
- name: Black (check)
run: python -m black --check src tests
- name: Isort (check)
run: python -m isort --check-only src tests
- name: Flake8
run: python -m flake8 src tests
- name: Mypy
continue-on-error: true
run: |
python -m mypy --install-types --non-interactive src
- name: ShellCheck scripts
run: shellcheck scripts/*.sh
tests:
runs-on: ubuntu-latest
timeout-minutes: 20
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: requirements-dev.txt
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements-dev.txt
- name: Run pytest
env:
PYTHONPATH: src
run: |
if [ "${{ matrix.python-version }}" = "3.11" ]; then
pytest -q --cov=xnetvn_monitord --cov-report=xml --cov-report=html
else
pytest -q
fi
- name: Upload coverage artifacts
if: always() && matrix.python-version == '3.11'
uses: actions/upload-artifact@v4
with:
name: coverage-artifacts
path: |
coverage.xml
htmlcov/
build:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: requirements.txt
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-distutils python3-venv build-essential || true
python -m pip install --upgrade pip setuptools wheel
pip install -r requirements.txt
- name: Compile sources
run: python -m compileall -q src
package:
needs: [lint, tests, build]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Compute package version
id: version
run: echo "value=${GITHUB_REF_NAME//\//-}" >> "$GITHUB_OUTPUT"
- name: Create source archive
run: |
mkdir -p dist
git archive --format=tar.gz --prefix=xnetvn_monitord/ -o "dist/xnetvn_monitord-${{ steps.version.outputs.value }}.tar.gz" "${GITHUB_SHA}"
- name: Upload package artifact
uses: actions/upload-artifact@v4
with:
name: xnetvn_monitord-${{ steps.version.outputs.value }}
path: dist/*.tar.gz