Skip to content

Commit c950aa9

Browse files
Yuval Shlomo DekelYuval Shlomo Dekel
authored andcommitted
Enhance GH workflow
1 parent edbd20f commit c950aa9

4 files changed

Lines changed: 130 additions & 1 deletion

File tree

.github/workflows/ci.yml

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
name: CI Tests
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
push:
7+
branches: [main]
8+
workflow_dispatch:
9+
10+
jobs:
11+
test:
12+
name: Test Python ${{ matrix.python-version }}
13+
runs-on: ubuntu-latest
14+
strategy:
15+
fail-fast: false
16+
matrix:
17+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
18+
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v6
22+
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v6
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
cache: 'pip'
28+
29+
- name: Install dependencies
30+
run: |
31+
python -m pip install --upgrade pip
32+
pip install -r requirements.txt
33+
pip install -r requirements-dev.txt
34+
35+
- name: Run linting
36+
run: |
37+
pylint ibm_secrets_manager_sdk --rcfile=.pylintrc || true
38+
39+
- name: Run unit tests
40+
run: |
41+
pytest test/unit/ -v --tb=short
42+
43+
- name: Run integration tests
44+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
45+
env:
46+
SECRETS_MANAGER_URL: ${{ secrets.SECRETS_MANAGER_URL }}
47+
SECRETS_MANAGER_APIKEY: ${{ secrets.SECRETS_MANAGER_APIKEY }}
48+
run: |
49+
pytest test/integration/ -v --tb=short || echo "Integration tests skipped or failed"
50+
51+
lint:
52+
name: Code Quality Checks
53+
runs-on: ubuntu-latest
54+
55+
steps:
56+
- name: Checkout code
57+
uses: actions/checkout@v6
58+
59+
- name: Set up Python 3.9
60+
uses: actions/setup-python@v6
61+
with:
62+
python-version: 3.9
63+
cache: 'pip'
64+
65+
- name: Install dependencies
66+
run: |
67+
python -m pip install --upgrade pip
68+
pip install -r requirements-dev.txt
69+
70+
- name: Check code formatting
71+
run: |
72+
pip install black
73+
black --check ibm_secrets_manager_sdk/ test/ || echo "Code formatting check completed"
74+
75+
- name: Run pylint
76+
run: |
77+
pylint ibm_secrets_manager_sdk --rcfile=.pylintrc --exit-zero
78+
79+
build:
80+
name: Build Distribution
81+
runs-on: ubuntu-latest
82+
83+
steps:
84+
- name: Checkout code
85+
uses: actions/checkout@v6
86+
87+
- name: Set up Python 3.9
88+
uses: actions/setup-python@v6
89+
with:
90+
python-version: 3.9
91+
92+
- name: Install build dependencies
93+
run: |
94+
python -m pip install --upgrade pip
95+
python -m pip install "setuptools<82" build wheel
96+
97+
- name: Build distribution
98+
run: |
99+
python -m build --no-isolation --sdist --wheel --outdir dist/ .
100+
101+
- name: Check distribution
102+
run: |
103+
pip install twine
104+
twine check dist/*
105+
106+
- name: Upload artifacts
107+
uses: actions/upload-artifact@v4
108+
with:
109+
name: python-package-distributions
110+
path: dist/
111+
retention-days: 7

.github/workflows/create-release.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ on:
55
push:
66
branches:
77
- main
8+
9+
concurrency:
10+
group: release
11+
cancel-in-progress: false
12+
813
jobs:
914
release:
1015
runs-on: ubuntu-latest
11-
permissions:
16+
permissions:
1217
contents: write
1318
steps:
1419
- name: Checkout code

.github/workflows/publish.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: publish artifact
22
on:
33
workflow_dispatch:
4+
inputs:
5+
release_tag:
6+
description: 'Release tag to publish (leave empty for latest)'
7+
required: false
8+
type: string
49
release:
510
types: [published]
611

@@ -13,18 +18,25 @@ jobs:
1318
- uses: actions/checkout@v6
1419
with:
1520
token: ${{ secrets.ADMIN_TOKEN }}
21+
ref: ${{ inputs.release_tag || github.ref }}
22+
1623
- name: Set up Python 3.9
1724
uses: actions/setup-python@v6
1825
with:
1926
python-version: 3.9
27+
2028
- name: Install build dependencies with pinned setuptools
2129
run: |
2230
python -m pip install --upgrade pip
2331
python -m pip install "setuptools<82" build wheel --user
32+
2433
- name: Build a binary wheel and a source tarball
2534
run: |
2635
python -m build --no-isolation --sdist --wheel --outdir dist/ .
36+
2737
- name: Publish distribution to PyPI
2838
uses: pypa/gh-action-pypi-publish@release/v1
2939
with:
3040
password: ${{ secrets.PYPI_API_TOKEN }}
41+
skip-existing: true
42+
timeout-minutes: 10

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ share/python-wheels/
2626
.installed.cfg
2727
*.egg
2828
MANIFEST
29+
**DS_STORE
2930

3031
# PyInstaller
3132
# Usually these files are written by a python script from a template

0 commit comments

Comments
 (0)