Skip to content

Commit

Permalink
ci: switch to PyPI's trusted publishing
Browse files Browse the repository at this point in the history
* https://github.com/marketplace/actions/pypi-publish#trusted-publishing
* Upgrade actions to their latest versions and switch to Python 3.9.
* Rename 'master' branch as 'main'.
* Update data size returned by test data.
* Bump version to 0.2.3.
  • Loading branch information
GraemeWatt committed Nov 14, 2023
1 parent 38a0274 commit 3aef456
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 23 deletions.
32 changes: 17 additions & 15 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Continuous Integration
on:
push:
pull_request:
branches: [ master ]
branches: [ main ]
release:
types: [published]

Expand All @@ -14,16 +14,16 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.6
python-version: '3.9'
- name: Install pip dependencies
run: |
pip install --upgrade pip setuptools
pip install --ignore-installed coveralls
pip install -I -e .[tests]
pip install coveralls
pip install -e '.[tests]'
- name: Start docker container
run: |
docker run -d -p 0.0.0.0:8945:5000 --name hepdata-converter-ws-tests hepdata/hepdata-converter-ws
Expand All @@ -42,18 +42,20 @@ jobs:
needs: test
if: github.event_name == 'release'
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/hepdata-converter-ws-client
permissions:
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.6
uses: actions/setup-python@v2
- uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: '3.6'
python-version: '3.9'
- name: Build PyPI package
run: |
pip install wheel
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
user: __token__
password: ${{ secrets.PYPI_PASSWORD }}
uses: pypa/gh-action-pypi-publish@release/v1
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[![GitHub Actions Status](https://github.com/HEPData/hepdata-converter-ws-client/workflows/Continuous%20Integration/badge.svg?branch=master)](https://github.com/HEPData/hepdata-converter-ws-client/actions?query=branch%3Amaster)
[![Coveralls Status](https://coveralls.io/repos/github/HEPData/hepdata-converter-ws-client/badge.svg?branch=master)](https://coveralls.io/github/HEPData/hepdata-converter-ws-client?branch=master)
[![License](https://img.shields.io/github/license/HEPData/hepdata-converter-ws-client.svg)](https://github.com/HEPData/hepdata-converter-ws-client/blob/master/LICENSE.txt)
[![GitHub Actions Status](https://github.com/HEPData/hepdata-converter-ws-client/actions/workflows/ci.yml/badge.svg?branch=main)](https://github.com/HEPData/hepdata-converter-ws-client/actions?query=branch%3Amain)
[![Coveralls Status](https://coveralls.io/repos/github/HEPData/hepdata-converter-ws-client/badge.svg?branch=main)](https://coveralls.io/github/HEPData/hepdata-converter-ws-client?branch=main)
[![License](https://img.shields.io/github/license/HEPData/hepdata-converter-ws-client.svg)](https://github.com/HEPData/hepdata-converter-ws-client/blob/main/LICENSE.txt)
[![GitHub Releases](https://img.shields.io/github/release/hepdata/hepdata-converter-ws-client.svg?maxAge=2592000)](https://github.com/HEPData/hepdata-converter-ws-client/releases)
[![PyPI Version](https://img.shields.io/pypi/v/hepdata-converter-ws-client)](https://pypi.org/project/hepdata-converter-ws-client/)
[![GitHub Issues](https://img.shields.io/github/issues/hepdata/hepdata-converter-ws-client.svg?maxAge=2592000)](https://github.com/HEPData/hepdata-converter-ws-client/issues)
Expand Down Expand Up @@ -53,8 +53,8 @@ web server is not exceeded.

### Function description

[`hepdata_converter_ws_client.convert`](https://github.com/HEPData/hepdata-converter-ws-client/blob/master/hepdata_converter_ws_client/__init__.py#L23) function has proper [docstring](https://github.com/HEPData/hepdata-converter-ws-client/blob/master/hepdata_converter_ws_client/__init__.py#L24-L68) describing its arguments and return values.
Similarly for [`hepdata_converter_ws_client.get_data_size`](https://github.com/HEPData/hepdata-converter-ws-client/blob/master/hepdata_converter_ws_client/__init__.py#L129) with corresponding [docstring](https://github.com/HEPData/hepdata-converter-ws-client/blob/master/hepdata_converter_ws_client/__init__.py#L130-L144).
[`hepdata_converter_ws_client.convert`](https://github.com/HEPData/hepdata-converter-ws-client/blob/main/hepdata_converter_ws_client/__init__.py#L23) function has proper [docstring](https://github.com/HEPData/hepdata-converter-ws-client/blob/master/hepdata_converter_ws_client/__init__.py#L24-L68) describing its arguments and return values.
Similarly for [`hepdata_converter_ws_client.get_data_size`](https://github.com/HEPData/hepdata-converter-ws-client/blob/main/hepdata_converter_ws_client/__init__.py#L129) with corresponding [docstring](https://github.com/HEPData/hepdata-converter-ws-client/blob/master/hepdata_converter_ws_client/__init__.py#L130-L144).

### Convert using file paths

Expand Down
4 changes: 2 additions & 2 deletions hepdata_converter_ws_client/testsuite/test_getdatasize.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ def test_get_data_size_old(self, oldhepdata_path):
size = hepdata_converter_ws_client.get_data_size(
oldhepdata_path, options={'input_format': 'oldhepdata'}
)
self.assertAlmostEqual(size, 7428, delta=100)
self.assertAlmostEqual(size, 7496, delta=100)

@insert_data_as_extracted_dir('testsubmission/TestHEPSubmission.zip')
def test_get_data_size_with_resources(self, testsubmission_file):
size = hepdata_converter_ws_client.get_data_size(
testsubmission_file, options={'input_format': 'yaml'})
self.assertAlmostEqual(size, 4522, delta=100)
self.assertAlmostEqual(size, 4794, delta=100)
2 changes: 1 addition & 1 deletion hepdata_converter_ws_client/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

# this file ideally should only contain __version__ declaration, as anything else
# may break setup.py and PyPI uploads
__version__ = '0.2.2'
__version__ = '0.2.3'

0 comments on commit 3aef456

Please sign in to comment.