Skip to content
Merged
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
87 changes: 87 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
name: Test, Release, and Publish

on:
push:
branches:
- 'dev-create-release'
# tags:
# - 'v*'
workflow_dispatch: # allows manual triggering of the workflow from the GitHub Actions tab

jobs:
# 1. TEST JOB: Runs Pytest
test:
name: Run Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8.12' # to match pyproject.tom exactly

- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools wheel
# Install the package in editable mode with all dependencies
pip install -e ".[dev]"

- name: Run Pytest
run: pytest

# 2. RELEASE JOB: Only runs if 'test' passes
release:
name: Create GitHub Release
needs: test
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Create Release
uses: softprops/action-gh-release@v2
with:
# tag_name: ${{ github.ref_name }}
tag_name: dev-build-${{ github.run_number }} # Use a unique tag for each release
# name: Release ${{ github.ref_name }}
name: Dev Build ${{ github.run_number }}
# body: "Automated release for version ${{ github.ref_name }} (Tests Passed)"
body: "Automated dev release from branch 'dev-create-release' (Commit: ${{ github.sha }})"
draft: false
# prerelease: false
prerelease: true # Mark as pre-release since it's from a dev branch

# 3. PUBLISH JOB: Only runs if 'release' passes
publish:
name: Build and Publish to PyPI
needs: release
runs-on: ubuntu-latest
environment: pypi
permissions:
id-token: write
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.8.12' # to match pyproject.tom exactly

- name: Install build tools
run: pip install build

- name: Build binary wheel and source tarball
# Note: This will still use the version in pyproject.toml
# To test PyPI repeatedly, you'd need to change the version in the file
run: python -m build

- name: Publish to PyPI
# We use 'continue-on-error' for dev branch PyPI pushes
# because PyPI will reject duplicate versions.
continue-on-error: true
uses: pypa/gh-action-pypi-publish@release/v1
38 changes: 26 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,39 @@ build-backend = "setuptools.build_meta"

[project]
name = "pytribeam"
version = "0.0.2"
description = "automated data collection on TriBeam tools"
readme = "README.md"
requires-python = "==3.8.12"
authors = [
{ name="Andrew Polonsky", email="apolon@sandia.gov" },
{ name="Chad Hovey", email="chovey@sandia.gov" },
{ name="James Lamb", email="jdlamb@sandia.gov" },
]
description = "automated data collection on TriBeam tools"
readme = "README.md"
requires-python = "==3.8.12"

dependencies = [
"black",
"pytest",
"pytest-cov",
# "black", # now handled by ruff
"pytest==8.3.3",
"pytest-cov==5.0.0",
"schema",
]
version = '0.0.2'

[project.optional-dependencies]
dev = [
"black",
# "black", # now handled by ruff
#"docstr-coverage",
#"docutils<0.18,>=0.14",
"flake8",
# "flake8", # now handled by ruff
#"jinja2",
#"nbsphinx",
#"pdbp",
'pycodestyle',
"pytest==8.3.3",
"pytest-cov==5.0.0",
# "pycodestyle", # now handled by ruff
# "pytest==8.3.3", # already in dependencies
# "pytest-cov==5.0.0", # already in dependencies
"h5py",
"numpy",
"pdoc",
"ruff",
]

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

[tool.setuptools.packages.find]
where = ["src"]

[tool.ruff]
line-length = 88
target-version = ["py38"]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--cov=src/pytribeam --cov-report=xml --cov-report=html"
Loading