Skip to content

Commit

Permalink
Add GitHub releasing
Browse files Browse the repository at this point in the history
  • Loading branch information
kralka committed Dec 3, 2024
1 parent 0bbfed6 commit 7542659
Show file tree
Hide file tree
Showing 4 changed files with 162 additions and 68 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/publish-to-pypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI

on: push

jobs:
build:
name: Build distribution 📦
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.x"
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: >-
Publish Python 🐍 distribution 📦 to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/scaaml
permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

github-release:
name: >-
Sign the Python 🐍 distribution 📦 with Sigstore
and upload them to GitHub Release
needs:
- publish-to-pypi
runs-on: ubuntu-latest

permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Sign the dists with Sigstore
uses: sigstore/gh-action-sigstore-python@v3.0.0
with:
inputs: >-
./dist/*.tar.gz
./dist/*.whl
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
run: >-
gh release create
'${{ github.ref_name }}'
--repo '${{ github.repository }}'
--notes ""
- name: Upload artifact signatures to GitHub Release
env:
GITHUB_TOKEN: ${{ github.token }}
# Upload to GitHub Release using the `gh` CLI.
# `dist/` contains the built packages, and the
# sigstore-produced signatures and certificates.
run: >-
gh release upload
'${{ github.ref_name }}' dist/**
--repo '${{ github.repository }}'
64 changes: 64 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
[build-system]
requires = ["setuptools>=61.0", "setuptools-scm"]
build-backend = "setuptools.build_meta"

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

[project]
name = "scaaml"
version = "2.0.2"
authors = [
{ name="Elie Bursztein"},
{ name="Luca Invernizzi"},
{ name="Karel Král"},
{ name="Jean-Michel Picod"},
]
description = "Side Channel Attack Assisted with Machine Learning"
readme = "README.md"
requires-python = ">=3.10"
keywords = ["machine learning", "dataset", "side channel attack"]
license = {text = "Apache License 2.0"}
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Framework :: Jupyter",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
]
dynamic = []
dependencies = [
"chipwhisperer",
"colorama",
"cryptography",
"matplotlib",
"numpy",
"pandas",
"Pillow",
"pip",
"pygments",
"pytest",
"pyvisa",
"pyvisa-py",
"scipy",
"semver",
"setuptools",
"tabulate",
"tensorflow",
"termcolor",
"tqdm",
"wheel",
]

[project.optional-dependencies]

[project.scripts]

[project.urls]
"Homepage" = "https://github.com/google/scaaml"
"Bug Tracker" = "https://github.com/google/scaaml"

[tool.setuptools.package-data]
scaaml = ["py.typed"]
20 changes: 0 additions & 20 deletions requirements.in

This file was deleted.

52 changes: 4 additions & 48 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,53 +11,9 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Setup script."""
from setuptools import find_packages
from setuptools import setup
from time import time
"""Compatibility with legacy builds.
"""

with open("README.md", encoding="utf-8") as readme_file:
long_description = readme_file.read()
version = f"2.0.1r{int(time())}"
from setuptools import setup

setup(
name="scaaml",
python_requires=">=3.9",
version=version,
description="Side Channel Attack Assisted with Machine Learning",
long_description=long_description,
author="Elie Bursztein",
author_email="scaaml@google.com",
url="https://github.com/google/scaaml",
license="Apache License 2.0",
install_requires=[
"colorama",
"termcolor",
"tqdm",
"pandas",
"pytest",
"numpy",
"tabulate",
"matplotlib",
"Pillow",
"tensorflow>=2.2.0",
"pygments",
"pyvisa",
"pyvisa-py",
"chipwhisperer",
"scipy",
"semver",
],
package_data={"": ["*.pickle"]},
classifiers=[
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Framework :: Jupyter",
"License :: OSI Approved :: Apache Software License",
"Intended Audience :: Science/Research",
"Programming Language :: Python :: 3",
"Topic :: Security :: Cryptography",
"Topic :: Scientific/Engineering :: Artificial Intelligence",
],
packages=find_packages(),
)
setup()

0 comments on commit 7542659

Please sign in to comment.