Skip to content

Commit

Permalink
Init: Adding workflows for testing/publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
dotpyu committed Nov 7, 2024
1 parent ff33a88 commit 6b645b4
Show file tree
Hide file tree
Showing 2 changed files with 82 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Upload Python Package to PyPI

on:
release:
types: [created]

jobs:
pypi-publish:
name: Publish release to PyPI
runs-on: ubuntu-latest

environment:
name: pypi
url: https://pypi.org/p/codemd

permissions:
id-token: write
contents: read

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.x"
cache: 'pip'

- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: python -m build

- name: Test built package
run: |
twine check dist/*
pip install dist/*.whl
codemd --help
- name: Verify environment
run: |
echo "Running in environment: $GITHUB_ENVIRONMENT"
echo "Repository: $GITHUB_REPOSITORY"
echo "Workflow: $GITHUB_WORKFLOW"
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
30 changes: 30 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Tests

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install pytest-cov
pip install -e .
- name: Run tests
run: |
pytest tests/

0 comments on commit 6b645b4

Please sign in to comment.