-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #216 from wouterpeere/issue212-auto-release-pypi-v…
…ersion Issue212 auto release pypi version
- Loading branch information
Showing
14 changed files
with
299 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
name: CD to pypi | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
if: "contains(github.event.head_commit.message, 'auto-update version')" | ||
name: Build distribution 📦 | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
- 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: Store the distribution packages | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
|
||
publish-to-testpypi: | ||
needs: build | ||
if: "contains(github.event.head_commit.message, 'rc') || contains(github.event.head_commit.message, 'dev')" | ||
name: Publish 📦 to TestPyPI | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: testpypi | ||
url: https://test.pypi.org/p/ghetool | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish 📦 to TestPyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://test.pypi.org/legacy/ | ||
user: __token__ | ||
password: ${{ secrets.TESTPYPI }} | ||
|
||
publish-to-pypi: | ||
needs: build | ||
if: "!contains(github.event.head_commit.message, 'rc') && !contains(github.event.head_commit.message, 'dev')" | ||
name: Publish 📦 to PyPI | ||
runs-on: ubuntu-latest | ||
|
||
environment: | ||
name: pypi | ||
url: https://pypi.org/p/ghetool | ||
|
||
steps: | ||
- name: Download all the dists | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: python-package-distributions | ||
path: dist/ | ||
- name: Publish 📦 to PyPI | ||
uses: pypa/gh-action-pypi-publish@release/v1 | ||
with: | ||
repository-url: https://pypi.org/legacy/ | ||
user: __token__ | ||
password: ${{ secrets.PYPI }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
name: Docs | ||
name: Create docs | ||
on: [push, release] | ||
|
||
jobs: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
name: A new release | ||
|
||
on: | ||
release: | ||
types: [ published ] | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
unit-tests: | ||
name: release tests | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.12' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install pytest-cov | ||
pip install -e . | ||
- name: Test with pytest | ||
run: pytest GHEtool/test/unit-tests --cov=./ --cov-report=xml | ||
|
||
create-tag: | ||
name: Set tag | ||
needs: unit-tests | ||
runs-on: ubuntu-latest | ||
env: | ||
RELEASE_VERSION: "" | ||
STRIPPED_VERSION: "" | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
with: | ||
token: ${{ secrets.TOKEN }} | ||
persist-credentials: false | ||
|
||
- name: Set output | ||
id: vars | ||
run: echo "RELEASE_VERSION=${{ github.event.release.name }}" >> $GITHUB_ENV | ||
|
||
- name: Check output | ||
id: split | ||
run: echo "STRIPPED_VERSION=${RELEASE_VERSION#v}" >> $GITHUB_ENV | ||
|
||
- name: Set up Git | ||
run: git config --global user.email "${{ secrets.EMAIL }}" && git config --global user.name "GitHub Actions" | ||
|
||
- name: Update version in version file and commit | ||
run: | | ||
echo "${STRIPPED_VERSION}" > VERSION.txt | ||
cat VERSION.txt | ||
git add VERSION.txt | ||
git commit -am "Release: auto-update version to ${RELEASE_VERSION}" | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
name: Tests PR | ||
|
||
on: | ||
- pull_request | ||
|
||
jobs: | ||
|
||
test_methods: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.12' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements_dev.txt | ||
pip install -e . | ||
- name: Test with pytest | ||
run: pytest GHEtool/test/methods/test_methods.py --cov=./ --cov-report=xml | ||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
|
||
test_general: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.12' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements_dev.txt | ||
pip install -e . | ||
- name: Test with pytest | ||
run: pytest GHEtool/test/general_tests --cov=./ --cov-report=xml | ||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
|
||
test_examples: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.12' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements_dev.txt | ||
pip install -e . | ||
- name: Test with pytest | ||
run: pytest GHEtool/test/test_examples.py --cov=./ --cov-report=xml | ||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
|
||
test_validation: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python 3.12 | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: '3.12' | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r requirements_dev.txt | ||
pip install -e . | ||
- name: Test with pytest | ||
run: pytest GHEtool/test/test_validation.py --cov=./ --cov-report=xml | ||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos | ||
|
||
unit-tests: | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Python ${{ matrix.python-version }} | ||
uses: actions/setup-python@v3 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install pytest | ||
pip install pytest-cov | ||
pip install -e . | ||
- name: Test with pytest | ||
run: pytest GHEtool/test/unit-tests --cov=./ --cov-report=xml | ||
- name: Upload Coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
files: ./coverage.xml | ||
token: ${{ secrets.CODECOV_TOKEN }} # not required for public repos |
Oops, something went wrong.