Skip to content

Commit 893cb91

Browse files
committed
CI for lint and release
1 parent 3088178 commit 893cb91

File tree

2 files changed

+75
-0
lines changed

2 files changed

+75
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Upload Python Package
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
deploy:
9+
10+
runs-on: ubuntu-latest
11+
12+
permissions:
13+
# IMPORTANT: this permission is mandatory for trusted publishing
14+
id-token: write
15+
16+
steps:
17+
- uses: actions/checkout@v4
18+
- name: Set up Python
19+
uses: actions/setup-python@v5
20+
with:
21+
python-version: '3.x'
22+
- name: Install dependencies
23+
run: |
24+
python -m pip install --upgrade pip
25+
python -m pip install build
26+
- name: Build package
27+
run: python -m build
28+
- name: Publish package distributions to PyPI
29+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/main.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- name: Set up Python 3.13
11+
uses: actions/setup-python@v5
12+
with:
13+
python-version: 3.13
14+
- name: Setup and install tools
15+
run: |
16+
python -m pip install --upgrade ruff
17+
- name: format check
18+
run: python -m ruff format --check
19+
- name: lint check
20+
run: python -m ruff check
21+
test:
22+
strategy:
23+
fail-fast: false
24+
matrix:
25+
python-version: [3.8, 3.13]
26+
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- name: Set up Python
31+
uses: actions/setup-python@v5
32+
with:
33+
python-version: ${{ matrix.python-version }}
34+
- name: Setup build and test environment
35+
run: python -m pip install --upgrade pip build pytest pytest-mock
36+
- name: Build package
37+
run: python -m build
38+
- name: Install package
39+
run: python -m pip install --pre dist/pandoc_d2_filter-*.whl
40+
- name: run unit tests
41+
run: python -m pytest tests/test_unit.py
42+
- name: install dependencies for integration tests
43+
run: sudo apt update && sudo apt install -y pandoc && curl -fsSL https://d2lang.com/install.sh | sh -s --
44+
- name: run integration tests
45+
run: python -m pytest tests/test_integration.py
46+

0 commit comments

Comments
 (0)