|
| 1 | +name: CI |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_dispatch: |
| 5 | + pull_request: |
| 6 | + push: |
| 7 | + # branches: |
| 8 | + # - master |
| 9 | + # - main |
| 10 | + # tags: |
| 11 | + # - "*.*.*" |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint: |
| 15 | + name: Lint |
| 16 | + runs-on: ubuntu-20.04 |
| 17 | + steps: |
| 18 | + - uses: actions/checkout@v2 |
| 19 | + - uses: actions/setup-python@v2 |
| 20 | + - uses: pre-commit/[email protected] |
| 21 | + |
| 22 | + |
| 23 | + build_wheels: |
| 24 | + name: Build ${{ matrix.arch }} wheels on ${{ matrix.os }} |
| 25 | + needs: [lint] |
| 26 | + runs-on: ${{ matrix.os }} |
| 27 | + strategy: |
| 28 | + fail-fast: false |
| 29 | + matrix: |
| 30 | + include: |
| 31 | + - os: ubuntu-20.04 |
| 32 | + arch: "x86_64" |
| 33 | + - os: ubuntu-20.04 |
| 34 | + arch: "i686" |
| 35 | + - os: ubuntu-20.04 |
| 36 | + arch: "aarch64" |
| 37 | + - os: ubuntu-20.04 |
| 38 | + arch: "ppc64le" |
| 39 | + - os: ubuntu-20.04 |
| 40 | + arch: "s390x" |
| 41 | + - os: windows-2019 |
| 42 | + arch: "AMD64" |
| 43 | + - os: windows-2019 |
| 44 | + arch: "x86" |
| 45 | + - os: macos-10.15 |
| 46 | + arch: "x86_64" |
| 47 | + |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v2 |
| 50 | + with: |
| 51 | + fetch-depth: 0 # required for versioneer to find tags |
| 52 | + |
| 53 | + - name: Set up QEMU |
| 54 | + |
| 55 | + if: runner.os == 'Linux' |
| 56 | + |
| 57 | + - name: Build wheels |
| 58 | + |
| 59 | + env: |
| 60 | + CIBW_ARCHS: "${{ matrix.arch }}" |
| 61 | + |
| 62 | + - uses: actions/upload-artifact@v2 |
| 63 | + with: |
| 64 | + path: ./wheelhouse/*.whl |
| 65 | + |
| 66 | + build_sdist: |
| 67 | + name: Build source distribution |
| 68 | + needs: [lint] |
| 69 | + runs-on: ubuntu-20.04 |
| 70 | + steps: |
| 71 | + - uses: actions/checkout@v2 |
| 72 | + with: |
| 73 | + fetch-depth: 0 # required for versioneer to find tags |
| 74 | + |
| 75 | + - name: Build SDist |
| 76 | + run: pipx run build --sdist |
| 77 | + |
| 78 | + - uses: actions/upload-artifact@v2 |
| 79 | + with: |
| 80 | + path: dist/*.tar.gz |
| 81 | + |
| 82 | + test_sdist: |
| 83 | + name: Test SDist with python ${{ matrix.python }} |
| 84 | + needs: [build_sdist] |
| 85 | + runs-on: ubuntu-20.04 |
| 86 | + strategy: |
| 87 | + fail-fast: false |
| 88 | + matrix: |
| 89 | + python: ["2.7", "3.6", "3.10-dev"] |
| 90 | + |
| 91 | + steps: |
| 92 | + - uses: actions/checkout@v2 |
| 93 | + - uses: actions/setup-python@v2 |
| 94 | + name: Install Python ${{ matrix.python }} |
| 95 | + with: |
| 96 | + python-version: ${{ matrix.python }} |
| 97 | + |
| 98 | + - uses: actions/download-artifact@v2 |
| 99 | + with: |
| 100 | + name: artifact |
| 101 | + path: dist |
| 102 | + |
| 103 | + - name: Install SDist |
| 104 | + env: |
| 105 | + SKBUILD_CONFIGURE_OPTIONS: "-DBUILD_CMAKE_FROM_SOURCE:BOOL=OFF" |
| 106 | + run: pip install dist/*.tar.gz |
| 107 | + |
| 108 | + - name: Install test dependencies |
| 109 | + run: pip install -r requirements-test.txt |
| 110 | + |
| 111 | + - name: Test installed SDist |
| 112 | + run: pytest ./tests |
| 113 | + |
| 114 | + check_dist: |
| 115 | + name: Check dist |
| 116 | + needs: [build_wheels, build_sdist, test_sdist] |
| 117 | + runs-on: ubuntu-20.04 |
| 118 | + steps: |
| 119 | + - uses: actions/download-artifact@v2 |
| 120 | + with: |
| 121 | + name: artifact |
| 122 | + path: dist |
| 123 | + |
| 124 | + - run: pipx run twine check --strict dist/* |
| 125 | + |
| 126 | + upload_pypi: |
| 127 | + name: Upload to PyPI |
| 128 | + needs: [build_wheels, build_sdist, test_sdist, check_dist] |
| 129 | + runs-on: ubuntu-latest |
| 130 | + if: github.event_name == 'push' && github.repository == 'scikit-build/ninja-python-distributions' && startsWith(github.ref, 'refs/tags/') |
| 131 | + steps: |
| 132 | + - uses: actions/download-artifact@v2 |
| 133 | + with: |
| 134 | + name: artifact |
| 135 | + path: dist |
| 136 | + |
| 137 | + - name: Upload to PyPI |
| 138 | + |
| 139 | + with: |
| 140 | + user: __token__ |
| 141 | + password: ${{ secrets.PYPI_RELEASE_PASSWORD }} |
| 142 | + skip_existing: true |
0 commit comments