Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into specsscan-crop
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Feb 27, 2024
2 parents 3ee4bce + 66d995e commit 032e3ab
Show file tree
Hide file tree
Showing 121 changed files with 7,051 additions and 27,038 deletions.
3 changes: 0 additions & 3 deletions .flake8

This file was deleted.

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

# Triggers the workflow on push for all branches
on:
push:
branches:
- '*'
paths-ignore:
pyproject.toml

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

# see https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions and https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
- name: checkout test data
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
git submodule sync --recursive
git submodule update --init --recursive
# 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: ruff
run:
poetry run ruff specsanalyzer specsscan tests
- name: ruff formating
if: ${{ always() }}
run:
poetry run ruff format --check specsanalyzer specsscan tests
- name: mypy
if: ${{ always() }}
run:
poetry run mypy specsanalyzer specsscan tests
39 changes: 0 additions & 39 deletions .github/workflows/pylint.yml

This file was deleted.

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

# Triggers the workflow on push for all branches and PR only for main
on:
push:
branches:
- '*'
pull_request:
branches:
- main

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

# see https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions and https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
- name: checkout test data
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
git submodule sync --recursive
git submodule update --init --recursive
# 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
41 changes: 41 additions & 0 deletions .github/workflows/testing_multiversion.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: unit tests [Python 3.8|3.9|3.10|3.11]

on:
workflow_dispatch:
push:
branches: [ main ]
paths-ignore:
pyproject.toml

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

# see https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions and https://docs.github.com/en/authentication/connecting-to-github-with-ssh/generating-a-new-ssh-key-and-adding-it-to-the-ssh-agent#generating-a-new-ssh-key
- name: checkout test data
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
git submodule sync --recursive
git submodule update --init --recursive
- 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/
74 changes: 74 additions & 0 deletions .github/workflows/update_dependencies.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Update depencies in poetry lockfile

on:
schedule:
- cron: '0 1 * * 1'
workflow_dispatch:
push:
branches: main
paths:
- .github/workflows/update_dependencies.yml

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

# see https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions
- name: checkout test data
run: |
eval `ssh-agent -s`
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
git submodule sync --recursive
git submodule update --init --recursive
# see https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md
- 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: 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')}}
with:
token: ${{ steps.generate-token.outputs.token }}
commit-message: Update dependencies
title: "Update dependencies"
body: |
Dependency updates using Poetry:
${{ steps.update.outputs.UPDATE_OUTPUT }}
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "tests/data"]
path = tests/data
url = [email protected]:OpenCOMPES/specsanalyzer-testdata.git
17 changes: 10 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,18 @@ repos:
- id: check-ast
- id: check-docstring-first

- repo: https://github.com/psf/black
rev: 22.3.0
- repo: https://github.com/astral-sh/ruff-pre-commit
# Ruff version.
rev: v0.1.7
hooks:
- id: black
args: [--line-length=100]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
# Run the formatter.
- id: ruff-format
# Run the linter.
- id: ruff
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
hooks:
- id: flake8
- id: mypy
- repo: https://github.com/asottile/reorder_python_imports
rev: v3.8.2
hooks:
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
include specsanalyzer/config/*
include specsscan/config/*
Loading

0 comments on commit 032e3ab

Please sign in to comment.