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
44 changes: 44 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Build and test
on: workflow_call

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

steps:
- uses: actions/checkout@main
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@main
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: Test
run: |
python3 -m pip install hypothesis
python3 -m pip install dist/elastic*.whl
elastic --version
python3 -m unittest discover -s test -b
elastic -v --cij proc tests/data/calc-cij_*/vasprun.xml
elastic -v --eos proc tests/data/calc-eos_*/vasprun.xml

- name: Store the distribution packages
uses: actions/upload-artifact@main
with:
name: python-package-distributions
path: dist/


76 changes: 3 additions & 73 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,19 @@
name: Build, test and publish to (test)PyPI
on:
push:
tags:
- 'v*' # matches semantic versioning (e.g., v1.2.3)
branches:
- main
- master
- dev
- main

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

steps:
- uses: actions/checkout@main
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@main
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: Test
run: |
python3 -m pip install hypothesis
python3 -m pip install dist/elastic*.whl
elastic --version
python3 -m unittest discover -s test -b
elastic -v --cij proc tests/data/calc-cij_*/vasprun.xml
elastic -v --eos proc tests/data/calc-eos_*/vasprun.xml

- name: Store the distribution packages
uses: actions/upload-artifact@main
with:
name: python-package-distributions
path: dist/

publish-to-testpypi:
name: Publish to TestPyPI
# Only on dev pushes
# if: ${{ github.event_name == 'push' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master' ) }}
# Run on untagged push
# if: ${{ !startsWith(github.ref, 'refs/tags/') }}
if: ${{ github.ref == 'refs/heads/dev' }}
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/elastic

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@main
with:
name: python-package-distributions
path: dist/

- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/

uses: ./.github/workflows/build.yml

publish-to-pypi:
name: Publish to PyPI
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- build
- build
runs-on: ubuntu-latest

environment:
Expand Down
42 changes: 42 additions & 0 deletions .github/workflows/testpypi.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: Build, test and publish to testPyPI
on:
push:
branches:
- dev
- hotfix

jobs:
build:
uses: ./.github/workflows/build.yml

publish-to-testpypi:
name: Publish to TestPyPI
# Only on dev pushes
# if: ${{ github.event_name == 'push' && ( github.ref == 'refs/heads/dev' || github.ref == 'refs/heads/master' ) }}
# Run on untagged push
if: startsWith(github.ref, 'refs/tags/')
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/elastic

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing

steps:
- name: Download all the dists
uses: actions/download-artifact@main
with:
name: python-package-distributions
path: dist/

- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/



2 changes: 0 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,5 @@ def current_version(version: ScmVersion) -> str:
return version.format_next_version(guess_next_version,
"{tag}"+ delim +"{distance}")


setup(use_scm_version={"version_scheme": current_version,
"local_scheme": get_no_local_node})

Loading