From 71447bc76af0840a313b9822649bb88e5176bfb1 Mon Sep 17 00:00:00 2001 From: Tal Einat <532281+taleinat@users.noreply.github.com> Date: Sat, 29 Jun 2024 22:11:27 +0300 Subject: [PATCH] Add CI building of dist packages --- .github/workflows/build.yml | 83 ++++++++++++++++++++++++++ .github/workflows/{ci.yml => test.yml} | 58 +++++++++--------- 2 files changed, 112 insertions(+), 29 deletions(-) create mode 100644 .github/workflows/build.yml rename .github/workflows/{ci.yml => test.yml} (82%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..af249fc --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,83 @@ +# The "build" workflow produces wheels (and the sdist) for all python +# versions/platforms. Where possible (i.e. the build is not a cross-compile), +# the test suite is also run for the wheel (this test covers fewer +# configurations than the "test" workflow and tox.ini). +name: Build + +on: + push: + branches: + # Run on release branches. This gives us a chance to detect rot in this + # configuration before pushing a tag (which we'd rather not have to undo). + - "branch[0-9]*" + tags: + # The main purpose of this workflow is to build wheels for release tags. + # It runs automatically on tags matching this pattern and pushes to pypi. + - "v*" + workflow_dispatch: + # Allow this workflow to be run manually (pushing to testpypi instead of pypi) + +env: + python-version: '3.12' + +jobs: + build_sdist: + name: Build sdist + runs-on: ubuntu-22.04 + steps: + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{ env.python-version }} + + - name: Check metadata + run: "python setup.py check" + - name: Build sdist + run: "python setup.py sdist && ls -l ./dist" + + - name: Upload sdist + uses: actions/upload-artifact@v4 + with: + name: artifacts-sdist + path: ./dist/tornado-*.tar.gz + + build_wheels: + name: Build wheels on ${{ matrix.os }} + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + # macos-13 is an intel runner, macos-14 is apple silicon + os: [ ubuntu-latest, windows-latest, macos-13, macos-14 ] + + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-python@v5 + name: Install Python + with: + python-version: ${{ env.python-version }} + cache: 'pip' + cache-dependency-path: .github/workflows/build.yml + - name: Set up QEMU + if: runner.os == 'Linux' + uses: docker/setup-qemu-action@v3 + with: + platforms: all + + - name: Build wheels + uses: pypa/cibuildwheel@v2.19 + env: + CIBW_BUILD: '{cp38,cp39,cp310,cp311,cp312,pypy39,pypy310}-*' + CIBW_TEST_COMMAND: 'python -m unittest discover tests && ls -l ./wheelhouse' + with: + package-dir: ./src/fuzzysearch + + - name: Upload wheel + uses: actions/upload-artifact@v4 + with: + name: artifacts-${{ matrix.os }} + path: ./wheelhouse/*.whl diff --git a/.github/workflows/ci.yml b/.github/workflows/test.yml similarity index 82% rename from .github/workflows/ci.yml rename to .github/workflows/test.yml index fd3d0fb..1b52665 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/test.yml @@ -136,32 +136,32 @@ jobs: tox_env: 'pypy310-with_coverage' os: 'macos-latest' steps: - - name: Check out code - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: ${{ matrix.python }} - architecture: ${{ matrix.python_arch }} - cache: 'pip' - cache-dependency-path: .github/workflows/ci.yml - - name: Install tox dependencies - run: | - python -m pip install --upgrade pip - pip install --progress-bar=off 'tox ~= 4.9' - virtualenv --version - pip --version - tox --version - pip list --format=freeze - - name: Cache tox env - uses: actions/cache@v4 - with: - path: .tox/${{ matrix.tox_env }} - key: ${{ matrix.python }}-${{ matrix.python_arch }}-${{ hashFiles('setup.py', 'tox.ini') }} - - name: Test - env: - TOXPYTHON: '${{ matrix.toxpython }}' - run: > - tox -e ${{ matrix.tox_env }} -v + - name: Check out code + uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Install Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + architecture: ${{ matrix.python_arch }} + cache: 'pip' + cache-dependency-path: .github/workflows/test.yml + - name: Install tox dependencies + run: | + python -m pip install --upgrade pip + pip install --progress-bar=off 'tox ~= 4.9' + virtualenv --version + pip --version + tox --version + pip list --format=freeze + - name: Cache tox env + uses: actions/cache@v4 + with: + path: .tox/${{ matrix.tox_env }} + key: ${{ matrix.python }}-${{ matrix.python_arch }}-${{ hashFiles('setup.py', 'tox.ini') }} + - name: Test + env: + TOXPYTHON: '${{ matrix.toxpython }}' + run: > + tox -e '${{ matrix.tox_env }}' -v