Skip to content

Commit

Permalink
Correct syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
jochym committed Dec 7, 2024
1 parent a608c05 commit 385d1ff
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 154 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
name: Build and test
on:
workflow_call:
on: workflow_call

jobs:
build:
Expand Down
61 changes: 9 additions & 52 deletions .github/workflows/pypi.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,22 @@
name: Build, test and publish to (test)PyPI
on:
push:
tags:
- 'v*' # matches semantic versioning (e.g., v1.2.3)
branches:
- master
- 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 tagged push
if: ${{ startsWith(github.ref, 'refs/tags/') }}
needs:
- build
publish-to-pypi:
name: Publish to PyPI
# if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
uses: ./.github/workflows/build.yml
runs-on: ubuntu-latest

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

permissions:
id-token: write # IMPORTANT: mandatory for trusted publishing
Expand All @@ -69,7 +28,5 @@ jobs:
name: python-package-distributions
path: dist/

- name: Publish distribution to TestPyPI
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
102 changes: 2 additions & 100 deletions .github/workflows/testpypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
# 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' }}
# if: ${{ github.ref == 'refs/heads/dev' }}
uses: ./.github/workflows/build.yml
runs-on: ubuntu-latest

Expand All @@ -37,102 +37,4 @@ jobs:
repository-url: https://test.pypi.org/legacy/


publish-to-pypi:
name: Publish 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/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 to PyPI
uses: pypa/gh-action-pypi-publish@release/v1


name: Build, test and publish to (test)PyPI
on:
push:
branches:
- dev

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 tagged 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/

0 comments on commit 385d1ff

Please sign in to comment.