Skip to content
This repository was archived by the owner on Jan 10, 2022. It is now read-only.

Commit a105b94

Browse files
committed
Initial commit
0 parents  commit a105b94

40 files changed

+20426
-0
lines changed

.github/workflows/build-wheels.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/bin/bash
2+
set -e -x
3+
4+
# Install a system package required by our library
5+
yum install -y atlas-devel
6+
7+
# Compile wheels
8+
PYBIN=/opt/python/${PYABI}/bin
9+
cd /io
10+
"${PYBIN}/python" setup.py bdist_wheel
11+
12+
13+
# Bundle external shared libraries into the wheels
14+
for whl in dist/*.whl; do
15+
auditwheel repair "$whl" -w dist/
16+
done
17+
18+
rm dist/*-linux*.whl

.github/workflows/cd.yml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
tags:
6+
- '*'
7+
8+
jobs:
9+
build:
10+
runs-on: ${{ matrix.os }}
11+
strategy:
12+
fail-fast: false
13+
matrix:
14+
os: [ubuntu-latest, macOS-latest, windows-latest]
15+
python-version: [3.6]
16+
include:
17+
- { os: ubuntu-latest, python-version: 3.6, python-abis: "cp36-cp36m" }
18+
- { os: windows-latest, python-version: 3.6, build-static: 1 }
19+
20+
steps:
21+
- name: Check out code
22+
uses: actions/checkout@v2
23+
24+
- name: Set up conda ${{ matrix.python-version }}
25+
env:
26+
PYTHON: ${{ matrix.python-version }}
27+
shell: bash
28+
run: |
29+
source ./.github/workflows/install-conda.sh
30+
31+
- name: Deploy packages
32+
if: startsWith(github.ref, 'refs/tags/') && matrix.no-deploy != '1'
33+
shell: bash
34+
env:
35+
DOCKER_IMAGE: "quay.io/pypa/manylinux1_x86_64"
36+
PYABI: ${{ matrix.python-abis }}
37+
BUILD_STATIC: ${{ matrix.build-static }}
38+
PYPI_PWD: ${{ secrets.PYPI_PASSWORD }}
39+
run: |
40+
source ./.github/workflows/reload-env.sh
41+
source ./.github/workflows/upload-packages.sh

.github/workflows/install-conda.sh

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
#!/bin/bash
2+
PYTHON=$(cut -d '-' -f 1 <<< "$PYTHON")
3+
UNAME="$(uname | awk '{print tolower($0)}')"
4+
FILE_EXT="sh"
5+
if [[ "$UNAME" == "darwin" ]]; then
6+
set -e
7+
ulimit -n 1024
8+
CONDA_OS="MacOSX"
9+
elif [[ $UNAME == "linux" ]]; then
10+
sudo apt-get install -y liblz4-dev
11+
CONDA_OS="Linux"
12+
elif [[ $UNAME == "mingw"* ]] || [[ $UNAME == "msys"* ]]; then
13+
CONDA_OS="Windows"
14+
FILE_EXT="exe"
15+
fi
16+
17+
CONDA_FILE="Miniconda3-latest-${CONDA_OS}-x86_64.${FILE_EXT}"
18+
19+
TEST_PACKAGES="virtualenv psutil pyyaml"
20+
21+
if [[ "$FILE_EXT" == "sh" ]]; then
22+
curl -L -o "miniconda.${FILE_EXT}" https://repo.continuum.io/miniconda/$CONDA_FILE
23+
bash miniconda.sh -b -p $HOME/miniconda && rm -f miniconda.*
24+
CONDA_BIN_PATH=$HOME/miniconda/bin
25+
TEST_PACKAGES="$TEST_PACKAGES nomkl libopenblas"
26+
export PATH="$HOME/miniconda/envs/test/bin:$HOME/miniconda/bin:$PATH"
27+
else
28+
CONDA=$(echo "/$CONDA" | sed -e 's/\\/\//g' -e 's/://')
29+
echo "Using installed conda at $CONDA"
30+
CONDA_BIN_PATH=$CONDA/Scripts
31+
export PATH="$CONDA/envs/test/Scripts:$CONDA/envs/test:$CONDA/Scripts:$CONDA:$PATH"
32+
fi
33+
$CONDA_BIN_PATH/conda create --quiet --yes -n test python=$PYTHON $TEST_PACKAGES
34+
35+
#check python version
36+
export PYTHON=$(python -c "import sys; print('.'.join(str(v) for v in sys.version_info[:3]))")
37+
echo "Installed Python version: $PYTHON"

.github/workflows/reload-env.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/bin/bash
2+
3+
export UNAME="$(uname | awk '{print tolower($0)}')"
4+
export PYTEST_CONFIG="--log-level=DEBUG --cov-report= --cov=mars --timeout=1500 -W ignore::PendingDeprecationWarning"
5+
6+
if [[ "$GITHUB_REF" =~ ^"refs/tags/" ]]; then
7+
export GITHUB_TAG_REF="$GITHUB_REF"
8+
unset CYTHON_TRACE
9+
export GIT_TAG=$(echo "$GITHUB_REF" | sed -e "s/refs\/tags\///g")
10+
fi
11+
12+
if [[ $UNAME == "mingw"* ]] || [[ $UNAME == "msys"* ]]; then
13+
export UNAME="windows"
14+
CONDA=$(echo "/$CONDA" | sed -e 's/\\/\//g' -e 's/://')
15+
export PATH="$CONDA/Library:$CONDA/Library/bin:$CONDA/Scripts:$CONDA:$PATH"
16+
export PATH="$CONDA/envs/test/Library:$CONDA/envs/test/Library/bin:$CONDA/envs/test/Scripts:$CONDA/envs/test:$PATH"
17+
else
18+
export CONDA="$HOME/miniconda"
19+
export PATH="$HOME/miniconda/envs/test/bin:$HOME/miniconda/bin:$PATH"
20+
fi
21+
22+
export PYTHON=$(python -c "import sys; print('.'.join(str(v) for v in sys.version_info[:3]))")
23+
24+
if [ $UNAME == "darwin" ]; then
25+
export CC="gcc-10"
26+
fi
27+
28+
function retry {
29+
retrial=5
30+
if [ $1 == "-n" ]; then
31+
retrial=$2
32+
shift; shift
33+
fi
34+
r=0
35+
while true; do
36+
r=$((r+1))
37+
if [ "$r" -ge $retrial ]; then
38+
$@
39+
return $?
40+
else
41+
$@ && break || true
42+
sleep 1
43+
fi
44+
done
45+
}
46+
alias pip="retry pip"
47+
shopt -s expand_aliases
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
#!/bin/bash
2+
set -e
3+
4+
if [ -z "$GITHUB_TAG_REF" ]; then
5+
echo "Not on a tag, won't deploy to pypi"
6+
elif [ -n "$NO_DEPLOY" ]; then
7+
echo "Not on a build config, won't deploy to pypi"
8+
else
9+
git clean -f -x
10+
source activate test
11+
12+
if [ "$UNAME" = "linux" ]; then
13+
conda create --quiet --yes -n wheel python=$PYTHON
14+
conda activate wheel
15+
16+
docker pull $DOCKER_IMAGE
17+
pyabis=$(echo $PYABI | tr ":" "\n")
18+
for abi in $pyabis; do
19+
git clean -f -x
20+
docker run --rm -e "PYABI=$abi" -e "GIT_TAG=$GIT_TAG" -v `pwd`:/io \
21+
$DOCKER_IMAGE $PRE_CMD /io/.github/workflows/build-wheels.sh
22+
sudo chown -R $(id -u):$(id -g) ./*
23+
mv dist/*.whl /tmp
24+
done
25+
mv /tmp/*.whl dist/
26+
27+
conda activate test
28+
else
29+
conda create --quiet --yes -n wheel python=$PYTHON
30+
conda activate wheel
31+
32+
pip wheel --no-deps .
33+
34+
conda activate test
35+
36+
mkdir -p dist
37+
cp *.whl dist/
38+
39+
if [[ "$UNAME" == "darwin" ]]; then
40+
pip install delocate
41+
delocate-wheel dist/*.whl
42+
delocate-addplat --rm-orig -x 10_9 -x 10_10 dist/*.whl
43+
fi
44+
fi
45+
46+
if [ -n "$BUILD_STATIC" ]; then
47+
python setup.py sdist --formats=gztar
48+
fi
49+
50+
echo ""
51+
echo "Generated files:"
52+
ls dist/
53+
echo ""
54+
55+
if [[ "$GITHUB_REPOSITORY" == "mars-project/shared_memory38" ]]; then
56+
PYPI_REPO="https://upload.pypi.org/legacy/"
57+
else
58+
PYPI_REPO="https://test.pypi.org/legacy/"
59+
fi
60+
61+
echo "[distutils]" > ~/.pypirc
62+
echo "index-servers =" >> ~/.pypirc
63+
echo " pypi" >> ~/.pypirc
64+
echo "[pypi]" >> ~/.pypirc
65+
echo "repository=$PYPI_REPO" >> ~/.pypirc
66+
echo "username=pyodps" >> ~/.pypirc
67+
echo "password=$PYPI_PWD" >> ~/.pypirc
68+
69+
python -m pip install twine
70+
python -m twine upload -r pypi --skip-existing dist/*
71+
fi

.gitignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
*.py[cod]
2+
3+
# C extensions
4+
*.so
5+
6+
# sqlite3 db files
7+
*.db
8+
9+
# Packages
10+
*.egg
11+
*.egg-info
12+
dist
13+
build/
14+
eggs
15+
parts
16+
var
17+
sdist
18+
develop-eggs
19+
.installed.cfg
20+
lib64
21+
__pycache__
22+
23+
# Unit test / coverage reports
24+
.coverage
25+
.coverage.*
26+
htmlcov
27+
.tox
28+
nosetests.xml
29+
.cache
30+
.pytest*
31+
.dist-coverage
32+
test.conf
33+
34+
# IDEs
35+
.idea
36+
.vscode
37+
*.iml
38+
39+
# Generated files
40+
**/clinic/*.h

0 commit comments

Comments
 (0)