From c80772a160029ae5a6c795b47d7e383d3e6c8eb4 Mon Sep 17 00:00:00 2001 From: nicolargo Date: Tue, 20 Apr 2021 10:09:31 +0200 Subject: Replace Travis by Github action #1850 --- .github/workflows/build.yml | 49 +++++++++++++++++++++++++++++++++++++++++++++ .github/workflows/main.yml | 36 +++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 37 ++++++++++++++++++++++++++++++++++ 3 files changed, 122 insertions(+) create mode 100644 .github/workflows/build.yml create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..1edc760a --- /dev/null +++ b/.github/workflows/build.yml @@ -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 diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d58e3e41..e281a2ad 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 }} \ No newline at end of file diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 00000000..cf9f5943 --- /dev/null +++ b/.github/workflows/test.yml @@ -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 -- cgit v1.2.3