Skip to content

Merge pull request #77 from UBC-MDS/dev #24

Merge pull request #77 from UBC-MDS/dev

Merge pull request #77 from UBC-MDS/dev #24

Workflow file for this run

# Workflow for publishing into pyPI
name: ci-cd
on:
push:
branches: [ main ]
tags:
- "*.*.*"
pull_request:
branches: [ main ]
workflow_dispatch:
jobs:
ci:
# Set up operating system
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
# Steps represent a sequence of tasks that will be executed as
# part of the job
steps:
# Checks-out your repository so your job can access it
- name: Check-out repository
uses: actions/checkout@v2
# Set up Python
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[tests]
# Run pytest with coverage
- name: Run tests with coverage
run: |
pytest --cov=dumbpy --cov-branch --cov-report=xml
# Badge
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
release:
runs-on: ubuntu-latest
needs: ci
permissions:
contents: write
if: github.event_name == 'push' && (github.ref == 'refs/heads/main')
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v5
with:
python-version: "3.13"
- name: Install semantic-release
run: |
python -m pip install --upgrade pip
pip install python-semantic-release
- name: Configure git identity
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
- name: Semantic version bump + tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run:
semantic-release version --no-changelog --skip-build --no-vcs-release
cd:
# Set up operating system
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
# Only run this job if the "ci" job passes
needs: release
# Only run this job if new work is pushed to "main" or "dev"
if: github.event_name == 'push' && (github.ref == 'refs/heads/main')
# Define job steps
steps:
- name: Check-out repository
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: 3.12
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
- name: Hatch build locally
run: hatch build
- name: Publish to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
repository-url: https://test.pypi.org/legacy/
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
testdumbpy:
# Set up operating system
runs-on: ubuntu-latest
needs: cd
strategy:
matrix:
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Test install from TestPyPI
run: |
python -m pip install --upgrade pip
pip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
dumbpy