Merge pull request #49 from phillipdupuis/v2-changes #99
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
pull_request: | |
jobs: | |
lint: | |
name: Lint code with ruff | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: astral-sh/ruff-action@v1 | |
with: | |
src: ./pydantic2ts | |
test: | |
name: Run unit tests | |
needs: lint | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, windows-latest, macOS-latest] | |
python-version: ["3.9"] | |
include: | |
- os: ubuntu-latest | |
python-version: "3.8" | |
- os: ubuntu-latest | |
python-version: "3.10" | |
- os: ubuntu-latest | |
python-version: "3.11" | |
- os: ubuntu-latest | |
python-version: "3.12" | |
- os: ubuntu-latest | |
python-version: "3.13" | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Install node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: Install json-schema-to-typescript | |
run: npm i -g json-schema-to-typescript | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "0.5.2" | |
- name: Run tests against 'pydantic@latest' | |
run: | | |
uv python install ${{ matrix.python-version }} | |
uv sync --all-extras --dev | |
uv run pytest --cov=pydantic2ts | |
- name: (ubuntu 3.9) Run tests against 'pydantic==1.8.2' and generate an LCOV file for Coveralls | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }} | |
run: | | |
uv add 'pydantic==1.8.2' | |
uv run pytest --cov=pydantic2ts --cov-append | |
uv run coverage lcov | |
- name: (ubuntu 3.9) Upload to Coveralls | |
if: ${{ matrix.os == 'ubuntu-latest' && matrix.python-version == '3.9' }} | |
uses: coverallsapp/github-action@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
path-to-lcov: coverage.lcov | |
build: | |
name: Build pydantic2ts for distribution | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v4 | |
- name: Install uv | |
uses: astral-sh/setup-uv@v3 | |
with: | |
version: "0.5.2" | |
- name: Install python 3.9 | |
run: uv python install 3.9 | |
- name: Build pydantic2ts | |
run: uv build | |
- name: Store the distribution | |
uses: actions/upload-artifact@v4 | |
with: | |
name: pydantic2ts-dist | |
path: dist/ | |
publish-to-pypi: | |
name: Publish pydantic2ts to PyPI | |
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') | |
needs: build | |
runs-on: ubuntu-latest | |
environment: | |
name: pypi | |
url: https://pypi.org/p/pydantic-to-typescript | |
permissions: | |
id-token: write | |
steps: | |
- name: Download all the dists | |
uses: actions/download-artifact@v4 | |
with: | |
name: pydantic2ts-dist | |
path: dist/ | |
- name: Publish distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |