Skip to content

Commit 4165907

Browse files
committed
Add support for GitHub Actions
Closes #159
1 parent c22d504 commit 4165907

File tree

7 files changed

+83
-11
lines changed

7 files changed

+83
-11
lines changed

.github/workflows/test.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Test
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Test cibuildwheel on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-18.04, windows-latest, macos-latest]
12+
python_version: ['3.7']
13+
steps:
14+
- uses: actions/checkout@v1
15+
- uses: actions/setup-python@v1
16+
name: Install Python ${{ matrix.python_version }}
17+
with:
18+
python-version: ${{ matrix.python_version }}
19+
20+
- name: Install dependencies
21+
run: |
22+
python -m pip install -r requirements-dev.txt
23+
- name: Install Visual C++ for Python 2.7
24+
if: startsWith(matrix.os, 'windows')
25+
run: |
26+
choco install vcpython27 -f -y
27+
- name: Test cibuildwheel
28+
run: |
29+
python ./bin/run_tests.py

CI.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
This is a summary of the Python versions and platforms covered by the different CI platforms:
22

3-
| | 3.5 | 3.6 | 3.7 | 3.8 |
4-
|----------|------------------|------------------|-----------------------|------------------|
5-
| Linux | Travis CI | CircleCI | AppVeyor | Azure Pipelines |
6-
| macOS | Azure Pipelines | CircleCI | Travis CI¹ / CircleCI | Azure Pipelines |
7-
| Windows | TravisCI | Azure Pipelines | AppVeyor | Azure Pipelines |
3+
| | 3.5 | 3.6 | 3.7 | 3.8 |
4+
|----------|------------------|------------------|---------------------------------------------------|------------------|
5+
| Linux | Travis CI | CircleCI | AppVeyor / GitHub Actions | Azure Pipelines |
6+
| macOS | Azure Pipelines | CircleCI | AppVeyor / Travis CI¹ / CircleCI / GitHub Actions | Azure Pipelines |
7+
| Windows | TravisCI | Azure Pipelines | AppVeyor / GitHub Actions | Azure Pipelines |
88

99
> ¹ Python version not really pinned, but dependent on the (default) version of image used.
1010

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ cibuildwheel
99

1010
Python wheels are great. Building them across **Mac, Linux, Windows**, on **multiple versions of Python**, is not.
1111

12-
`cibuildwheel` is here to help. `cibuildwheel` runs on your CI server - currently it supports Azure Pipelines, Travis CI, AppVeyor, and CircleCI - and it builds and tests your wheels across all of your platforms.
12+
`cibuildwheel` is here to help. `cibuildwheel` runs on your CI server - currently it supports Azure Pipelines, Travis CI, AppVeyor, GitHub Actions and CircleCI - and it builds and tests your wheels across all of your platforms.
1313

1414

1515
What does it do?
@@ -35,13 +35,14 @@ What does it do?
3535
Usage
3636
-----
3737

38-
`cibuildwheel` currently works on **Travis CI**, **Azure Pipelines** and **AppVeyor** to build wheels for all three supported platforms (Linux, macOS, Windows). On **CircleCI** Linux and macOS wheels can be built.
38+
`cibuildwheel` currently works on **Travis CI**, **Azure Pipelines**, **AppVeyor** and **GitHub Actions** to build wheels for all three supported platforms (Linux, macOS, Windows). On **CircleCI** Linux and macOS wheels can be built.
3939

4040
| | Linux | macOS | Windows |
4141
|-----------------|-------|-------|---------|
4242
| Azure Pipelines ||||
4343
| Travis CI ||||
4444
| AppVeyor ||||
45+
| GitHub Actions ||||
4546
| CircleCI ||| |
4647

4748
`cibuildwheel` is not intended to run on your development machine. Because it uses system Python from Python.org it will try to install packages globally - not what you expect from a build tool! Instead, isolated CI services like Travis CI, CircleCI, Azure Pipelines and AppVeyor are ideal.

cibuildwheel/__main__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ def main():
7777
if args.platform != 'auto':
7878
platform = args.platform
7979
else:
80-
ci = strtobool(os.environ.get('CI', 'false')) or 'BITRISE_BUILD_NUMBER' in os.environ or 'AZURE_HTTP_USER_AGENT' in os.environ
80+
ci = strtobool(os.environ.get('CI', 'false')) or 'BITRISE_BUILD_NUMBER' in os.environ or 'AZURE_HTTP_USER_AGENT' in os.environ or 'GITHUB_WORKFLOW' in os.environ
8181
if not ci:
8282
print('cibuildwheel: Unable to detect platform. cibuildwheel should run on your CI server, '
83-
'Travis CI, AppVeyor, Azure Pipelines and CircleCI are supported. You can run on your '
84-
'development machine or other CI providers using the --platform argument. Check --help '
85-
'output for more information.',
83+
'Travis CI, AppVeyor, Azure Pipelines, GitHub Actions and CircleCI are supported. You '
84+
'can run on your development machine or other CI providers using the --platform argument. '
85+
'Check --help output for more information.',
8686
file=sys.stderr)
8787
exit(2)
8888
if sys.platform.startswith('linux'):

docs/setup.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,19 @@ AppVeyor will store the built wheels for you - you can access them from the proj
6565

6666
For more info on this config file, check out the [docs](https://www.appveyor.com/docs/).
6767

68+
# GitHub Actions [linux/mac/windows] {: #github-actions}
69+
70+
Using GitHub Actions, you can build all three platforms on the same service. Create a `./github/workflows/build.yml` file in your repo.
71+
72+
> build.yml
73+
```yaml
74+
{% include "../examples/github-minimal.yml" %}
75+
```
76+
77+
Commit this file, enable building of your repo on GitHub Actions, and push.
78+
79+
For more info on this file, check out the [docs](https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions).
80+
6881
> ⚠️ Got an error? Check the [FAQ](faq.md).
6982
7083
<script>

examples/github-minimal.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Build
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
name: Build wheel on ${{ matrix.os }}
8+
runs-on: ${{ matrix.os }}
9+
strategy:
10+
matrix:
11+
os: [ubuntu-18.04, windows-latest, macos-latest]
12+
steps:
13+
- uses: actions/checkout@v1
14+
- uses: actions/setup-python@v1
15+
name: Install Python
16+
with:
17+
python-version: '3.7'
18+
19+
- name: Install cibuildwheel
20+
run: |
21+
python -m pip install cibuildwheel==1.2.0
22+
- name: Install Visual C++ for Python 2.7
23+
if: startsWith(matrix.os, 'windows')
24+
run: |
25+
choco install vcpython27 -f -y
26+
- name: Build wheel
27+
run: |
28+
python -m cibuildwheel --output-dir wheelhouse

unit_test/main_tests/main_platform_test.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ def test_unknown_platform_non_ci(monkeypatch, capsys):
1111
monkeypatch.delenv('CI', raising=False)
1212
monkeypatch.delenv('BITRISE_BUILD_NUMBER', raising=False)
1313
monkeypatch.delenv('AZURE_HTTP_USER_AGENT', raising=False)
14+
monkeypatch.delenv('GITHUB_WORKFLOW', raising=False)
1415

1516
with pytest.raises(SystemExit) as exit:
1617
main()

0 commit comments

Comments
 (0)