Skip to content

Commit

Permalink
chore(ci): Initialize GitHub workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
achimnol committed Feb 17, 2024
1 parent 14a46bf commit 15cd0a0
Show file tree
Hide file tree
Showing 4 changed files with 103 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: CI

on: [push, pull_request]

jobs:

test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version:
- "3.11"
- "3.12"
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"
cache-dependency-path: |
setup.cfg
- name: Install dependencies
run: |
python -m pip install -U pip setuptools
python -m pip install -U -e '.[test]'
- name: Test with pytest
timeout-minutes: 30
run: |
python -m pytest -v --cov=src tests
- name: Send code coverage report
uses: codecov/codecov-action@v3
with:
env_vars: GHA_OS,GHA_PYTHON

required-checks:
if: always()
needs: [test]
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}

deploy-to-pypi:
needs: [test]
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
environment: deploy-to-pypi-qedis
permissions:
id-token: write
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
setup.cfg
- name: Install dependencies
run: |
python -m pip install -U pip setuptools
pip install -U -e '.[build]'
- name: Build sdist and wheel
run: |
python -m build -s -w
- name: Publish
uses: pypa/gh-action-pypi-publish@release/v1
28 changes: 28 additions & 0 deletions .github/workflows/timeline-check.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: timeline-check

on: [pull_request]

jobs:
towncrier:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: "pip"
cache-dependency-path: |
requirements/timeline-check.txt
- name: Install dependencies
run: |
python -m pip install -U pip setuptools wheel
pip install -U -r requirements/timeline-check.txt
- name: Check existence of news fragment
run: |
git fetch --no-tags origin +refs/heads/${BASE_BRANCH}:refs/remotes/origin/${BASE_BRANCH}
python -m towncrier.check --compare-with=origin/${BASE_BRANCH}
env:
BASE_BRANCH: ${{ github.base_ref }}
1 change: 1 addition & 0 deletions requirements/timeline-check.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
towncrier~=22.12
1 change: 1 addition & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# TODO: write tests

0 comments on commit 15cd0a0

Please sign in to comment.