Skip to content

Commit

Permalink
Adapt pipeline to GitHub
Browse files Browse the repository at this point in the history
  • Loading branch information
Y0dler authored Dec 4, 2023
1 parent ae14e57 commit c5ee330
Show file tree
Hide file tree
Showing 4 changed files with 98 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
# Keep Python dependencies updated
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
14 changes: 14 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: pre-commit

on:
pull_request:
push:
branches: [main]

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: pre-commit/[email protected]
36 changes: 36 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: release-pipeline

on:
release:
types:
- created


jobs:
release-job:
runs-on: ubuntu-latest
env:
PYPI_TOKEN: ${{ secrets.PYPI_TOKEN }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- name: Build package
run: |
pip install twine wheel
python setup.py bdist_wheel
- name: Check version number match
run: |
echo "GITHUB_REF: ${GITHUB_REF}"
# Make sure the package version is the same as the tag
grep -Rq "^Version: ${GITHUB_REF:11}$" peak_performance.egg-info/PKG-INFO
- name: Publish to PyPI
run: |
twine check dist/*
twine upload --repository pypi --username __token__ --password ${PYPI_TOKEN} dist/*
- name: Test installation
run: |
sleep 120
pip install peak_performance==${GITHUB_REF:11}
36 changes: 36 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: pipeline

on:
pull_request:
push:
branches: [main]

jobs:
test-job:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
pip install -e .[test]
- name: Run tests
run: |
pytest -v --cov-report xml --cov=peak_performance --cov-report term-missing peak_performance
- name: Upload coverage
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
- name: Test Wheel build, install and import
run: |
python setup.py bdist_wheel
twine check dist/*
cd dist
pip install peak_performance*.whl
python -c "import peak_performance; print(peak_performance.__version__)"

0 comments on commit c5ee330

Please sign in to comment.