diff --git a/.github/workflows/pypi-test.yml b/.github/workflows/pypi-test.yml index f59826f..cdc78d1 100644 --- a/.github/workflows/pypi-test.yml +++ b/.github/workflows/pypi-test.yml @@ -6,7 +6,7 @@ name: Test the library on: push: branches: - - main + - master tags: - "*" pull_request: @@ -20,30 +20,53 @@ jobs: - uses: actions/checkout@v3 with: submodules: true + - name: "Install dependencies" run: | sudo apt-get install zlib1g-dev + - name: Set up Python 3.9 uses: actions/setup-python@v2 with: python-version: 3.9 + cache: 'pip' + - name: Install dependencies run: | - python -m pip install --upgrade pip - pip install flake8 pytest tox cython numpy + python -m pip install --upgrade pip setuptools + DEPENDENCIES=$(python -c 'from setuptools.config.setupcfg import read_configuration as c; a = c("setup.cfg"); print(" ".join(a["options"]["install_requires"][1:] + a["options"]["extras_require"]["testing"][1:]))') + pip install ${DEPENDENCIES} + - name: Download rds2cpp deps run: | cd extern/rds2cpp cmake . cd ../.. + + # We do proper tests if we're on the master branch, or if we're creating a new release. - name: Test with tox + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') run: | - python setup.py build_ext --inplace + pip install tox tox + - name: Build docs + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') run: | tox -e docs touch ./docs/_build/html/.nojekyll + + # Otherwise we do some cached builds and tests for faster merging of PRs. + - name: Set up ccache + if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags') + uses: hendrikmuhs/ccache-action@v1.2 + + - name: Quickly build and test + if: github.ref != 'refs/heads/master' && !startsWith(github.ref, 'refs/tags') + run: | + CC="ccache gcc" python setup.py install + pytest + - name: GH Pages Deployment if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') uses: JamesIves/github-pages-deploy-action@4.1.3 @@ -65,19 +88,14 @@ jobs: with: submodules: true - - name: Download dependencies - run: | - cd extern/rds2cpp - cmake . - cd ../.. - - name: Build wheels uses: pypa/cibuildwheel@v2.12.1 env: CIBW_ARCHS_MACOS: x86_64 arm64 CIBW_ARCHS_LINUX: x86_64 # remove this later so we build for all linux archs CIBW_PROJECT_REQUIRES_PYTHON: ">=3.9" - CIBW_SKIP: pp* + CIBW_SKIP: pp* # remove this later, but for some reason fails to generate pypy wheels + - uses: actions/upload-artifact@v3 with: path: ./wheelhouse/*.whl