Skip to content

Enhance GH workflow

Enhance GH workflow #1

Workflow file for this run

name: CI Tests
on:
pull_request:
branches: [main]
push:
branches: [main]
workflow_dispatch:
jobs:
test:
name: Test Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v6
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements-dev.txt
- name: Run linting
run: |
pylint ibm_secrets_manager_sdk --rcfile=.pylintrc || true
- name: Run unit tests
run: |
pytest test/unit/ -v --tb=short
- name: Run integration tests
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
env:
SECRETS_MANAGER_URL: ${{ secrets.SECRETS_MANAGER_URL }}
SECRETS_MANAGER_APIKEY: ${{ secrets.SECRETS_MANAGER_APIKEY }}
run: |
pytest test/integration/ -v --tb=short || echo "Integration tests skipped or failed"
lint:
name: Code Quality Checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python 3.9
uses: actions/setup-python@v6
with:
python-version: 3.9
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
- name: Check code formatting
run: |
pip install black
black --check ibm_secrets_manager_sdk/ test/ || echo "Code formatting check completed"
- name: Run pylint
run: |
pylint ibm_secrets_manager_sdk --rcfile=.pylintrc --exit-zero
build:
name: Build Distribution
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
- name: Set up Python 3.9
uses: actions/setup-python@v6
with:
python-version: 3.9
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
python -m pip install "setuptools<82" build wheel
- name: Build distribution
run: |
python -m build --no-isolation --sdist --wheel --outdir dist/ .
- name: Check distribution
run: |
pip install twine
twine check dist/*
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/
retention-days: 7