Skip to content

Commit 090bd19

Browse files
authored
Merge pull request #17 from sandialabs/dev-create-release
draft updates to pyproject.toml and new CI/CD yml
2 parents 03ef468 + 26f7d2e commit 090bd19

File tree

2 files changed

+113
-12
lines changed

2 files changed

+113
-12
lines changed

.github/workflows/release.yml

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
name: Test, Release, and Publish
2+
3+
on:
4+
push:
5+
branches:
6+
- 'dev-create-release'
7+
# tags:
8+
# - 'v*'
9+
workflow_dispatch: # allows manual triggering of the workflow from the GitHub Actions tab
10+
11+
jobs:
12+
# 1. TEST JOB: Runs Pytest
13+
test:
14+
name: Run Unit Tests
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up Python
21+
uses: actions/setup-python@v5
22+
with:
23+
python-version: '3.8.12' # to match pyproject.tom exactly
24+
25+
- name: Install dependencies
26+
run: |
27+
python -m pip install --upgrade pip setuptools wheel
28+
# Install the package in editable mode with all dependencies
29+
pip install -e ".[dev]"
30+
31+
- name: Run Pytest
32+
run: pytest
33+
34+
# 2. RELEASE JOB: Only runs if 'test' passes
35+
release:
36+
name: Create GitHub Release
37+
needs: test
38+
runs-on: ubuntu-latest
39+
permissions:
40+
contents: write
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@v4
44+
45+
- name: Create Release
46+
uses: softprops/action-gh-release@v2
47+
with:
48+
# tag_name: ${{ github.ref_name }}
49+
tag_name: dev-build-${{ github.run_number }} # Use a unique tag for each release
50+
# name: Release ${{ github.ref_name }}
51+
name: Dev Build ${{ github.run_number }}
52+
# body: "Automated release for version ${{ github.ref_name }} (Tests Passed)"
53+
body: "Automated dev release from branch 'dev-create-release' (Commit: ${{ github.sha }})"
54+
draft: false
55+
# prerelease: false
56+
prerelease: true # Mark as pre-release since it's from a dev branch
57+
58+
# 3. PUBLISH JOB: Only runs if 'release' passes
59+
publish:
60+
name: Build and Publish to PyPI
61+
needs: release
62+
runs-on: ubuntu-latest
63+
environment: pypi
64+
permissions:
65+
id-token: write
66+
steps:
67+
- name: Checkout code
68+
uses: actions/checkout@v4
69+
70+
- name: Set up Python
71+
uses: actions/setup-python@v5
72+
with:
73+
python-version: '3.8.12' # to match pyproject.tom exactly
74+
75+
- name: Install build tools
76+
run: pip install build
77+
78+
- name: Build binary wheel and source tarball
79+
# Note: This will still use the version in pyproject.toml
80+
# To test PyPI repeatedly, you'd need to change the version in the file
81+
run: python -m build
82+
83+
- name: Publish to PyPI
84+
# We use 'continue-on-error' for dev branch PyPI pushes
85+
# because PyPI will reject duplicate versions.
86+
continue-on-error: true
87+
uses: pypa/gh-action-pypi-publish@release/v1

pyproject.toml

Lines changed: 26 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,35 +4,39 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "pytribeam"
7+
version = "0.0.2"
8+
description = "automated data collection on TriBeam tools"
9+
readme = "README.md"
10+
requires-python = "==3.8.12"
711
authors = [
812
{ name="Andrew Polonsky", email="apolon@sandia.gov" },
913
{ name="Chad Hovey", email="chovey@sandia.gov" },
1014
{ name="James Lamb", email="jdlamb@sandia.gov" },
1115
]
12-
description = "automated data collection on TriBeam tools"
13-
readme = "README.md"
14-
requires-python = "==3.8.12"
16+
1517
dependencies = [
16-
"black",
17-
"pytest",
18-
"pytest-cov",
18+
# "black", # now handled by ruff
19+
"pytest==8.3.3",
20+
"pytest-cov==5.0.0",
1921
"schema",
2022
]
21-
version = '0.0.2'
2223

2324
[project.optional-dependencies]
2425
dev = [
25-
"black",
26+
# "black", # now handled by ruff
2627
#"docstr-coverage",
2728
#"docutils<0.18,>=0.14",
28-
"flake8",
29+
# "flake8", # now handled by ruff
2930
#"jinja2",
3031
#"nbsphinx",
3132
#"pdbp",
32-
'pycodestyle',
33-
"pytest==8.3.3",
34-
"pytest-cov==5.0.0",
33+
# "pycodestyle", # now handled by ruff
34+
# "pytest==8.3.3", # already in dependencies
35+
# "pytest-cov==5.0.0", # already in dependencies
36+
"h5py",
37+
"numpy",
3538
"pdoc",
39+
"ruff",
3640
]
3741

3842
[docstr-coverage]
@@ -53,3 +57,13 @@ pytribeam_info ="pytribeam.command_line:module_info"
5357
pytribeam_gui="pytribeam.command_line:launch_gui"
5458
pytribeam_exp="pytribeam.command_line:run_experiment"
5559

60+
[tool.setuptools.packages.find]
61+
where = ["src"]
62+
63+
[tool.ruff]
64+
line-length = 88
65+
target-version = ["py38"]
66+
67+
[tool.pytest.ini_options]
68+
testpaths = ["tests"]
69+
addopts = "--cov=src/pytribeam --cov-report=xml --cov-report=html"

0 commit comments

Comments
 (0)