Add analyze segment - thanks to @ksunden

This commit is contained in:
Ogi Moore 2020-12-22 12:48:36 -08:00
parent fcb387c86e
commit cc6a4d200c
3 changed files with 85 additions and 16 deletions

55
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,55 @@
name: analyze pyqtgraph
on: pull_request
jobs:
analyze:
name: analyze
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install PyQt5 numpy scipy six
echo "CODEQL_PYTHON=$(which python)" >> $GITHUB_ENV
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: 'python'
# Supported options are ['csharp', 'cpp', 'go', 'java', 'javascript', 'python']
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
queries: +security-and-quality
setup-python-dependencies: false
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -1,9 +1,9 @@
name: test pyqtgraph
on: [push]
on: [push, pull_request]
jobs:
build:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
@ -82,41 +82,54 @@ jobs:
if: runner.os != 'Linux'
- name: Run Tests
run: |
mkdir $SCREENSHOT_DIR
pytest . -v \
-n auto \
--junitxml=junit/test-results.xml \
--cov pyqtgraph --cov-report=xml --cov-report=html
shell: bash
env:
AZURE: 1
- name: Upload Screenshots
uses: actions/upload-artifact@v2
with:
name: Screenshots (Python ${{ matrix.python-version }} - Qt-Bindings ${{ matrix.qt-lib }} - OS ${{ matrix.os }})
path: $SCREENSHOT_DIR
if-no-files-found: ignore
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
with:
name: Unit Test Results (Python ${{ matrix.python-version }} - Qt-Bindings ${{ matrix.qt-lib }} - OS ${{ matrix.os }})
path: junit/test-results.xml
env:
SCREENSHOT_DIR: ./screenshots
build-docs:
# Name the Job
name: Build Docs
# Set the type of machine to run on
name: build docs
runs-on: ubuntu-latest
steps:
# Checks out a copy of your repository on the ubuntu-latest machine
- uses: actions/checkout@v2
- name: Setup Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Build Docs
- name: Install Dependencies
run: |
cd doc
python -m pip install -r requirements.txt
- name: Build Documentation
run: |
cd doc
make html SPHINXOPTS='-W -v'
- name: Upload Build Docs
uses: actions/upload-artifact@v2
with:
name: html-docs
path: |
doc/build/html
linting:
name: Linting
name: check linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
@ -124,14 +137,15 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.9'
# Runs the Super-Linter action
- name: Style check
- name: "Install Dependencies"
run: |
pip install flake8
- name: "Check Linting"
run: |
python -m flake8 .
build-wheel:
name: Build Wheel
name: build wheel
runs-on: ubuntu-latest
steps:
@ -149,4 +163,4 @@ jobs:
with:
name: wheel
path: |
dist
dist

View File

@ -212,7 +212,7 @@ def assertImageApproved(image, standardFile, message=None, **kwargs):
else:
if os.getenv('TRAVIS') is not None:
saveFailedTest(image, stdImage, standardFile, upload=True)
elif os.getenv('AZURE') is not None:
elif os.getenv('CI') is not None:
standardFile = os.path.join(os.getenv("SCREENSHOT_DIR", "screenshots"), standardFile)
saveFailedTest(image, stdImage, standardFile)
print(graphstate)
@ -509,7 +509,7 @@ def getTestDataRepo():
if not os.path.isdir(parentPath):
os.makedirs(parentPath)
if os.getenv('TRAVIS') is not None or os.getenv('AZURE') is not None:
if os.getenv('TRAVIS') is not None or os.getenv('CI') is not None:
# Create a shallow clone of the test-data repository (to avoid
# downloading more data than is necessary)
os.makedirs(dataPath)