-
Notifications
You must be signed in to change notification settings - Fork 70
133 lines (123 loc) · 3.99 KB
/
python.yml
File metadata and controls
133 lines (123 loc) · 3.99 KB
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
---
name: Tensornet
on:
push:
branches:
- '**' # matches every branch
tags:
- 'v[0-9]+'
- 'v[0-9]+.[a-z0-9]+'
- 'v[0-9]+.[0-9]+.[a-z0-9]+'
- 'v[0-9]+.[0-9]+.[0-9]+.[a-z0-9]+'
pull_request:
env:
PIXI_LOCKED: "true"
OMPI_ALLOW_RUN_AS_ROOT: 1
OMPI_ALLOW_RUN_AS_ROOT_CONFIRM: 1
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.8.5
with:
pixi-version: v0.49.0
environments: tools
- name: pre-commit
run: ./pixiw run pre-commit-run --color=always --show-diff-on-failure
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.8.5
with:
pixi-version: v0.49.0
environments: default py35 py36 py37
- name: Build with debug profile
run: ./pixiw run build
- name: Verify that the dynamic libraries only requires glibc <= 2.12
run: |
err=0
objdump -T build/debug/libtensornet.so | grep GLIBC_ | grep -v '0000000000000000\s*w\s*DF' | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[012]\)[^0-9]' || err=$?
test $err = 1
err=0
objdump -T build/debug/_pywrap_tn.cpython-38-x86_64-linux-gnu.so | grep GLIBC_ | grep -v '0000000000000000\s*w\s*DF' | grep -v 'GLIBC_\([01]\|2\.[0-9]\|2\.1[012]\)[^0-9]' || err=$?
test $err = 1
create-wheel-cmake:
name: create wheel / cmake
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Set up pixi
uses: prefix-dev/setup-pixi@v0.8.5
with:
pixi-version: v0.49.0
environments: default py35 py36 py37 tools
- name: Create wheel
run: |
./pixiw run create-wheel
./pixiw run -e tools check-wheel-contents dist
grep -q '^tensornet$' qihoo_tensornet.egg-info/top_level.txt
ls -alh dist
- name: Store wheels
uses: actions/upload-artifact@v4
with:
path: dist/
retention-days: 7
create-wheel-bazel:
name: create wheel / bazel
runs-on: ubuntu-latest
env:
NEED_ACTIVATE_ENV: "false"
steps:
- uses: actions/checkout@v4
- uses: mamba-org/setup-micromamba@v1
with:
micromamba-version: '1.5.8-0'
environment-file: config/tn_build.yaml
init-shell: bash
cache-downloads: true
post-cleanup: 'none'
- name: Build the core library
run: |
set -e
./manager build
./manager copy-libs
rm -rf /home/runner/.cache/bazel # remove bazel cache to avoid job hang
shell: micromamba-shell {0}
- name: Create wheel
run: |
./manager create_dist
grep -q '^tensornet$' qihoo_tensornet.egg-info/top_level.txt
ls -alh dist
shell: micromamba-shell {0}
publish-to-pypi:
name: Upload to pypi
if: github.repository == 'Qihoo360/tensornet' && startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
needs:
- create-wheel-cmake
runs-on: ubuntu-latest
permissions:
id-token: write # mandatory for pypi trusted publishing
contents: write # mandatory for create a github release
steps:
- name: Download wheels
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: dist/
- name: Publish wheels to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
# push v*.rc* tags to test.pypi.org
repository-url: ${{ contains(github.ref, '.rc') && 'https://test.pypi.org/legacy/' || 'https://upload.pypi.org/legacy/'
}}
print-hash: true
- name: Create a draft release
uses: softprops/action-gh-release@v2
with:
draft: true
prerelease: ${{ contains(github.ref, '.rc') }}
generate_release_notes: true