diff --git a/.github/workflows/build_wheel.yml b/.github/workflows/build_wheel.yml new file mode 100644 index 000000000..4c2b813ee --- /dev/null +++ b/.github/workflows/build_wheel.yml @@ -0,0 +1,35 @@ +name: Build Wheel + +on: + workflow_call: + +jobs: + build-and-test: + name: Test SDist and Build Wheel + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: "3.10" + - name: Build sdist and wheel + run: | + python -m pip install -U pip + python -m pip install build + python -m build + - name: Check sdist install and imports + run: | + mkdir -p test-sdist + cd test-sdist + python -m venv venv-sdist + venv-sdist/bin/python -m pip install ../dist/outlines-*.tar.gz + venv-sdist/bin/python -c "import outlines" + - name: Check wheel install and imports + run: | + mkdir -p test-wheel + cd test-wheel + python -m venv venv-wheel + venv-wheel/bin/python -m pip install ../dist/outlines-*.whl + venv-wheel/bin/python -c "import outlines" diff --git a/.github/workflows/release_pypi.yaml b/.github/workflows/release_pypi.yaml index 0006e74f2..535e6ab66 100644 --- a/.github/workflows/release_pypi.yaml +++ b/.github/workflows/release_pypi.yaml @@ -9,34 +9,10 @@ jobs: name: Build and publish on PyPi runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: "3.10" - - name: Build sdist and wheel - run: | - python -m pip install -U pip - python -m pip install build - python -m build + - uses: .github/workflows/build_wheel.yml - name: Check that the package version matches the Release name run: | grep -Rq "^Version: ${GITHUB_REF:10}$" outlines.egg-info/PKG-INFO - - name: Check sdist install and imports - run: | - mkdir -p test-sdist - cd test-sdist - python -m venv venv-sdist - venv-sdist/bin/python -m pip install ../dist/outlines-*.tar.gz - venv-sdist/bin/python -c "import outlines" - - name: Check wheel install and imports - run: | - mkdir -p test-wheel - cd test-wheel - python -m venv venv-wheel - venv-wheel/bin/python -m pip install ../dist/outlines-*.whl - venv-wheel/bin/python -c "import outlines" - name: Publish to PyPi uses: pypa/gh-action-pypi-publish@v1.4.2 with: diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b8d4208af..d52c1bafa 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -88,3 +88,6 @@ jobs: name: html-report path: htmlcov if: ${{ failure() }} + + build-wheel: + uses: ./.github/workflows/build_wheel.yml