Skip to content

Commit

Permalink
Merge pull request #4 from megvii-research/update-actions
Browse files Browse the repository at this point in the history
Update actions
  • Loading branch information
bbtfr authored Aug 24, 2021
2 parents d7e22fc + 11b0e4d commit 8770c0a
Show file tree
Hide file tree
Showing 4 changed files with 47 additions and 23 deletions.
35 changes: 27 additions & 8 deletions .github/workflows/on-push.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: build
on:
on:
workflow_dispatch:
push:

Expand All @@ -10,31 +10,50 @@ jobs:
matrix:
os: [ubuntu-18.04]
python-version: [3.6, 3.7, 3.8, 3.9]

steps:
- name: Checkout Github Repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
- name: Set up Golang
uses: actions/setup-go@v2
- name: Cache Pip
id: pip-cache
uses: actions/cache@v2
with:
path: /opt/hostedtoolcache/Python
key: ${{ matrix.os }}-python${{ matrix.python-version }}-pip-${{ hashFiles('requirements.txt') }}-${{ hashFiles('requirements-dev.txt') }}
restore-keys: |
${{ matrix.os }}-pip-
${{ matrix.os }}-
- name: Install package dependencies
- name: Install Package Dependencies
if: steps.pip-cache.outputs.cache-hit != 'true'
run: |
python -m pip install --upgrade pip
pip install -r requirements-dev.txt
pip install -r requirements.txt
python -c "import pytest;print(pytest.__file__)"
python -c "import pytest; print(pytest.__file__)"
pip show isort
- name: Get JuiceFS Version
id: jfs-version
run: echo "::set-output name=JUICEFS_VERSION::$(make -s print_libjfs_version)"
- name: Cache libjfs
id: libjfs-cache
uses: actions/cache@v2
with:
path: /opt/hostedtoolcache/Golang/libjfs
key: ${{ matrix.os }}-golang-libjfs${{ steps.jfs-version.outputs.JUICEFS_VERSION }}
- name: Run build-libjfs
if: steps.libjfs-cache.outputs.cache-hit != 'true'
run: |
make build_libjfs
mkdir -p /opt/hostedtoolcache/Golang/libjfs
mv juicefs/lib/juicefs /opt/hostedtoolcache/Golang/libjfs/juicefs
mv juicefs/lib/libjfs.so /opt/hostedtoolcache/Golang/libjfs/libjfs.so
- name: Link libjfs
run: |
ln -s /opt/hostedtoolcache/Golang/libjfs/juicefs juicefs/lib/juicefs
ln -s /opt/hostedtoolcache/Golang/libjfs/libjfs.so juicefs/lib/libjfs.so
- name: Run style-check
run: |
make style_check
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,7 @@ __pycache__/
.coverage
html_cov/
html_doc/

juicefs/lib/juicefs
juicefs/lib/libjfs.so
wheelhouse/
28 changes: 14 additions & 14 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,20 @@ JUICEFS_VERSION := 0.14.2
clean:
rm -rf dist build *.egg-info .pytype .pytest_cache .pytype_output

build_juicefs:
rm -rf build && mkdir build
cd build \
&& wget https://github.com/juicedata/juicefs/releases/download/v${JUICEFS_VERSION}/juicefs-${JUICEFS_VERSION}-linux-amd64.tar.gz \
&& tar -zxf juicefs-${JUICEFS_VERSION}-linux-amd64.tar.gz \
&& cp juicefs ../juicefs/lib/juicefs

build_libjfs:
rm -rf build && mkdir build
cd build \
&& wget https://github.com/juicedata/juicefs/archive/refs/tags/v${JUICEFS_VERSION}.zip \
&& unzip v${JUICEFS_VERSION}.zip \
&& cd juicefs-${JUICEFS_VERSION}/sdk/java/libjfs \
&& unzip v${JUICEFS_VERSION}.zip
cd build/juicefs-${JUICEFS_VERSION}/sdk/java/libjfs \
&& make libjfs.so \
&& cp libjfs.so ../../../../../juicefs/lib/libjfs.so
cd build/juicefs-${JUICEFS_VERSION} \
&& make juicefs \
&& cp juicefs ../../juicefs/lib/juicefs

print_libjfs_version:
echo ${JUICEFS_VERSION}

build_wheel:
python3 setup.py bdist_wheel
Expand All @@ -43,12 +42,13 @@ doc:
python3 setup.py build_sphinx --fresh-env --build-dir html_doc/

release:
git tag ${VERSION}
git push origin ${VERSION}
# git tag ${VERSION}
# git push origin ${VERSION}

rm -rf build dist
python3 setup.py bdist_wheel
auditwheel repair --plat manylinux2014_x86_64 dist/${PACKAGE}-${VERSION}-py3-none-any.whl

# devpi login ${PYPI_USERNAME} --password=${PYPI_PASSWORD}
# devpi upload dist/${PACKAGE}-${VERSION}-py3-none-any.whl
twine upload dist/${PACKAGE}-${VERSION}-py3-none-any.whl --username=${PYPI_USERNAME_2} --password=${PYPI_PASSWORD_2}
devpi login ${PYPI_USERNAME} --password=${PYPI_PASSWORD}
devpi upload wheelhouse/${PACKAGE}-${VERSION}-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
twine upload wheelhouse/${PACKAGE}-${VERSION}-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl --username=${PYPI_USERNAME_2} --password=${PYPI_PASSWORD_2}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,11 @@ Clone the repository:
git clone [email protected]:megvii-research/juicefs-python.git
```

And then install requirements:
And then build `juicefs` and `libjfs.so` and install requirements:

```
cd juicefs-python
make build_juicefs
pip install -r requirements.txt
```

Expand Down

0 comments on commit 8770c0a

Please sign in to comment.