|
1 | 1 | name: Build wheels
|
2 | 2 |
|
3 |
| -on: |
4 |
| - push: |
5 |
| - branches: [master] |
6 |
| - tags: ['*'] |
| 3 | +on: [push, pull_request] |
7 | 4 |
|
8 | 5 | jobs:
|
9 | 6 | build_wheels:
|
|
32 | 29 | CIBW_SKIP: "*-manylinux_i686 *-win32"
|
33 | 30 | CIBW_ARCHS_MACOS: "x86_64 arm64"
|
34 | 31 | CIBW_BUILD_VERBOSITY: 1
|
| 32 | + CIBW_BEFORE_TEST: pip install pytest |
| 33 | + CIBW_TEST_COMMAND: pytest {package} |
35 | 34 | run: |
|
36 | 35 | python -m cibuildwheel --output-dir wheelhouse .
|
37 | 36 | - uses: actions/upload-artifact@v2
|
|
60 | 59 | name: dist
|
61 | 60 | path: |
|
62 | 61 | dist/*.tar.gz
|
63 |
| - release: |
64 |
| - name: create release |
65 |
| - needs: [build_wheels, build_sdist_python_wheel] |
66 |
| - runs-on: ubuntu-latest |
67 |
| - steps: |
68 |
| - - name: Download artifact |
69 |
| - uses: actions/download-artifact@v2 |
70 |
| - with: |
71 |
| - name: dist |
72 |
| - path: dist |
73 |
| - - name: Release |
74 |
| - # https://github.com/actions/upload-release-asset/issues/47 |
75 |
| - uses: actions/github-script@v2 |
76 |
| - with: |
77 |
| - github-token: ${{secrets.GITHUB_TOKEN}} |
78 |
| - script: | |
79 |
| - const fs = require('fs').promises; |
80 |
| - const { repo: { owner, repo }, sha } = context; |
81 |
| -
|
82 |
| - console.log('environment', process.versions); |
83 |
| - console.log({ owner, repo, sha }); |
84 |
| -
|
85 |
| - const release = await github.repos.createRelease({ |
86 |
| - owner, repo, |
87 |
| - // if GITHUB_REF just appears to be a branch, use tag-{commit} as the tag |
88 |
| - tag_name: process.env.GITHUB_REF.includes("refs/heads/") ? "tag-" + sha : process.env.GITHUB_REF.split("/").pop(), |
89 |
| - target_commitish: sha |
90 |
| - }); |
91 |
| -
|
92 |
| - console.log('created release', { release }); |
93 |
| -
|
94 |
| - for (let file of await fs.readdir('dist')) { |
95 |
| - console.log('uploading', file); |
96 |
| -
|
97 |
| - await github.repos.uploadReleaseAsset({ |
98 |
| - owner, repo, |
99 |
| - release_id: release.data.id, |
100 |
| - name: file, |
101 |
| - data: await fs.readFile(`./dist/${file}`) |
102 |
| - }); |
103 |
| - } |
0 commit comments