|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + tags: |
| 8 | + - '**' |
| 9 | + pull_request: {} |
| 10 | + |
| 11 | +jobs: |
| 12 | + lint: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v2 |
| 17 | + |
| 18 | + - name: set up python |
| 19 | + uses: actions/setup-python@v4 |
| 20 | + with: |
| 21 | + python-version: '3.10' |
| 22 | + |
| 23 | + - run: pip install -r requirements/linting.txt -r requirements/pyproject.txt |
| 24 | + |
| 25 | + - uses: pre-commit/[email protected] |
| 26 | + with: |
| 27 | + extra_args: --all-files |
| 28 | + |
| 29 | + test: |
| 30 | + name: test py${{ matrix.python }} on ${{ matrix.os }} |
| 31 | + strategy: |
| 32 | + fail-fast: false |
| 33 | + matrix: |
| 34 | + os: [ubuntu, macos, windows] |
| 35 | + python: ['3.7', '3.8', '3.9', '3.10', '3.11-dev'] |
| 36 | + |
| 37 | + env: |
| 38 | + PYTHON: ${{ matrix.python }} |
| 39 | + OS: ${{ matrix.os }} |
| 40 | + |
| 41 | + runs-on: ${{ matrix.os }}-latest |
| 42 | + |
| 43 | + steps: |
| 44 | + - uses: actions/checkout@v2 |
| 45 | + |
| 46 | + - name: set up python |
| 47 | + uses: actions/setup-python@v4 |
| 48 | + with: |
| 49 | + python-version: ${{ matrix.python }} |
| 50 | + |
| 51 | + - run: pip install -r requirements/testing.txt -r requirements/pyproject.txt |
| 52 | + |
| 53 | + - run: make test |
| 54 | + |
| 55 | + - run: coverage xml |
| 56 | + |
| 57 | + - uses: codecov/codecov-action@v2 |
| 58 | + with: |
| 59 | + file: ./coverage.xml |
| 60 | + env_vars: PYTHON,OS |
| 61 | + |
| 62 | + deploy: |
| 63 | + name: Deploy |
| 64 | + needs: [lint, test] |
| 65 | + if: "success() && startsWith(github.ref, 'refs/tags/')" |
| 66 | + runs-on: ubuntu-latest |
| 67 | + |
| 68 | + steps: |
| 69 | + - uses: actions/checkout@v2 |
| 70 | + |
| 71 | + - name: set up python |
| 72 | + uses: actions/setup-python@v4 |
| 73 | + with: |
| 74 | + python-version: '3.10' |
| 75 | + |
| 76 | + - name: install |
| 77 | + run: pip install -U twine build packaging |
| 78 | + |
| 79 | + - name: check version |
| 80 | + id: check-version |
| 81 | + run: python <(curl -Ls https://gist.githubusercontent.com/samuelcolvin/4e1ad439c5489e8d6478cdee3eb952ef/raw/check_version.py) |
| 82 | + env: |
| 83 | + VERSION_PATH: 'pydantic_settings/version.py' |
| 84 | + |
| 85 | + - name: build |
| 86 | + run: python -m build |
| 87 | + |
| 88 | + - run: twine check dist/* |
| 89 | + |
| 90 | + - name: upload to pypi |
| 91 | + run: twine upload dist/* |
| 92 | + env: |
| 93 | + TWINE_USERNAME: __token__ |
| 94 | + TWINE_PASSWORD: ${{ secrets.pypi_token }} |
0 commit comments