Skip to content

Commit

Permalink
Add CI for doing a release (#113)
Browse files Browse the repository at this point in the history
  • Loading branch information
PicoCentauri authored Dec 5, 2024
1 parent fac5b1e commit 3c57b60
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 49 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/build-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build and Release

on:
push:
branches: [main]
pull_request:
# Check all PR

jobs:
build:
name: Build distribution
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/torch-pme
permissions:
id-token: write

steps:
- uses: actions/checkout@v4
- name: setup Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: python -m pip install tox
- name: Build package
run: tox -e build
- name: Publish distribution to PyPI
if: startsWith(github.ref, 'refs/tags/v')
uses: pypa/gh-action-pypi-publish@release/v1
- name: Publish to GitHub release
if: startsWith(github.ref, 'refs/tags/v')
uses: softprops/action-gh-release@v2
with:
files: |
dist/*.tar.gz
dist/*.whl
prerelease: ${{ contains(github.ref, '-rc') }}
26 changes: 0 additions & 26 deletions .github/workflows/build.yml

This file was deleted.

22 changes: 7 additions & 15 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,11 @@ jobs:
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: install dependencies
run: |
python -m pip install tox
- name: build documentation
run: tox -e docs
env:
# Use the CPU only version of torch when building/running the code
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu

- name: put documentation in the website
run: |
git clone https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY --branch gh-pages gh-pages
Expand All @@ -41,12 +35,10 @@ jobs:
rm -rf latest
mv ../docs/build/html latest
fi
# TODO: enable once repo is public
# - name: deploy to gh-pages
# if: github.event_name == 'push'
# uses: peaceiris/actions-gh-pages@v4
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# publish_dir: ./gh-pages/
# force_orphan: true
- name: deploy to gh-pages
if: github.event_name == 'push'
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./gh-pages/
force_orphan: true
2 changes: 0 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,10 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
- run: pip install tox

- name: Lint the code
run: tox -e lint
6 changes: 0 additions & 6 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,16 @@ jobs:

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- run: pip install tox coverage[toml]

- name: run Python tests
run: |
tox -e tests-min
tox -e tests
coverage xml
env:
# Use the CPU only version of torch when building/running the code
PIP_EXTRA_INDEX_URL: https://download.pytorch.org/whl/cpu

- name: upload to codecov.io
uses: codecov/codecov-action@v4
with:
Expand Down

0 comments on commit 3c57b60

Please sign in to comment.