Skip to content

Commit

Permalink
Merge pull request #30 from CapeLeidokos/feature/fix_python_package
Browse files Browse the repository at this point in the history
Prepare packaging and split up github workflows
  • Loading branch information
noseglasses authored Sep 25, 2021
2 parents bb703f8 + d3cc684 commit 529f1a2
Show file tree
Hide file tree
Showing 41 changed files with 339 additions and 151 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/black_code_formatting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Check Python Code Format

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
format_checking:
name: Check Python Formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Check files using the black formatter
uses: rickstaa/action-black@v1
id: action_black
with:
black_args: "."
- name: Annotate diff changes using reviewdog
if: steps.action_black.outputs.is_formatted == 'true'
uses: reviewdog/action-suggester@v1
with:
tool_name: blackfmt
24 changes: 24 additions & 0 deletions .github/workflows/lint_README.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint README

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint_readme:
name: Lint README
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: README.md Link Check
uses: lycheeverse/[email protected]
id: lychee_readme_md
with:
args: --verbose --no-progress "/github/workspace/README.md"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Fail on README.md Link Check Errors
run: exit ${{ steps.lychee_readme_md.outputs.exit_code }}
24 changes: 24 additions & 0 deletions .github/workflows/lint_generated_html.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Lint generated HTML

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
name: Lint generated HTML
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: HTML Link Check
uses: lycheeverse/[email protected]
id: lychee_html
with:
args: --verbose --no-progress "/github/workspace/test_output/**/*.html"
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Fail on HTML Link Check Errors
run: exit ${{ steps.lychee_html.outputs.exit_code }}
34 changes: 34 additions & 0 deletions .github/workflows/lint_python_flake8.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Lint Python with flake8

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
lint:
name: Lint Python with flake8
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Ubuntu packages
run: |
sudo apt install -y python3-pip
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8
- 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
# E203: Spaces around colons in array indexing collides with black-formatting
# E402: Imports always on top collide with the need to set the python module search path in some places
# W503: Collides with black formatting
flake8 . --count --max-complexity=10 --max-line-length=200 --statistics --ignore=E203,E402,W503
29 changes: 29 additions & 0 deletions .github/workflows/local_package_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Local Package Build

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
local_package_build:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Ubuntu packages
run: |
sudo apt install -y python3-pip
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install build
- name: Local Python Packaging
run: |
python3 -m build
32 changes: 32 additions & 0 deletions .github/workflows/package_deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: PyPI Package Deploy

on:
release:
types: [published]

jobs:
package_deploy:
if: startsWith(github.ref, 'refs/tags')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- name: Set up Python 3.9
uses: actions/setup-python@v1
with:
python-version: 3.9
- name: Install pypa/build
run: |
python -m pip install build --user
- name: Build a binary wheel and a source tarball
run: |
python -m build --sdist --wheel --outdir dist/
#- name: Publish distribution 📦 to Test PyPI
# uses: pypa/gh-action-pypi-publish@master
# with:
# password: ${{ secrets.TEST_PYPI_API_TOKEN }}
# repository_url: https://test.pypi.org/legacy/
- name: Publish distribution 📦 to PyPI
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.PYPI_API_TOKEN }}

102 changes: 0 additions & 102 deletions .github/workflows/python-app.yml

This file was deleted.

44 changes: 44 additions & 0 deletions .github/workflows/run_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Module Tests

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
module_tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Ubuntu packages
run: |
sudo apt install -y python3-pip
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pytest
python3 -m pip install -r ./requirements.txt
- name: Test
run: |
mkdir test_output
cd test_output
python3 ../tests/test.py
python3 ../tests/test_cpp_symbols.py
- name: Prepare Example Deploy
run: |
mkdir example_deploy
cd example_deploy
cp -a ../test_output/pair_report_multi_page .
cp ../test_output/pair_report_output.html .
cp ../src/elf_diff/html/example_page.html ./index.html
- name: Deploy To Github Pages
uses: JamesIves/[email protected]
if: ${{ github.event_name == 'push' }} # Only run on push to master (which only happens if a PR is merged)
with:
branch: gh-pages # The branch the action should deploy to.
folder: /home/runner/work/elf_diff/elf_diff/example_deploy # The folder the action should deploy.
34 changes: 34 additions & 0 deletions .github/workflows/venv_local_package_install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Local Package Install and Test

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
local_package_install_and_test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install Ubuntu packages
run: |
sudo apt install -y python3-pip python3-venv
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
- name: Generate venv
run: |
repo_root=$PWD
cd ..
python3 -m venv env
source ./env/bin/activate
mkdir test
cd test
python3 -m pip install "${repo_root}"
python3 ${repo_root}/tests/test.py -p
4 changes: 1 addition & 3 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,5 @@ include README.md
include setup.py

graft examples
graft html
graft images
graft src
graft tests
graft tests
Loading

0 comments on commit 529f1a2

Please sign in to comment.