|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + release: |
| 7 | + types: [published] |
| 8 | + schedule: |
| 9 | + # Daily at 3:21 |
| 10 | + - cron: '21 3 * * *' |
| 11 | + |
| 12 | +jobs: |
| 13 | + pre-commit: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + steps: |
| 16 | + - uses: actions/checkout@v3 |
| 17 | + - uses: actions/setup-python@v4 |
| 18 | + - uses: pre-commit/[email protected] |
| 19 | + |
| 20 | + ci: |
| 21 | + runs-on: ${{ matrix.os }} |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + os: [macos-latest, ubuntu-latest] |
| 26 | + python-version: |
| 27 | + - name: pypy-3.8 |
| 28 | + toxenv: pypy3-build |
| 29 | + - name: pypy-3.8 |
| 30 | + toxenv: pypy3-safety |
| 31 | + - name: pypy-3.8 |
| 32 | + toxenv: pypy3-tests |
| 33 | + - name: 3.7 |
| 34 | + toxenv: py37-build |
| 35 | + - name: 3.7 |
| 36 | + toxenv: py37-safety |
| 37 | + - name: 3.7 |
| 38 | + toxenv: py37-tests |
| 39 | + - name: 3.8 |
| 40 | + toxenv: py38-build |
| 41 | + - name: 3.8 |
| 42 | + toxenv: py38-safety |
| 43 | + - name: 3.8 |
| 44 | + toxenv: py38-tests |
| 45 | + - name: 3.9 |
| 46 | + toxenv: py39-build |
| 47 | + - name: 3.9 |
| 48 | + toxenv: py39-safety |
| 49 | + - name: 3.9 |
| 50 | + toxenv: py39-tests |
| 51 | + - name: "3.10" |
| 52 | + toxenv: py310-build |
| 53 | + - name: "3.10" |
| 54 | + toxenv: py310-safety |
| 55 | + - name: "3.10" |
| 56 | + toxenv: py310-tests |
| 57 | + - name: "3.10" |
| 58 | + toxenv: readme |
| 59 | + - name: "3.10" |
| 60 | + toxenv: secrets |
| 61 | + - name: "3.10" |
| 62 | + toxenv: style |
| 63 | + |
| 64 | + steps: |
| 65 | + - uses: actions/checkout@v3 |
| 66 | + - name: Set up Python |
| 67 | + uses: actions/setup-python@v4 |
| 68 | + with: |
| 69 | + python-version: ${{ matrix.python-version.name }} |
| 70 | + - name: Install dependencies |
| 71 | + run: > |
| 72 | + sudo apt-get update && |
| 73 | + sudo apt-get install -y libenchant-dev libxml2-dev libxslt-dev |
| 74 | + if: runner.os == 'Linux' && startsWith(matrix.python-version.toxenv, 'docs-') |
| 75 | + - name: Install dependencies |
| 76 | + run: brew install enchant |
| 77 | + if: runner.os == 'macOS' && startsWith(matrix.python-version.toxenv, 'docs-') |
| 78 | + - name: Install tox |
| 79 | + run: python -m pip install tox |
| 80 | + - name: Run tox |
| 81 | + run: python -m tox -e "${{ matrix.python-version.toxenv }}" |
| 82 | + |
| 83 | + packaging: |
| 84 | + needs: ci |
| 85 | + runs-on: ubuntu-latest |
| 86 | + |
| 87 | + steps: |
| 88 | + - uses: actions/checkout@v3 |
| 89 | + - name: Set up Python |
| 90 | + uses: actions/setup-python@v4 |
| 91 | + with: |
| 92 | + python-version: "3.10" |
| 93 | + - name: Install dependencies |
| 94 | + run: python -m pip install build |
| 95 | + - name: Create packages |
| 96 | + run: python -m build . |
| 97 | + - uses: actions/upload-artifact@v3 |
| 98 | + with: |
| 99 | + name: dist |
| 100 | + path: dist |
| 101 | + - name: Publish package |
| 102 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 103 | + uses: pypa/gh-action-pypi-publish@master |
| 104 | + with: |
| 105 | + user: __token__ |
| 106 | + password: ${{ secrets.pypi_password }} |
| 107 | + - name: Create Release Notes |
| 108 | + if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags') |
| 109 | + uses: actions/github-script@v6 |
| 110 | + with: |
| 111 | + github-token: ${{ secrets.GITHUB_TOKEN }} |
| 112 | + script: | |
| 113 | + await github.request(`POST /repos/${{ github.repository }}/releases`, { |
| 114 | + tag_name: "${{ github.ref }}", |
| 115 | + generate_release_notes: true |
| 116 | + }); |
0 commit comments