forked from fastavro/fastavro
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (82 loc) · 3.09 KB
/
build_linux.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Build
on:
create:
push:
branches:
- '**'
pull_request:
schedule:
- cron: "0 8 * * *"
jobs:
test:
name: test ${{ matrix.py }} - ubuntu
runs-on: ubuntu-latest
strategy:
matrix:
py:
- 3.9
- 3.8
- 3.7
- 3.6
- pypy3
steps:
- name: Setup Python for test ${{ matrix.py }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.py }}
- name: Install OS dependencies
run: sudo apt-get install -y libsnappy-dev && pip install python-snappy
- uses: actions/checkout@v2
- name: Downgrade pip
# https://github.com/psf/black/issues/1847
run: pip install "pip<20.3"
- name: Install Testing Dependencies
run: pip install -r developer_requirements.txt
- name: Run Tests
run: SKIP_BLACK="1" ./run-tests.sh && codecov
- name: Make Wheel
if: ${{ matrix.py == '3.9' }}
uses: RalfG/python-wheels-manylinux-build@v0.3.2-manylinux2014_x86_64
with:
build-requirements: 'cython'
python-versions: 'cp36-cp36m cp37-cp37m cp38-cp38 cp39-cp39'
- name: Archive wheels
if: ${{ matrix.py == '3.9' }}
uses: actions/upload-artifact@v2
with:
name: linux-wheels
path: dist/*-manylinux*.whl
if-no-files-found: error
- name: Make release
if: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' && matrix.py == '3.9' }}
continue-on-error: true
run: |
curl -X POST -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{github.repository}}/releases -d '{"tag_name": "${{github.event.ref}}"}'
- name: Get release id
if: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' && matrix.py == '3.9' }}
id: get_release_id
run: |
release_id=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" https://api.github.com/repos/${{github.repository}}/releases/tags/${{github.event.ref}} | jq -r '.id')
echo ${release_id}
echo "release_id=${release_id}" >> $GITHUB_ENV
# https://github.com/actions/upload-release-asset/issues/47#issuecomment-659071145
- name: Push wheels to repo release
if: ${{ github.event_name == 'create' && github.event.ref_type == 'tag' && matrix.py == '3.9' }}
uses: actions/github-script@v2
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const fs = require('fs').promises;
const { repo: { owner, repo }, sha } = context;
console.log({ owner, repo, sha });
for (let file of await fs.readdir('dist')) {
if (file.includes('manylinux')) {
console.log('uploading', file);
await github.repos.uploadReleaseAsset({
owner, repo,
release_id: ${{ env.release_id }},
name: file,
data: await fs.readFile(`dist/${file}`)
});
}
}