summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornicolargo <nicolas@nicolargo.com>2021-04-20 09:22:09 +0200
committernicolargo <nicolas@nicolargo.com>2021-04-20 09:22:09 +0200
commitaefc945fda308e441834e07463f925f32d0d3e40 (patch)
tree8025acc0007d80751b2f36038d3568baed6ee44f
parentea6c1c8b600c546fdcf52a359836ab2b72b78c18 (diff)
Add Github action for unitests
-rw-r--r--.github/workflows/build.yml4
-rw-r--r--.github/workflows/main.yml5
-rw-r--r--.github/workflows/test.yml37
3 files changed, 43 insertions, 3 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index be30b710..93115f57 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -1,9 +1,9 @@
# Executed on every push by GitHub Actions.
# This runs CI tests
-on: [push]
+name: wheels
-name: build
+on: [push]
jobs:
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index d36e25f1..5a3ee9d7 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -89,6 +89,7 @@ jobs:
steps:
- name: Install pypa/build
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: >-
python -m
pip install
@@ -96,6 +97,7 @@ jobs:
--user
- name: Build a binary wheel and a source tarball
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: >-
python -m
build
@@ -104,6 +106,7 @@ jobs:
--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 }}
@@ -111,7 +114,7 @@ jobs:
repository_url: https://test.pypi.org/legacy/
- name: Publish distribution package to PyPI
- if: startsWith(github.ref, 'refs/tags')
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@master
with:
user: ${{ secrets.PYPI_USERNAME }}
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
new file mode 100644
index 00000000..2bd63d03
--- /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