|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + release: |
| 7 | + types: [published] |
| 8 | + schedule: |
| 9 | + # Daily at 5:41 |
| 10 | + - cron: "41 5 * * *" |
| 11 | + |
| 12 | +env: |
| 13 | + PIP_DISABLE_PIP_VERSION_CHECK: "1" |
| 14 | + PIP_NO_PYTHON_VERSION_WARNING: "1" |
| 15 | + |
| 16 | +jobs: |
| 17 | + pre-commit: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - uses: actions/setup-python@v5 |
| 22 | + with: |
| 23 | + python-version: "3.x" |
| 24 | + - uses: pre-commit/[email protected] |
| 25 | + |
| 26 | + list: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + outputs: |
| 29 | + noxenvs: ${{ steps.noxenvs-matrix.outputs.noxenvs }} |
| 30 | + steps: |
| 31 | + - uses: actions/checkout@v4 |
| 32 | + - name: Set up nox |
| 33 | + |
| 34 | + - id: noxenvs-matrix |
| 35 | + run: | |
| 36 | + echo >>$GITHUB_OUTPUT noxenvs=$( |
| 37 | + nox --list-sessions --json | jq '[.[].session]' |
| 38 | + ) |
| 39 | +
|
| 40 | + ci: |
| 41 | + needs: list |
| 42 | + runs-on: ${{ matrix.os }} |
| 43 | + strategy: |
| 44 | + fail-fast: false |
| 45 | + matrix: |
| 46 | + os: [macos-latest, ubuntu-latest] |
| 47 | + noxenv: ${{ fromJson(needs.list.outputs.noxenvs) }} |
| 48 | + posargs: [""] |
| 49 | + include: |
| 50 | + - os: ubuntu-latest |
| 51 | + noxenv: "tests-3.11" |
| 52 | + posargs: coverage github |
| 53 | + |
| 54 | + steps: |
| 55 | + - uses: actions/checkout@v4 |
| 56 | + - name: Install dependencies |
| 57 | + run: sudo apt-get update && sudo apt-get install -y libenchant-2-dev |
| 58 | + if: runner.os == 'Linux' && startsWith(matrix.noxenv, 'docs') |
| 59 | + - name: Install dependencies |
| 60 | + run: brew install enchant |
| 61 | + if: runner.os == 'macOS' && startsWith(matrix.noxenv, 'docs') |
| 62 | + - name: Set up Python |
| 63 | + uses: actions/setup-python@v5 |
| 64 | + with: |
| 65 | + python-version: | |
| 66 | + 3.8 |
| 67 | + 3.9 |
| 68 | + 3.10 |
| 69 | + 3.11 |
| 70 | + 3.12 |
| 71 | + pypy3.10 |
| 72 | + allow-prereleases: true |
| 73 | + - name: Set up nox |
| 74 | + |
| 75 | + - name: Run nox |
| 76 | + run: nox -s "${{ matrix.noxenv }}" -- ${{ matrix.posargs }} |
| 77 | + |
| 78 | + packaging: |
| 79 | + needs: ci |
| 80 | + runs-on: ubuntu-latest |
| 81 | + environment: |
| 82 | + name: PyPI |
| 83 | + url: https://pypi.org/p/referencing-http |
| 84 | + permissions: |
| 85 | + contents: write |
| 86 | + id-token: write |
| 87 | + |
| 88 | + steps: |
| 89 | + - uses: actions/checkout@v4 |
| 90 | + - name: Set up Python |
| 91 | + uses: actions/setup-python@v5 |
| 92 | + with: |
| 93 | + python-version: "3.x" |
| 94 | + - name: Install dependencies |
| 95 | + run: python -m pip install build |
| 96 | + - name: Create packages |
| 97 | + run: python -m build . |
| 98 | + - name: Publish to PyPI |
| 99 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 100 | + uses: pypa/gh-action-pypi-publish@release/v1 |
| 101 | + - name: Create a Release |
| 102 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 103 | + uses: softprops/action-gh-release@v1 |
| 104 | + with: |
| 105 | + files: | |
| 106 | + dist/* |
| 107 | + generate_release_notes: true |
0 commit comments