Skip to content

Commit 4d88402

Browse files
committed
moved to pdm
Signed-off-by: Sylvain Hellegouarch <sh@defuze.org>
1 parent 75e689d commit 4d88402

File tree

15 files changed

+798
-219
lines changed

15 files changed

+798
-219
lines changed

.github/workflows/build.yaml

Lines changed: 25 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build, Test, and Lint
1+
name: Build
22

33
on:
44
push:
@@ -8,47 +8,35 @@ on:
88

99
jobs:
1010
build:
11-
runs-on: ubuntu-22.04
12-
steps:
13-
- uses: actions/checkout@v3
14-
- name: Set up Python
15-
uses: actions/setup-python@v4
16-
with:
17-
python-version: '3.7'
18-
- name: Install dependencies
19-
run: |
20-
python -m pip install --upgrade pip setuptools wheel
21-
- name: Build the package
22-
run : |
23-
make build
24-
lint:
25-
runs-on: ubuntu-22.04
26-
steps:
27-
- uses: actions/checkout@v3
28-
- name: Set up Python
29-
uses: actions/setup-python@v4
30-
with:
31-
python-version: '3.7'
32-
- name: Install dependencies
33-
run: |
34-
make install-dev
35-
- name: Lint
36-
run: |
37-
make lint
38-
test:
39-
runs-on: ubuntu-22.04
11+
runs-on: ${{ matrix.os }}
4012
strategy:
4113
matrix:
42-
python-version: [3.7, 3.8, 3.9, "3.10"]
14+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
15+
os: ["ubuntu-latest", "macos-latest"]
4316
steps:
44-
- uses: actions/checkout@v3
45-
- name: Set up Python ${{ matrix.python-version }}
46-
uses: actions/setup-python@v4
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Set up PDM
22+
uses: pdm-project/setup-pdm@v4
4723
with:
4824
python-version: ${{ matrix.python-version }}
25+
cache: true
26+
prerelease: true
27+
28+
- name: Ensure lock file is up to date
29+
run: |
30+
pdm lock --check
31+
4932
- name: Install dependencies
5033
run: |
51-
make install-dev
52-
- name: Run tests
34+
pdm sync -d
35+
36+
- name: Run Lint
37+
run: |
38+
pdm run lint
39+
40+
- name: Run Tests
5341
run: |
54-
make tests
42+
pdm run pytest

.github/workflows/release.yaml

Lines changed: 46 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Release
22

33
on:
4-
pull_request:
5-
branches-ignore:
6-
- 'main'
74
push:
85
tags:
96
- '[0-9]+.[0-9]+.[0-9]+'
@@ -12,26 +9,55 @@ on:
129
jobs:
1310
release-to-pypi:
1411
runs-on: ubuntu-22.04
12+
environment: release
13+
permissions:
14+
id-token: write
1515
steps:
16-
- uses: actions/checkout@v3
17-
- name: Set up Python
18-
uses: actions/setup-python@v4
16+
- uses: actions/checkout@v4
17+
- name: Set up PDM
18+
uses: pdm-project/setup-pdm@v4
1919
with:
20-
python-version: '3.7'
21-
- name: Install dependencies
22-
run: |
23-
python -m pip install --upgrade pip
24-
pip install -U setuptools wheel twine
25-
- name: Build and publish
20+
python-version: "3.8"
21+
- name: Build wheels
22+
run: pdm build --no-sdist
2623
env:
27-
TWINE_USERNAME: __token__
28-
TWINE_PASSWORD: ${{ secrets.PYPI_PWD }}
29-
run: |
30-
python3 setup.py release
31-
twine upload dist/*
32-
# push artifacts for other jobs to use
24+
PDM_BUILD_SCM_VERSION: ${{github.ref_name}}
25+
- name: Publish package distributions to PyPI
26+
uses: pypa/gh-action-pypi-publish@release/v1
3327
- name: Upload packages as artifacts
3428
uses: actions/upload-artifact@v2-preview
3529
with:
36-
name: chaostoolkit-packages
37-
path: dist/chaostoolkit-*
30+
name: chaostoolkit-datadog-packages
31+
path: dist/chaostoolkit*
32+
33+
create-gh-release:
34+
runs-on: ubuntu-22.04
35+
steps:
36+
- name: Create Release
37+
uses: actions/create-release@latest
38+
env:
39+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40+
with:
41+
tag_name: ${{ github.ref }}
42+
release_name: Release ${{ github.ref }}
43+
draft: false
44+
prerelease: false
45+
46+
upload-gh-release-assets:
47+
runs-on: ubuntu-22.04
48+
needs:
49+
- create-gh-release
50+
- release-to-pypi
51+
steps:
52+
- name: Download pypi artifacts
53+
uses: actions/download-artifact@v2-preview
54+
with:
55+
name: chaostoolkit-datadog-packages
56+
path: dist
57+
- name: Upload wheel & source dist to GH release
58+
uses: ncipollo/release-action@v1
59+
with:
60+
artifacts: "dist/*.whl,dist/*.tar.gz"
61+
artifact: ""
62+
token: ${{ secrets.GITHUB_TOKEN }}
63+
allowUpdates: true

.gitignore

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,4 +103,11 @@ ENV/
103103
.DS_Store
104104
junit-test-results.xml
105105

106-
.pytest_cache/
106+
.pytest_cache/
107+
108+
# pdm
109+
.pdm-python
110+
.pdm-build/
111+
112+
# ruff
113+
.ruff_cache/

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
[Unreleased]: https://github.com/chaostoolkit-incubator/chaostoolkit-datadog/compare/0.2.0...HEAD
66

7+
### Changed
8+
9+
* Moved away from `setuptools` to `pdm` to manage the package
10+
* Moved to `ruff` to lint the code
11+
712
## [0.2.0][]
813

914
[0.2.0]: https://github.com/chaostoolkit-incubator/chaostoolkit-datadog/compare/0.1.1...0.2.0

MANIFEST.in

Lines changed: 0 additions & 5 deletions
This file was deleted.

Makefile

Lines changed: 0 additions & 28 deletions
This file was deleted.

chaosdatadog/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from contextlib import contextmanager
2+
from importlib.metadata import version, PackageNotFoundError
23
from typing import Generator, List
34

45
from chaoslib.discovery.discover import (
@@ -15,7 +16,10 @@
1516
from datadog_api_client import Configuration as DDCfg
1617
from logzero import logger
1718

18-
__version__ = "0.2.0"
19+
try:
20+
__version__ = version("chaostoolkit-datadog")
21+
except PackageNotFoundError:
22+
__version__ = "unknown"
1923

2024

2125
@contextmanager

0 commit comments

Comments
 (0)