Skip to content

Commit

Permalink
Added python action for publishing in pypi on release
Browse files Browse the repository at this point in the history
  • Loading branch information
JosePizarro3 committed Jun 25, 2024
1 parent 4fef7f4 commit 647e51e
Showing 1 changed file with 32 additions and 73 deletions.
105 changes: 32 additions & 73 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,84 +1,43 @@
# Upload python package to pypi server and github release.
# Reference: https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/
# This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries

name: Upload Python Package
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

name: Build and Publish Python Package

on:
release:
types: [published]

permissions:
contents: read

jobs:
# publish-to-pypi:
# name: >-
# Publish distribution to PyPI
# runs-on: ubuntu-latest
# environment:
# name: pypi
# url: https://pypi.org/p/nomad-simulations
# permissions:
# id-token: write # IMPORTANT: mandatory for trusted publishing
#
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v4
# with:
# python-version: "3.9"
# - 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: Publish distribution to PyPI
# uses: pypa/gh-action-pypi-publish@release/v1
deploy:

github-release:
name: >-
Sign the Python distribution with Sigstore
and upload them to GitHub Release
runs-on: ubuntu-latest
permissions:
contents: write # IMPORTANT: mandatory for making GitHub Releases
id-token: write # IMPORTANT: mandatory for sigstore

steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"
- 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: Sign the dists with Sigstore
uses: sigstore/[email protected]
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 }}'
- uses: actions/checkout@v3

- name: Set up Python 3.9
uses: actions/setup-python@v3
with:
python-version: '3.9'

- name: Install dependencies
run: |
pip install --upgrade pip
pip install build
- name: Build package
run: python -m build

- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}

1 comment on commit 647e51e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
src/nomad_simulations/schema_packages
   __init__.py14286%53–55
   atoms_state.py1902189%32–34, 220–223, 247, 302–303, 371–372, 374, 556, 568–569, 630–634, 649–653, 660
   general.py75791%30–31, 99, 163, 273–274, 284
   model_method.py2607770%29–31, 158–161, 164–171, 262–263, 283, 304–323, 339–365, 368–385, 737, 748, 790–797, 843, 862, 942, 1001, 1074, 1186
   model_system.py2612292%45–47, 514–517, 565–572, 746–747, 969–973, 979–980, 988–989, 994, 1017
   numerical_settings.py2636575%32–34, 166, 236, 238–239, 242–245, 249–250, 257–260, 269–272, 276–279, 281–284, 289–292, 298–301, 472–499, 574, 609–612, 636, 639, 684, 686–689, 693, 697, 744, 748–769, 824–825, 892, 901–903, 906
   outputs.py91891%26–27, 204–207, 247–250, 275, 277
   physical_property.py94496%38–40, 219
   variables.py641183%27–29, 115, 138, 158–159, 162, 184, 207, 227
src/nomad_simulations/schema_packages/properties
   band_gap.py51590%27–29, 154–155
   band_structure.py1112280%28–30, 250–283, 296, 303, 339–340, 343
   energies.py26581%26–28, 58, 86
   fermi_surface.py17476%26–28, 59
   hopping_matrix.py29583%26–28, 76, 111
   permittivity.py48883%26–28, 116–124
   spectral_profile.py25612452%28–30, 76–79, 114–117, 218–319, 375–387, 412–415, 435, 440–443, 485–521, 545, 592–595, 611–612, 617–623
src/nomad_simulations/schema_packages/utils
   utils.py661183%75–84, 93–94, 99, 102
TOTAL192440179% 

Tests Skipped Failures Errors Time
299 0 💤 0 ❌ 0 🔥 2.341s ⏱️

Please sign in to comment.