|
| 1 | +# This workflow will install Python dependencies, run tests and lint with a variety of Python versions |
| 2 | +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python |
| 3 | + |
| 4 | +name: tsx-package-build |
| 5 | + |
| 6 | +on: |
| 7 | + push: |
| 8 | + branches: [ $default-branch, master ] |
| 9 | + paths-ignore: |
| 10 | + - '**.md' |
| 11 | + - '**.rst' |
| 12 | + pull_request: |
| 13 | + branches: [ '**' ] |
| 14 | + paths-ignore: |
| 15 | + - '**.md' |
| 16 | + - '**.rst' |
| 17 | + |
| 18 | +jobs: |
| 19 | + build: |
| 20 | + runs-on: ${{ matrix.os }} |
| 21 | + strategy: |
| 22 | + fail-fast: false # Changed to false to see all failures |
| 23 | + matrix: |
| 24 | + os: [ ubuntu-latest, windows-latest, macos-latest, ubuntu-24.04-arm ] |
| 25 | + python-version: [ "3.8","3.9","3.10", "3.11","3.12", "3.13" ] # ToDo: add support for 3.14 when it's available in GitHub Actions |
| 26 | + |
| 27 | + steps: |
| 28 | + - uses: actions/checkout@v4 |
| 29 | + - name: Set up Python ${{ matrix.python-version }} |
| 30 | + uses: actions/setup-python@v3 |
| 31 | + with: |
| 32 | + python-version: ${{ matrix.python-version }} |
| 33 | + |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + python -m pip install --upgrade pip |
| 37 | + python -m pip install flake8 pytest coverage |
| 38 | + pip install -e ".[dev]" |
| 39 | + - name: Lint with flake8 |
| 40 | + run: | |
| 41 | + # stop the build if there are Python syntax errors or undefined names |
| 42 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 43 | + # exit-zero treats all errors as warnings |
| 44 | + flake8 . --count --exit-zero --max-complexity=20 --max-line-length=160 --statistics |
| 45 | +
|
| 46 | + - name: Run tests with coverage |
| 47 | + run: | |
| 48 | + coverage run --branch run_tests.py |
| 49 | + coverage report |
| 50 | +
|
| 51 | + build-container: |
| 52 | + runs-on: ubuntu-latest |
| 53 | + container: |
| 54 | + image: python:3.12-bullseye |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v4 |
| 57 | + |
| 58 | + - name: Install dependencies in container |
| 59 | + run: | |
| 60 | + python -m pip install --upgrade pip |
| 61 | + python -m pip install flake8 pytest coverage |
| 62 | + pip install -e ".[dev]" |
| 63 | +
|
| 64 | + - name: Lint with flake8 in container |
| 65 | + run: | |
| 66 | + flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics |
| 67 | + flake8 . --count --exit-zero --max-complexity=20 --max-line-length=160 --statistics |
| 68 | +
|
| 69 | + - name: Run tests in container |
| 70 | + run: | |
| 71 | + coverage run --branch run_tests.py |
| 72 | + coverage report |
0 commit comments