Skip to content

Commit

Permalink
Merge pull request #77 from TomographicImaging/update-framework
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl authored Jul 19, 2023
2 parents bc3c745 + f3ca0dd commit ade2a2d
Show file tree
Hide file tree
Showing 26 changed files with 543 additions and 1,651 deletions.
43 changes: 34 additions & 9 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,42 @@
# GitHub Actions

## Building the Conda Package: [conda_build_and_publish.yml](https://github.com/paskino/qt-elements/blob/main/.github/workflows/conda_build_and_publish.yml)
This github action builds and tests the conda package, by using the [conda-package-publish-action](https://github.com/paskino/conda-package-publish-action)
Runs automatically on every commit via [test.yml](./test.yml).

When pushing to main *all* variants are built and tested.
## Testing

When making an [annotated](https://git-scm.com/book/en/v2/Git-Basics-Tagging) tag, *all* variants are built, tested and published to the [paskino conda channel for qt-elements](https://anaconda.org/paskino/eqt/files). This package is noarch.
Runs `pytest`.

When opening or modifying a pull request to main, a single variant is built and tested, but not published. This variant is `python=3.7` and `numpy=1.18`.
## Building

## Building the PyPi Package: [pypi_publish.yml](https://github.com/paskino/qt-elements/blob/main/.github/workflows/pypi_publish.yml)
This github action builds the pypi package, by using the [deploy-pypi action](https://github.com/casperdcl/deploy-pypi).
Runs automatically after tests (above) succeed.

When pushing to main it is built and checked.
Builds binary (`*.whl`) & source (`*.tar.gz`) distributions.

When making an [annotated](https://git-scm.com/book/en/v2/Git-Basics-Tagging) tag, it is built and published to the [PyPi](https://pypi.org/project/eqt/#description).
## Releasing

Runs automatically -- when an annotated tag is pushed -- after builds (above) succeed.

Publishes to [PyPI](https://pypi.org/project/eqt).

:warning: The annotated tag's `title` must be `Version <number without v-prefix>` (separated by a blank line) and the `body` must contain release notes, e.g.:

```bash
git tag v1.33.7 -a
```

```md
Version 1.33.7

<body>
```

The `<body>` will be used in the changelog (below).

### Changelog

See <https://github.com/TomographicImaging/eqt/releases>, or offline:

```bash
git config --global alias.changelog 'for-each-ref --sort=-*authordate --format="# %(contents:subject)%0a%(contents:body)" refs/tags'
git changelog
```
27 changes: 0 additions & 27 deletions .github/workflows/conda_build_and_publish.yml

This file was deleted.

35 changes: 0 additions & 35 deletions .github/workflows/pypi_publish.yml

This file was deleted.

72 changes: 72 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test
on:
push:
pull_request:
jobs:
test:
if: github.event_name != 'pull_request' || !contains('OWNER,MEMBER,COLLABORATOR', github.event.pull_request.author_association)
name: py${{ matrix.python }}
runs-on: ubuntu-latest
strategy:
matrix:
python: [3.7, 3.11]
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- run: pip install -U .[dev]
- run: pytest
deploy:
needs: [test]
name: PyPI Deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- uses: actions/setup-python@v4
with:
python-version: '3.x'
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
id: changes
name: Check annotated tag
run: |
title=$(git for-each-ref --format="%(contents:subject)" ${GITHUB_REF})
body=$(git for-each-ref --format="%(contents:body)" ${GITHUB_REF})
tag="${GITHUB_REF#refs/tags/}"
if test "$title" = "Version ${tag#v}" -a -n "$body"; then
echo "title=$title" >> "$GITHUB_OUTPUT"
echo "body=$body" >> "$GITHUB_OUTPUT"
else
echo "::error title=Missing tag annotation::$tag"
changelog=$(git log --pretty='format:%d%n- %s%n%b---' $(git tag --sort=v:refname | tail -n2 | head -n1)..HEAD)
cat <<EOF >> "$GITHUB_STEP_SUMMARY"
# Missing tag annotation
## Fix
See <https://github.com/TomographicImaging/eqt/tree/main/.github/workflows#releasing>.
## Suggested body
$changelog
EOF
exit 1
fi
- id: dist
uses: casperdcl/deploy-pypi@v2
with:
build: true
password: ${{ secrets.EQT_SECRET_TOKEN }}
upload: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags') }}
skip_existing: true # allow for annotated tag amendments
- if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
name: Release
run: >
gh release create
--title "${{ steps.changes.outputs.title }}"
--notes "${{ steps.changes.outputs.body }}"
"${GITHUB_REF#refs/tags/}"
dist/${{ steps.dist.outputs.whl }}
dist/${{ steps.dist.outputs.targz }}
env:
GH_TOKEN: ${{ secrets.GH_TOKEN || github.token }}
10 changes: 9 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
eqt/version.py
*.py[cod]
__pycache__/
/eqt/_dist_ver.py
/*.egg*/
/build/
/dist/
/.coverage*
/coverage.xml
/.pytest_cache/
66 changes: 0 additions & 66 deletions CHANGELOG.md

This file was deleted.

Loading

0 comments on commit ade2a2d

Please sign in to comment.