Skip to content

Creating the link only if the folder does not exist #44

Creating the link only if the folder does not exist

Creating the link only if the folder does not exist #44

Workflow file for this run

name: CI
on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
schedule:
- cron: '0 6 * * 1' # Run weekly on Mondays
workflow_dispatch: # Allow manual triggering
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
lint:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Lint with ruff
run: |
ruff check clabtoolkit tests --output-format=github
- name: Format check with black
run: |
black --check --diff clabtoolkit tests
- name: Type check with mypy
run: |
mypy clabtoolkit --show-error-codes
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
# Reduce matrix size for faster CI
- os: windows-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.9"
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install system dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libgl1-mesa-glx
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev,test]
- name: Test with pytest
run: |
pytest --cov=clabtoolkit --cov-report=xml --cov-report=term-missing -v
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
build:
name: Build Package
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for proper versioning
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine check-manifest
- name: Check manifest
run: |
check-manifest
- name: Build package
run: |
python -m build
- name: Check package
run: |
twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v4
with:
name: dist-packages
path: dist/
retention-days: 7
security:
name: Security Scan
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bandit[toml] safety
- name: Run bandit security scan
run: |
bandit -r clabtoolkit -f json -o bandit-report.json || true
bandit -r clabtoolkit
- name: Run safety check
run: |
safety check --json --output safety-report.json || true
safety check
- name: Upload security reports
uses: actions/upload-artifact@v4
if: always()
with:
name: security-reports
path: |
bandit-report.json
safety-report.json
retention-days: 30
publish-testpypi:
name: Publish to TestPyPI
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/tags/v') && (contains(github.ref, 'dev') || contains(github.ref, 'a') || contains(github.ref, 'b') || contains(github.ref, 'rc'))) || (github.ref == 'refs/heads/develop')
environment: testpypi
permissions:
id-token: write # For trusted publishing
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist-packages
path: dist/
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
user: __token__
password: ${{ secrets.TESTPYPI_KEY }}
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [build]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, 'dev') && !contains(github.ref, 'a') && !contains(github.ref, 'b') && !contains(github.ref, 'rc')
environment: release
permissions:
id-token: write # For trusted publishing
steps:
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: dist-packages
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_KEY }}