Generate TyepScript interface completely from Python (#112) #266
This file contains 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 | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '**' | |
pull_request: | |
types: [opened, synchronize] | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: pip install -r src/python-fastui/requirements/all.txt | |
- run: pip install src/python-fastui | |
- run: npm install | |
- uses: pre-commit/[email protected] | |
with: | |
extra_args: --all-files | |
env: | |
SKIP: no-commit-to-branch | |
test: | |
name: test ${{ matrix.python-version }} on ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu, macos] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
runs-on: ${{ matrix.os }}-latest | |
env: | |
PYTHON: ${{ matrix.python-version }} | |
OS: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: set up python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- run: pip install -r src/python-fastui/requirements/test.txt | |
- run: pip install -r src/python-fastui/requirements/pyproject.txt | |
- run: pip install src/python-fastui | |
- run: coverage run -m pytest src | |
# test demo on 3.11 and 3.12, these tests are intentionally omitted from coverage | |
- if: matrix.python-version == '3.11' || matrix.python-version == '3.12' | |
run: pytest demo/tests.py | |
- run: coverage xml | |
- uses: codecov/codecov-action@v3 | |
with: | |
file: ./coverage.xml | |
env_vars: PYTHON,OS | |
npm-build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: npm install | |
- run: npm run build | |
- run: tree src | |
check: # This job does nothing and is only used for the branch protection | |
if: always() | |
needs: [lint, test, npm-build] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Decide whether the needed jobs succeeded or failed | |
uses: re-actors/alls-green@release/v1 | |
id: all-green | |
with: | |
jobs: ${{ toJSON(needs) }} | |
release: | |
needs: [check] | |
if: "success() && startsWith(github.ref, 'refs/tags/')" | |
runs-on: ubuntu-latest | |
environment: release | |
permissions: | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: '3.11' | |
- run: pip install -U build | |
- id: check-version | |
uses: samuelcolvin/[email protected] | |
with: | |
version_file_path: 'src/python-fastui/fastui/__init__.py' | |
- run: python -m build --outdir dist src/python-fastui | |
- run: ls -lh dist | |
- uses: pypa/gh-action-pypi-publish@release/v1 |