Skip to content

Commit

Permalink
Merge pull request #45 from opendilab/test/release
Browse files Browse the repository at this point in the history
test(hansbug): try add cibuildwheel && first complete the try_release part && move it out && remove benchmark from unittest
  • Loading branch information
HansBug committed Jun 20, 2022
2 parents 1e76f03 + d2f367e commit ee2a552
Show file tree
Hide file tree
Showing 8 changed files with 231 additions and 118 deletions.
103 changes: 94 additions & 9 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@ on:
types: [ published ]

jobs:
release:
name: Publish to official pypi
source_release:
name: Publish source package to official pypi
runs-on: ${{ matrix.os }}
if: ${{ github.repository == 'opendilab/treevalue' }}
strategy:
matrix:
os:
- 'ubuntu-18.04'
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'

steps:
- name: Checkout code
Expand All @@ -39,10 +35,99 @@ jobs:
pip install --upgrade build
- name: Build packages
run: |
make package
make zip
- name: Publish distribution 📦 to real PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_PASSWORD }}
skip_existing: true
verbose: true
verbose: true
- name: Upload distribution 📦 to github release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: dist/*
tag: ${{ github.ref }}
file_glob: true


wheel_release:
name: Try build the wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
# - 'windows-2019'
- 'macos-10.15'
python:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
architecture:
- x86_64
- arm64
- aarch64
- x86
- AMD64
exclude:
- os: ubuntu-18.04
architecture: arm64
- os: ubuntu-18.04
architecture: x86
- os: ubuntu-18.04
architecture: AMD64
- os: windows-2019
architecture: x86_64
- os: windows-2019
architecture: arm64
- os: windows-2019
architecture: aarch64
- os: macos-10.15
architecture: aarch64
- os: macos-10.15
architecture: x86
- os: macos-10.15
architecture: AMD64
- python: '3.6'
architecture: arm64
- python: '3.7'
architecture: arm64

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 20

- name: Set up QEMU
if: ${{ runner.os == 'Linux' }}
uses: docker/setup-qemu-action@v1
with:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.7.0
env:
CIBW_SKIP: "pp* *musllinux*"
CIBW_ARCHS: ${{ matrix.architecture }}
CIBW_PROJECT_REQUIRES_PYTHON: ~=${{ matrix.python }}.0

- name: Show the buildings
shell: bash
run: |
ls -al ./wheelhouse
- name: Publish distribution 📦 to real PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_PASSWORD }}
verbose: true
packages_dir: wheelhouse/
- name: Upload distribution 📦 to github release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: wheelhouse/*
tag: ${{ github.ref }}
file_glob: true
83 changes: 80 additions & 3 deletions .github/workflows/release_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,46 @@ name: Release Test
on: workflow_dispatch

jobs:
release_test:
name: Try build the release
source_release:
name: Try package the source
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
python-version:
- '3.8'

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 20
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up python dependences
run: |
pip install --upgrade pip
pip install --upgrade flake8 setuptools wheel twine
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-build.txt ]; then pip install -r requirements-build.txt; fi
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
pip install --upgrade build
- name: Build packages
run: |
make zip
ls -al dist
- name: Upload packed files to artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts-source-pack
path: ./dist/*

wheel_release:
name: Try build the wheels
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand All @@ -13,6 +51,41 @@ jobs:
- 'ubuntu-18.04'
# - 'windows-2019'
- 'macos-10.15'
python:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'
architecture:
- x86_64
- arm64
- aarch64
- x86
- AMD64
exclude:
- os: ubuntu-18.04
architecture: arm64
- os: ubuntu-18.04
architecture: x86
- os: ubuntu-18.04
architecture: AMD64
- os: windows-2019
architecture: x86_64
- os: windows-2019
architecture: arm64
- os: windows-2019
architecture: aarch64
- os: macos-10.15
architecture: aarch64
- os: macos-10.15
architecture: x86
- os: macos-10.15
architecture: AMD64
- python: '3.6'
architecture: arm64
- python: '3.7'
architecture: arm64

steps:
- name: Checkout code
Expand All @@ -27,6 +100,10 @@ jobs:
platforms: all
- name: Build wheels
uses: pypa/cibuildwheel@v2.7.0
env:
CIBW_SKIP: "pp* *musllinux*"
CIBW_ARCHS: ${{ matrix.architecture }}
CIBW_PROJECT_REQUIRES_PYTHON: ~=${{ matrix.python }}.0

- name: Show the buildings
shell: bash
Expand All @@ -35,5 +112,5 @@ jobs:
- name: Upload packed files to artifacts
uses: actions/upload-artifact@v2
with:
name: build-artifacts-${{ matrix.os }}
name: build-artifacts-${{ runner.os }}-cp${{ matrix.python }}-${{ matrix.architecture }}
path: ./wheelhouse/*
2 changes: 1 addition & 1 deletion .github/workflows/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Code Script Run

on:
push:
branches: [ main, 'dev/*', 'run/*' ]
branches: [ 'run/*' ]

jobs:
unittest:
Expand Down
109 changes: 6 additions & 103 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
name: Code Test

on:
- push
push:
branches:
- main
- dev/*
- fix/*
- test/*

jobs:
unittest:
Expand Down Expand Up @@ -113,105 +118,3 @@ jobs:
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false

benchmark:
name: Benchmark Test
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 20
- name: Set up system dependences on linux
if: ${{ runner.os == 'Linux' }}
run: |
sudo apt-get update
sudo apt-get install -y tree cloc wget curl make graphviz
sudo apt-get install -y libxml2-dev libxslt-dev python-dev # need by pypy3
dot -V
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install --upgrade flake8 setuptools wheel twine
pip install -r requirements.txt
pip install -r requirements-build.txt
pip install -r requirements-test.txt
pip install -r requirements-benchmark.txt
./install_test.sh
- name: Test the basic environment
run: |
python -V
pip --version
pip list
tree .
cloc treevalue
cloc test
- name: Run benckmark
env:
CI: 'true'
run: |
make clean build benchmark compare
try_release:
name: Try build the release
runs-on: ${{ matrix.os }}
if: "!contains(github.event.head_commit.message, 'ci skip')"
strategy:
fail-fast: false
matrix:
os:
- 'ubuntu-18.04'
python-version:
- '3.6'
- '3.7'
- '3.8'
- '3.9'
- '3.10'

steps:
- name: Checkout code
uses: actions/checkout@v2
with:
fetch-depth: 20
- name: Set up python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Set up python dependences
run: |
pip install --upgrade pip
pip install --upgrade flake8 setuptools wheel twine
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
if [ -f requirements-build.txt ]; then pip install -r requirements-build.txt; fi
if [ -f requirements-test.txt ]; then pip install -r requirements-test.txt; fi
pip install --upgrade build
- name: Build packages
run: |
make package
ls -al dist
- name: Get package version
run: |
make build
python -c 'from treevalue.config.meta import __VERSION__;print(__VERSION__)'
echo "PACKAGE_VERSION=$(python -c 'from treevalue.config.meta import __VERSION__;print(__VERSION__)')" >> $GITHUB_ENV
- uses: actions/upload-artifact@v2
with:
name: treevalue-v${{ env.PACKAGE_VERSION }}-${{ matrix.os }}-${{ matrix.python-version }}
path: dist
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: docs test unittest build clean benchmark
.PHONY: docs test unittest build clean benchmark zip

PYTHON := $(shell which python)

Expand All @@ -24,6 +24,9 @@ build:
$(PYTHON) setup.py build_ext --inplace \
$(if ${LINETRACE},--define CYTHON_TRACE,)

zip:
$(PYTHON) -m build --sdist --outdir ${DIST_DIR}

package:
$(PYTHON) -m build --sdist --wheel --outdir ${DIST_DIR}
for whl in `ls ${DIST_DIR}/*.whl`; do \
Expand Down

0 comments on commit ee2a552

Please sign in to comment.