Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
111 changes: 111 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
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
7 changes: 6 additions & 1 deletion .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,15 @@ on:
push:
branches:
- main

concurrency:
group: release
cancel-in-progress: false

jobs:
release:
runs-on: ubuntu-latest
permissions:
permissions:
contents: write
steps:
- name: Checkout code
Expand Down
12 changes: 12 additions & 0 deletions .github/workflows/publish.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: publish artifact
on:
workflow_dispatch:
inputs:
release_tag:
description: 'Release tag to publish (leave empty for latest)'
required: false
type: string
release:
types: [published]

Expand All @@ -13,18 +18,25 @@ jobs:
- uses: actions/checkout@v6
with:
token: ${{ secrets.ADMIN_TOKEN }}
ref: ${{ inputs.release_tag || github.ref }}

- name: Set up Python 3.9
uses: actions/setup-python@v6
with:
python-version: 3.9

- name: Install build dependencies with pinned setuptools
run: |
python -m pip install --upgrade pip
python -m pip install "setuptools<82" build wheel --user

- name: Build a binary wheel and a source tarball
run: |
python -m build --no-isolation --sdist --wheel --outdir dist/ .

- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
skip-existing: true
timeout-minutes: 10
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ share/python-wheels/
.installed.cfg
*.egg
MANIFEST
**DS_STORE

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down
Loading