Replace Travis by Github action #1850

This commit is contained in:
nicolargo 2021-04-20 10:09:31 +02:00
parent a0f24a3b45
commit c80772a160
3 changed files with 122 additions and 0 deletions

49
.github/workflows/build.yml vendored Normal file
View File

@ -0,0 +1,49 @@
# Executed on every push by GitHub Actions.
# This runs CI tests
name: wheels
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.6.0
with:
access_token: ${{ github.token }}
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,./glances/outputs/static
- name: Build manylinux Python wheels
uses: RalfG/python-wheels-manylinux-build@v0.3.3-manylinux2010_x86_64
with:
python-versions: 'cp36-cp36m cp37-cp37m'
# build-requirements: 'cython'
system-packages: 'python-devel'
# pre-build-command: 'sh pre-build-script.sh'
pip-wheel-args: '-w ./dist --no-deps'
- name: Upload wheels
uses: actions/upload-artifact@v2
with:
name: wheels
path: dist

View File

@ -83,3 +83,39 @@ jobs:
platforms: ${{env.DOCKER_PLATFORMS}}
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache,mode=max
pypi:
runs-on: ubuntu-latest
steps:
- name: Install pip
if: github.event_name == 'push'
run: >-
python -m
pip install
build
--user
- name: Build a binary wheel and a source tarball
if: github.event_name == 'push'
run: >-
python -m
build
--sdist
--wheel
--outdir dist/
- name: Publish distribution package to Test PyPI
if: github.event_name == 'push'
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution package to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.PYPI_USERNAME }}
password: ${{ secrets.PYPI_API_TOKEN }}

37
.github/workflows/test.yml vendored Normal file
View File

@ -0,0 +1,37 @@
name: test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [2.7, 3.5, 3.6, 3.7, 3.8, 3.9]
steps:
- uses: actions/checkout@v2
- 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 flake8
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=.git,./glances/outputs/static
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=.git,./glances/outputs/static
- name: Unitary tests
run: |
python ./unitest.py