Skip to content

Commit

Permalink
split out cibuildwheel parts
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Jul 8, 2023
1 parent ca0c8c1 commit f75d471
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 64 deletions.
12 changes: 6 additions & 6 deletions download-dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ inputs:
version:
type: choice
description: 'Python Version to use'
options:
options:
- '3.7'
- '3.8'
- '3.9'
Expand All @@ -15,9 +15,9 @@ inputs:
kind:
type: choice
description: "Kind of asset to install"
options:
- wheel
- sdist
options:
- wheel
- sdist
install_path:
type: string
description: 'Path to install into'
Expand All @@ -29,8 +29,8 @@ runs:
- name: Download artifact (${{ inputs.kind }})
uses: actions/download-artifact@v3
with:
name: ${{ inputs.kind }}
path: ./dist
name: ${{ inputs.kind }}
path: ./dist

- name: Install artifact (${{ inputs.kind }})
shell: bash
Expand Down
66 changes: 30 additions & 36 deletions run-cibuildwheel/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,33 @@ inputs:
version:
type: choice
description: 'Python Version to use'
options:
options:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
default: '3.9'
kind:
type: choice
description: 'Kind of asset to install, "cp" or "pp"'
options:
- cp
- pp
options:
- cp
- pp
default: 'cp'
test:
type: string
description: 'Test command to pass through to cibuildwheel'
default: 'echo "Skipping tests, run on separate actions"'

runs:
using: 'composite'
steps:
- name: Display cibuildwheel cache dir
id: cibuildwheel-cache
run: |
from platformdirs import user_cache_path
import os
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
f.write(f"dir={str(user_cache_path(appname='cibuildwheel', appauthor='pypa'))}")
shell: python

- name: Cache cibuildwheel tools
uses: actions/cache@v3
- name: Setup cibuildwheel caching
uses: actions-ext/python/setup-cibuildwheel@v1
with:
path: ${{ steps.cibuildwheel-cache.outputs.dir }}
key: ${{ runner.os }}-cibuildwheel-${{ inputs.version }}
version: ${{ inputs.version }}

- name: Install cibuildwheel
run: pip install -U cibuildwheel
Expand All @@ -48,141 +42,141 @@ runs:
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}37-*x86_64" # only build x86_64, skip i686
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }} "
if: ${{ runner.os == 'Linux' && inputs.version == '3.7'}}

- name: Build wheels (Linux 3.8)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}38-*x86_64" # only build x86_64, skip i686
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Linux' && inputs.version == '3.8'}}

- name: Build wheels (Linux 3.9)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}39-*x86_64" # only build x86_64, skip i686
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Linux' && inputs.version == '3.9'}}

- name: Build wheels (Linux 3.10)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}310-*x86_64" # only build x86_64, skip i686
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Linux' && inputs.version == '3.10'}}

- name: Build wheels (Linux 3.11)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}311-*x86_64" # only build x86_64, skip i686
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Linux' && inputs.version == '3.11'}}

- name: Build wheels (Linux 3.12)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}312-*x86_64" # only build x86_64, skip i686
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Linux' && inputs.version == '3.12'}}

- name: Build wheels (Mac 3.7)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}37-*" # build x86_64, arm64, and universal2
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'macOS' && inputs.version == '3.7'}}

- name: Build wheels (Mac 3.8)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}38-*" # build x86_64, arm64, and universal2
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'macOS' && inputs.version == '3.8'}}

- name: Build wheels (Mac 3.9)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}39-*" # build x86_64, arm64, and universal2
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'macOS' && inputs.version == '3.9'}}

- name: Build wheels (Mac 3.10)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}310-*" # build x86_64, arm64, and universal2
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'macOS' && inputs.version == '3.10'}}

- name: Build wheels (Mac 3.11)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}311-*" # build x86_64, arm64, and universal2
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'macOS' && inputs.version == '3.11'}}

- name: Build wheels (Mac 3.12)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}312-*" # build x86_64, arm64, and universal2
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'macOS' && inputs.version == '3.12'}}

- name: Build wheels (Windows 3.7)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}37-*amd64" # build amd64, skip win32 and arm64
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Windows' && inputs.version == '3.7'}}

- name: Build wheels (Windows 3.8)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}38-*amd64" # build amd64, skip win32 and arm64
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Windows' && inputs.version == '3.8'}}

- name: Build wheels (Windows 3.9)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}39-*amd64" # build amd64, skip win32 and arm64
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Windows' && inputs.version == '3.9'}}

- name: Build wheels (Windows 3.10)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}310-*amd64" # build amd64, skip win32 and arm64
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Windows' && inputs.version == '3.10'}}

- name: Build wheels (Windows 3.11)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}311-*amd64" # build amd64, skip win32 and arm64
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Windows' && inputs.version == '3.11'}}

- name: Build wheels (Windows 3.12)
run: make dist-cibw
shell: bash
env:
CIBW_BUILD: "${{ inputs.kind }}312-*amd64" # build amd64, skip win32 and arm64
CIBW_TEST_COMMAND: "echo 'Skipping tests, run on separate actions'"
CIBW_TEST_COMMAND: "${{ inputs.test }}"
if: ${{ runner.os == 'Windows' && inputs.version == '3.12'}}
7 changes: 1 addition & 6 deletions setup-cache/action.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
name: Setup Python Caching
name: Setup Python caching
description: 'Setup pip caching'

runs:
using: 'composite'
steps:
##########
# Caches #
##########
################
# Pip Cache
- name: Setup pip cache
uses: actions/cache@v3
with:
Expand Down
11 changes: 11 additions & 0 deletions setup-cibuildwheel-cache/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# setup-cibuildwheel-cache
An action to setup caching for [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/)

## Usage

The following example yaml code will setup cibuildwheel caching.

```yaml
- name: Setup cibuildwheel caching
uses: actions-ext/python/setup-cibuildwheel-cache@v1
```
34 changes: 34 additions & 0 deletions setup-cibuildwheel-cache/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Setup cibuildwheel caching
description: 'Setup cibuildwheel caching'

inputs:
version:
type: choice
description: 'Python Version to use'
options:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
- '3.12'
default: '3.9'

runs:
using: 'composite'
steps:
- name: Display cibuildwheel cache dir
id: cibuildwheel-cache
run: |
from platformdirs import user_cache_path
import os
with open(os.getenv('GITHUB_OUTPUT'), 'w') as f:
f.write(f"dir={str(user_cache_path(appname='cibuildwheel', appauthor='pypa'))}")
shell: python

- name: Cache cibuildwheel tools
uses: actions/cache@v3
with:
path: ${{ steps.cibuildwheel-cache.outputs.dir }}
key: ${{ runner.os }}-cibuildwheel-${{ inputs.version }}
13 changes: 13 additions & 0 deletions setup-cibuildwheel/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# setup-cibuildwheel
An action to install and configure caching for [`cibuildwheel`](https://cibuildwheel.readthedocs.io/en/stable/)

## Usage

The following example yaml code will install cibuildwheel and configure caching.

```yaml
- name: Setup cibuildwheel
uses: actions-ext/python/setup-cibuildwheel@v1
with:
version: '3.9'
```
26 changes: 26 additions & 0 deletions setup-cibuildwheel/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Setup cibuildwheel
description: 'Ensure cibuildwheel is installed, and setup caching'

inputs:
version:
type: choice
description: "Python version"
options:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
default: '3.9'

runs:
using: 'composite'
steps:
- name: Setup cibuildwheel caching
uses: actions-ext/python/setup-cibuildwheel-cache@v1
with:
version: ${{ inputs.version }}

- name: Install cibuildwheel
run: pip install -U cibuildwheel
shell: bash
20 changes: 7 additions & 13 deletions setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,20 @@ inputs:
version:
type: choice
description: "Version to install"
options:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
options:
- '3.7'
- '3.8'
- '3.9'
- '3.10'
- '3.11'
default: '3.9'

runs:
using: 'composite'
steps:
##########
# Caches #
##########
################
- name: Setup Pip caching
uses: actions-ext/python/setup-cache@v1

###############################
# Language and Compiler Setup #
###############################
- name: Set up Python ${{ inputs.version }}
uses: actions/setup-python@v4
with:
Expand Down
6 changes: 3 additions & 3 deletions upload-dist/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ inputs:
kind:
type: choice
description: "Kind of asset to upload"
options:
- wheel
- sdist
options:
- wheel
- sdist

runs:
using: 'composite'
Expand Down

0 comments on commit f75d471

Please sign in to comment.