|
| 1 | +name: Github Actions |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - "master" |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ${{ matrix.os }} |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] |
| 15 | + os: [ubuntu-18.04, ubuntu-latest, macos-latest, windows-latest, windows-2022, macos-10.15] |
| 16 | + steps: |
| 17 | + - uses: actions/checkout@v2 |
| 18 | + |
| 19 | + - name: Set up Python ${{ matrix.python-version }} |
| 20 | + uses: actions/setup-python@v2 |
| 21 | + with: |
| 22 | + python-version: ${{ matrix.python-version }} |
| 23 | + |
| 24 | + - name: Install as develop |
| 25 | + run: | |
| 26 | + pip install -e . |
| 27 | +
|
| 28 | + - name: Test with pytest |
| 29 | + run: | |
| 30 | + pip install pytest |
| 31 | + pytest |
| 32 | +
|
| 33 | + build_win_mac: |
| 34 | + runs-on: ${{ matrix.os }} |
| 35 | + if: startsWith(github.ref, 'refs/tags') |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"] |
| 39 | + os: [macos-latest, windows-latest] |
| 40 | + steps: |
| 41 | + - uses: actions/checkout@v2 |
| 42 | + with: |
| 43 | + fetch-depth: 0 |
| 44 | + |
| 45 | + - name: Set up Python ${{ matrix.python-version }} |
| 46 | + uses: actions/setup-python@v2 |
| 47 | + with: |
| 48 | + python-version: ${{ matrix.python-version }} |
| 49 | + |
| 50 | + - name: Install build |
| 51 | + run: | |
| 52 | + pip install build |
| 53 | +
|
| 54 | + - name: Build wheel |
| 55 | + run: | |
| 56 | + python -m build -w |
| 57 | +
|
| 58 | + - name: Store wheel artifacts |
| 59 | + uses: actions/upload-artifact@v2 |
| 60 | + with: |
| 61 | + name: ${{ matrix.os }}-${{ matrix.python-version }}-dist |
| 62 | + path: dist/ |
| 63 | + |
| 64 | + build_manylinux: |
| 65 | + runs-on: ubuntu-latest |
| 66 | + if: startsWith(github.ref, 'refs/tags') |
| 67 | + steps: |
| 68 | + - uses: actions/checkout@v2 |
| 69 | + with: |
| 70 | + fetch-depth: 0 |
| 71 | + |
| 72 | + |
| 73 | + with: |
| 74 | + python-versions: "cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39 cp310-cp310" |
| 75 | + |
| 76 | + - name: Store wheel artifacts |
| 77 | + uses: actions/upload-artifact@v2 |
| 78 | + with: |
| 79 | + name: linux-wheel |
| 80 | + path: dist/ |
| 81 | + |
| 82 | + build_sdist: |
| 83 | + runs-on: ubuntu-latest |
| 84 | + if: startsWith(github.ref, 'refs/tags') |
| 85 | + steps: |
| 86 | + - uses: actions/checkout@v2 |
| 87 | + with: |
| 88 | + fetch-depth: 0 |
| 89 | + |
| 90 | + - name: Install build |
| 91 | + run: | |
| 92 | + pip install build |
| 93 | +
|
| 94 | + - name: Build wheel |
| 95 | + run: | |
| 96 | + python -m build -s |
| 97 | +
|
| 98 | + - name: Store wheel artifacts |
| 99 | + uses: actions/upload-artifact@v2 |
| 100 | + with: |
| 101 | + name: linux-sdist |
| 102 | + path: dist/ |
| 103 | + |
| 104 | + release: |
| 105 | + needs: [build_manylinux, build_win_mac, build_sdist] |
| 106 | + if: startsWith(github.ref, 'refs/tags') |
| 107 | + runs-on: ubuntu-latest |
| 108 | + steps: |
| 109 | + - name: Download all workflow run artifacts |
| 110 | + uses: actions/download-artifact@v2 |
| 111 | + |
| 112 | + - name: Aggregate artifacts |
| 113 | + shell: bash |
| 114 | + run: | |
| 115 | + mkdir dist |
| 116 | + find . '(' -type f -iname "*-manylinux*.whl" -or -iname "*-win*.whl" -or -iname "*-macosx*.whl" -or -iname "*.tar.gz" ')' -exec mv -t dist/ {} + |
| 117 | +
|
| 118 | + - name: Set up Python ${{ matrix.python-version }} |
| 119 | + uses: actions/setup-python@v2 |
| 120 | + with: |
| 121 | + python-version: "3.10" |
| 122 | + |
| 123 | + - name: Publish distribution 📦 to PyPI |
| 124 | + uses: pypa/gh-action-pypi-publish@master |
| 125 | + with: |
| 126 | + password: ${{ secrets.PYPI_API_TOKEN }} |
0 commit comments