| 1 | name: QA |
| 2 | on: |
| 3 | push: |
| 4 | branches: [ "main" ] |
| 5 | pull_request: |
| 6 | branches: [ "main" ] |
| 7 | jobs: |
| 8 | python-versions: |
| 9 | runs-on: ubuntu-latest |
| 10 | outputs: |
| 11 | versions: ${{ steps.python-versions.outputs.versions }} |
| 12 | steps: |
| 13 | - uses: actions/checkout@v4 |
| 14 | - name: Get Python versions |
| 15 | id: python-versions |
| 16 | run: | |
| 17 | CLASSIFIERS="$(yq -p toml -o toml '.project.classifiers[]' pyproject.toml | grep "Programming Language :: Python :: " | grep "\.")" |
| 18 | VERSIONS="$(echo "${CLASSIFIERS}" | sed -e 's/Programming Language :: Python :: \([0-9.]*\)$/"\1"/g' | tr '\n' ',' | sed -e 's/,$//g')" |
| 19 | echo "versions=[${VERSIONS}]" > "${GITHUB_OUTPUT}" |
| 20 | |
| 21 | qa: |
| 22 | name: Run QA checks |
| 23 | runs-on: ubuntu-latest |
| 24 | needs: python-versions |
| 25 | strategy: |
| 26 | matrix: |
| 27 | python-version: ${{fromJson(needs.python-versions.outputs.versions)}} |
| 28 | steps: |
| 29 | - uses: actions/checkout@v4 |
| 30 | - name: Set up Python ${{ matrix.python-version }} |
| 31 | uses: actions/setup-python@v5 |
| 32 | with: |
| 33 | python-version: ${{ matrix.python-version }} |
| 34 | - name: Set up Node.js LTS |
| 35 | uses: actions/setup-node@v4 |
| 36 | with: |
| 37 | node-version: "lts/*" |
| 38 | - name: Install the world |
| 39 | run: | |
| 40 | python -m pip install --upgrade pip setuptools wheel |
| 41 | pip install -e .[dev] |
| 42 | - name: Run linting |
| 43 | run: | |
| 44 | flake8 ./pyee ./tests |
| 45 | validate-pyproject ./pyproject.toml |
| 46 | - name: Run pyright |
| 47 | run: npx pyright@latest |
| 48 | - name: Run mypy |
| 49 | run: mypy . |
| 50 | - name: Run tests |
| 51 | run: pytest ./tests |
| 52 | |
| 53 | actionlint: |
| 54 | name: Run actionlint |
| 55 | runs-on: ubuntu-latest |
| 56 | steps: |
| 57 | - uses: actions/checkout@v4 |
| 58 | - name: Run actionlint |
| 59 | uses: raven-actions/actionlint@v2 |