Skip to content

Commit

Permalink
Merge branch 'main' into hextof_workflow_steps
Browse files Browse the repository at this point in the history
  • Loading branch information
steinnymir authored Oct 27, 2023
2 parents 60242a7 + 2a99e33 commit 050f89c
Show file tree
Hide file tree
Showing 15 changed files with 658 additions and 621 deletions.
9 changes: 0 additions & 9 deletions .github/dependabot.yml

This file was deleted.

21 changes: 0 additions & 21 deletions .github/workflows/generate-requirements.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: linting

# Triggers the workflow on push for all branches
on: [push]

jobs:
lint:
runs-on: ubuntu-latest
steps:
# Check out repo and set up Python
- uses: actions/checkout@v3
with:
lfs: true

# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: 3.8
poetry-version: 1.2.2

# Linting steps, excute all linters even if one fails
- name: pycodestyle
run:
poetry run pycodestyle --ignore=E203,E501,W503 sed tests
- name: pylint
if: ${{ always() }}
run:
poetry run pylint --good-names=i,j,k,ex,x,y,t,k,v,ax,df,ec,mc,dc,ct --disable=fixme,too-many-branches,too-many-locals,too-many-statements,too-many-arguments,too-many-lines,too-many-public-methods,too-many-instance-attributes,too-few-public-methods sed tests
- name: mypy
if: ${{ always() }}
run:
poetry run mypy --ignore-missing-imports --follow-imports=silent --no-strict-optional sed tests
47 changes: 0 additions & 47 deletions .github/workflows/pylint.yml

This file was deleted.

34 changes: 0 additions & 34 deletions .github/workflows/pytest_coveralls.yml

This file was deleted.

40 changes: 0 additions & 40 deletions .github/workflows/pytest_muliversion.yml

This file was deleted.

33 changes: 33 additions & 0 deletions .github/workflows/testing_coverage.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: pytest and coverage report

# Triggers the workflow on push and PR for all branches
on: [push, pull_request]

jobs:
pytest:
runs-on: ubuntu-latest
steps:
# Check out repo and set up Python
- name: Check out the repository
uses: actions/checkout@v4
with:
lfs: true

# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: 3.8
poetry-version: 1.2.2

# Run pytest with coverage report, saving to xml
- name: Run tests on python 3.8
run: |
poetry run pytest --cov --cov-report xml:cobertura.xml --full-trace --show-capture=no -sv -n auto tests/
# Take report and upload to coveralls
- name: Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: ./cobertura.xml
30 changes: 30 additions & 0 deletions .github/workflows/testing_multiversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: pytest multiversion

on:
push:
branches: [ main ]

jobs:
pytest:
# Using matrix strategy
strategy:
matrix:
python-version: ["3.8", "3.9", "3.10"]
runs-on: ubuntu-latest
steps:
# Check out repo and set up Python
- name: Check out the repository
uses: actions/checkout@v4
with:
lfs: true

- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: ${{matrix.python-version}}
poetry-version: 1.2.2

# Use cached python and dependencies, install poetry
- name: Run tests on python ${{matrix.python-version}}
run: |
poetry run pytest--full-trace --show-capture=no -sv -n auto tests/
67 changes: 67 additions & 0 deletions .github/workflows/update_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Update depencies in poetry lockfile

on:
schedule:
- cron: '0 1 * * 1'
workflow_dispatch:
push:
paths:
- pyproject.toml

jobs:
update_dependencies:
runs-on: ubuntu-latest
steps:
# Check out repo and set up Python
- uses: actions/checkout@v3
with:
lfs: true

- uses: tibdex/github-app-token@v1
id: generate-token
with:
app_id: ${{ secrets.APP_ID }}
private_key: ${{ secrets.APP_PRIVATE_KEY }}

# Use cached python and dependencies, install poetry
- name: "Setup Python, Poetry and Dependencies"
uses: packetcoders/action-setup-cache-python-poetry@main
with:
python-version: 3.8
poetry-version: 1.2.2

# update poetry lockfile
- name: "Update poetry lock file"
id: update
run: |
poetry self update
exec 5>&1
UPDATE_OUTPUT=$(poetry update|tee >(cat - >&5))
echo "UPDATE_OUTPUT<<EOF" >> $GITHUB_OUTPUT
echo "$UPDATE_OUTPUT" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Export requirements.txt
run: |
poetry export --without-hashes --format=requirements.txt -o docs/requirements.txt -E docs -E notebook
- name: Obtain git status
id: status
run: |
exec 5>&1
STATUS=$(git status|tee >(cat - >&5))
echo "STATUS<<EOF" >> $GITHUB_OUTPUT
echo "$STATUS" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# create pull request if necessary
- name: "Create Pull Request"
uses: peter-evans/create-pull-request@v5
if: ${{ contains(steps.status.outputs.STATUS, 'poetry.lock') || contains(steps.status.outputs.STATUS, 'requirements.txt')}}
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: Update dependencies
title: "Update dependencies"
body: |
Dependency updates using Poetry:
${{ steps.update.outputs.UPDATE_OUTPUT }}
Loading

0 comments on commit 050f89c

Please sign in to comment.