Skip to content

Commit

Permalink
GitHub actions migration (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
kip-hart committed Sep 16, 2020
1 parent b87f8d8 commit 1baef87
Show file tree
Hide file tree
Showing 14 changed files with 470 additions and 134 deletions.
5 changes: 5 additions & 0 deletions .coveragerc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[run]
omit =
plot_incremental.py
setup.py
tests/*
12 changes: 0 additions & 12 deletions .editorconfig

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "CodeQL"

on:
push:
branches: [master, ]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 20 * * 3'

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

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
# with:
# languages: go, javascript, csharp, python, cpp, java

# 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
31 changes: 31 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Documentation check

on: [pull_request]

jobs:
docs-checks:
name: ${{ matrix.doc-type }}
strategy:
matrix:
doc-type: [html, latex, epub]

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install docs dependencies
run: |
if [ -f docs/requirements.txt ]; then pip install -r docs/requirements.txt; fi
pip install matplotlib sphinx sphinx_rtd_theme
- name: Install package
run: |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Build ${{ matrix.doc-type }} documentation
run: |
python plot_incremental.py
sphinx-apidoc -T -o docs/source/ . setup.py plot_incremental.py
sphinx-build -Wnb ${{ matrix.doc-type }} docs/source/ docs/build-${{ matrix.doc-type }}/
45 changes: 45 additions & 0 deletions .github/workflows/ossar-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This workflow integrates a collection of open source static analysis tools
# with GitHub code scanning. For documentation, or to provide feedback, visit
# https://github.com/github/ossar-action
name: OSSAR

on:
push:
pull_request:

jobs:
OSSAR-Scan:
# OSSAR runs on windows-latest.
# ubuntu-latest and macos-latest support coming soon
runs-on: windows-latest

steps:
# Checkout your code repository to scan
- 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

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Install dotnet, used by OSSAR
- name: Install .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.201'

# Run open source static analysis tools
- name: Run OSSAR
uses: github/ossar-action@v1
id: ossar

# Upload results to the Security tab
- name: Upload OSSAR results
uses: github/codeql-action/upload-sarif@v1
with:
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
154 changes: 154 additions & 0 deletions .github/workflows/python_package.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
name: CI

on: [push]

jobs:
pytest:
name: pytest for py${{ matrix.python-version }}

runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8]

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel
pip install flake8 pytest pytest-cov coveralls
- name: Install package
run: |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Test with pytest
run: |
pytest --cov=. tests/
- name: Coveralls
env:
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
COVERALLS_FLAG_NAME: py${{ matrix.python-version }}
run: |
coveralls
pytest-macOS:
name: pytest on macOS

runs-on: macos-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/Library/Caches/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install test dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
- name: Install package
run: |
brew install pkg-config
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install -e .
- name: Test with pytest
run: |
pytest
package-checks:
name: package checks

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install check dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel check-manifest twine
- name: Check package metadata
run: |
python setup.py sdist check --strict --metadata
- name: Check package manifest
run: |
check-manifest
- name: Check package long description
run: |
twine check dist/*
lint:

runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install lint dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 isort
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 aabbtree.py tests setup.py --exclude=__init__.py --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 aabbtree.py tests setup.py --exclude=__init__.py --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Lint with isort
run: |
isort --verbose --check-only --diff src tests setup.py
- name: Lint with GitHub Super-Linter
env:
VALIDATE_CSS: False
VALIDATE_HTML: False
VALIDATE_PYTHON_BLACK: False
uses: docker://github/super-linter
33 changes: 23 additions & 10 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
AABBTree - Axis-Aligned Bounding Box Trees
==========================================

|s-travis|
|s-cov|
|s-license|
.. only: html
|l-github| `Repository`_
|l-rtd| `Documentation`_
|l-pypi| `PyPI`_
|s-ci|
|s-cov|
|s-license|
|l-github| `Repository`_
|l-rtd| `Documentation`_
|l-pypi| `PyPI`_
AABBTree is a pure Python implementation of a static d-dimensional
axis aligned bounding box (AABB) tree. It is inspired by
Expand Down Expand Up @@ -108,29 +110,40 @@ Copyright |copy| 2020, Georgia Tech Research Corporation
AABBTree is open source and freely available under the terms of
the MIT license.


.. |copy| unicode:: 0xA9 .. copyright sign

.. LINKS
.. _`AABBTree repository` : https://github.com/kip-hart/AABBTree
.. _`Repository` : https://github.com/kip-hart/AABBTree
.. _`Documentation` : https://aabbtree.readthedocs.io
.. _`PyPI` : https://pypi.org/project/aabbtree/
.. _`Introductory Guide to AABB Tree Collision Detection` : https://www.azurefromthetrenches.com/introductory-guide-to-aabb-tree-collision-detection/
.. SHIELDS
.. |s-license| image:: https://img.shields.io/pypi/l/aabbtree.svg
:target: https://github.com/kip-hart/AABBTree/blob/master/LICENSE.rst
:alt: License

.. |s-docs| image:: https://readthedocs.org/projects/aabbtree/badge/?version=latest
:target: https://aabbtree.readthedocs.io
:alt: Documentation Status
.. |s-travis| image:: https://travis-ci.org/kip-hart/AABBTree.svg?branch=master
:target: https://travis-ci.org/kip-hart/AABBTree
:alt: Travis CI

.. |s-ci| image:: https://img.shields.io/github/workflow/status/kip-hart/AABBTree/CI?labelColor=grey
:target: https://github.com/kip-hart/AABBTree/actions
:alt: Continuous Integration

.. |s-cov| image:: https://coveralls.io/repos/github/kip-hart/AABBTree/badge.svg?branch=master
:target: https://coveralls.io/github/kip-hart/AABBTree?branch=master
:alt: Coverage

.. |s-pver| image:: https://img.shields.io/pypi/v/aabbtree.svg
:target: https://pypi.org/project/aabbtree/
:alt: PyPI

.. ICONS
.. |l-github| image:: https://api.iconify.design/octicon:mark-github.svg?color=black0&inline=true&height=16
:target: https://github.com/kip-hart/AABBTree
:alt: GitHub
Expand Down
Loading

0 comments on commit 1baef87

Please sign in to comment.