|
| 1 | +name: tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + branches: ["*"] |
| 8 | + workflow_dispatch: # allows you to trigger manually |
| 9 | + |
| 10 | +# When this workflow is queued, automatically cancel any previous running |
| 11 | +# or pending jobs from the same branch |
| 12 | +concurrency: |
| 13 | + group: tests-${{ github.ref }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + validate: |
| 18 | + name: Validate |
| 19 | + runs-on: ubuntu-latest |
| 20 | + steps: |
| 21 | + - name: Check out repo |
| 22 | + uses: actions/checkout@v6 |
| 23 | + |
| 24 | + - name: Configure Python version |
| 25 | + uses: actions/setup-python@v6 |
| 26 | + with: |
| 27 | + python-version: "3.13" |
| 28 | + |
| 29 | + - name: black |
| 30 | + run: | |
| 31 | + python -m pip install black -c requirements.txt |
| 32 | + python -m black fastapi_explosion_extras --check |
| 33 | + - name: isort |
| 34 | + run: | |
| 35 | + python -m pip install isort -c requirements.txt |
| 36 | + python -m isort fastapi_explosion_extras --check |
| 37 | + - name: flake8 |
| 38 | + run: | |
| 39 | + python -m pip install flake8 -c requirements.txt |
| 40 | + python -m flake8 fastapi_explosion_extras --show-source --statistics |
| 41 | + tests: |
| 42 | + name: Test |
| 43 | + strategy: |
| 44 | + fail-fast: false |
| 45 | + matrix: |
| 46 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 47 | + python_version: ["3.9", "3.10", "3.11", "3.12", "3.13"] |
| 48 | + |
| 49 | + runs-on: ${{ matrix.os }} |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Check out repo |
| 53 | + uses: actions/checkout@v6 |
| 54 | + |
| 55 | + - name: Configure Python version |
| 56 | + uses: actions/setup-python@v6 |
| 57 | + with: |
| 58 | + python-version: ${{ matrix.python_version }} |
| 59 | + |
| 60 | + - name: Build sdist |
| 61 | + run: | |
| 62 | + python -m pip install -U build pip setuptools |
| 63 | + python -m pip install -U -r requirements.txt |
| 64 | + python -m build --sdist |
| 65 | +
|
| 66 | + - name: Delete source directory |
| 67 | + run: rm -rf fastapi_explosion_extras |
| 68 | + shell: bash |
| 69 | + |
| 70 | + - name: Uninstall all packages |
| 71 | + run: | |
| 72 | + python -m pip freeze > installed.txt |
| 73 | + python -m pip uninstall -y -r installed.txt |
| 74 | +
|
| 75 | + - name: Install from sdist |
| 76 | + run: | |
| 77 | + SDIST=$(python -c "import os;print(os.listdir('./dist')[-1])" 2>&1) |
| 78 | + python -m pip install dist/$SDIST |
| 79 | + shell: bash |
| 80 | + |
| 81 | + - name: Test import |
| 82 | + run: python -c "import fastapi_explosion_extras" -Werror |
| 83 | + |
| 84 | + - name: Install test requirements |
| 85 | + run: | |
| 86 | + python -m pip install -U -r requirements.txt |
| 87 | +
|
| 88 | + - name: Run tests |
| 89 | + run: | |
| 90 | + python -m pytest --pyargs fastapi_explosion_extras -Werror |
0 commit comments