From 034a37761c173f3d908431bb30e152c1ad3a596b Mon Sep 17 00:00:00 2001 From: anilbey Date: Wed, 21 Feb 2024 10:18:30 +0100 Subject: [PATCH] Ci: separate build-wheels from publish (#370) * separate build-wheels from publish * use relative path in workflow call * remove local workflow call version specification * remove mirror-ebrains * remove python-version, os,arc in the local workflow call * Revert "remove mirror-ebrains" This reverts commit 158634f6674eee357fcb96c49f26410090779c52. * rename the name on the 1st line of publish.yml --- .github/workflows/build-wheels.yml | 43 ++++++++++++++++++++ .github/workflows/{build.yml => publish.yml} | 43 ++------------------ 2 files changed, 46 insertions(+), 40 deletions(-) create mode 100644 .github/workflows/build-wheels.yml rename .github/workflows/{build.yml => publish.yml} (68%) diff --git a/.github/workflows/build-wheels.yml b/.github/workflows/build-wheels.yml new file mode 100644 index 00000000..6fce2b8b --- /dev/null +++ b/.github/workflows/build-wheels.yml @@ -0,0 +1,43 @@ +name: Build Wheels + +on: + pull_request: {} + workflow_call: + +jobs: + build-wheels: + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ubuntu-22.04, macos-latest, windows-latest] + python: [cp39, cp310, cp311, cp312] + arch: [x86_64, amd64] + exclude: + - os: macos-latest + arch: amd64 + - os: ubuntu-22.04 + arch: amd64 + - os: windows-latest + arch: x86_64 + env: + CIBW_BUILD: ${{ matrix.python }}*${{ matrix.arch }} + CIBW_TEST_REQUIRES: pytest neo[neomatlabio]>=0.5.1 pytest-xdist>=3.3.1 + CIBW_TEST_COMMAND: pytest -sx -n auto {project}/tests + CIBW_SKIP: "*-musllinux_*" + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 0 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: 3.9 # This might need to be dynamic based on the matrix + - name: Install cibuildwheel + run: pip install cibuildwheel + - name: Build wheels + run: cibuildwheel --output-dir wheelhouse + - uses: actions/upload-artifact@v4 + with: + name: wheels-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.arch }} + path: ./wheelhouse/*.whl diff --git a/.github/workflows/build.yml b/.github/workflows/publish.yml similarity index 68% rename from .github/workflows/build.yml rename to .github/workflows/publish.yml index 96a01d0d..752c8427 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/publish.yml @@ -1,4 +1,4 @@ -name: Build +name: Publish on: push: @@ -46,47 +46,10 @@ jobs: tag_name: ${{ env.TAG_NAME }} name: ${{ env.TAG_NAME }} generate_release_notes: true - + wheels: needs: [call-test-workflow, tag] - name: Build wheels for ${{ matrix.python }} ${{ matrix.os }} ${{ matrix.arch }} - runs-on: ${{ matrix.os }} - strategy: - fail-fast: false - matrix: - os: [ubuntu-22.04, macos-latest, windows-latest] - python: [cp39, cp310, cp311, cp312] - arch: [x86_64, amd64] - exclude: - - os: macos-latest - arch: amd64 - - os: ubuntu-22.04 - arch: amd64 - - os: windows-latest - arch: x86_64 - - env: - CIBW_BUILD: ${{ matrix.python }}*${{ matrix.arch }} - CIBW_TEST_REQUIRES: pytest neo[neomatlabio]>=0.5.1 pytest-xdist>=3.3.1 - CIBW_TEST_COMMAND: pytest -sx -n auto {project}/tests - CIBW_SKIP: "*-musllinux_*" - - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: Set up Python 3.9 - uses: actions/setup-python@v5 - with: - python-version: 3.9 - - name: Install cibuildwheel - run: pip install cibuildwheel - - name: Build wheels - run: cibuildwheel --output-dir wheelhouse - - uses: actions/upload-artifact@v4 - with: - name: wheels-${{ matrix.os }}-${{ matrix.python }}-${{ matrix.arch }} - path: ./wheelhouse/*.whl + uses: ./.github/workflows/build-wheels.yml tarball: name: Build tarball