Skip to content

Commit 032e3ab

Browse files
committed
Merge remote-tracking branch 'origin/main' into specsscan-crop
2 parents 3ee4bce + 66d995e commit 032e3ab

File tree

121 files changed

+7051
-27038
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+7051
-27038
lines changed

.flake8

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/linting.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: linting
2+
3+
# Triggers the workflow on push for all branches
4+
on:
5+
push:
6+
branches:
7+
- '*'
8+
paths-ignore:
9+
pyproject.toml
10+
11+
jobs:
12+
lint:
13+
runs-on: ubuntu-latest
14+
steps:
15+
# Check out repo and set up Python
16+
- uses: actions/checkout@v3
17+
with:
18+
lfs: true
19+
20+
# 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
21+
- name: checkout test data
22+
run: |
23+
eval `ssh-agent -s`
24+
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
25+
git submodule sync --recursive
26+
git submodule update --init --recursive
27+
28+
# Use cached python and dependencies, install poetry
29+
- name: "Setup Python, Poetry and Dependencies"
30+
uses: packetcoders/action-setup-cache-python-poetry@main
31+
with:
32+
python-version: 3.8
33+
poetry-version: 1.2.2
34+
35+
# Linting steps, excute all linters even if one fails
36+
- name: ruff
37+
run:
38+
poetry run ruff specsanalyzer specsscan tests
39+
- name: ruff formating
40+
if: ${{ always() }}
41+
run:
42+
poetry run ruff format --check specsanalyzer specsscan tests
43+
- name: mypy
44+
if: ${{ always() }}
45+
run:
46+
poetry run mypy specsanalyzer specsscan tests

.github/workflows/pylint.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: pytest and coverage report
2+
3+
# Triggers the workflow on push for all branches and PR only for main
4+
on:
5+
push:
6+
branches:
7+
- '*'
8+
pull_request:
9+
branches:
10+
- main
11+
12+
jobs:
13+
pytest:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Check out repo and set up Python
17+
- name: Check out the repository
18+
uses: actions/checkout@v4
19+
with:
20+
lfs: true
21+
22+
# 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
23+
- name: checkout test data
24+
run: |
25+
eval `ssh-agent -s`
26+
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
27+
git submodule sync --recursive
28+
git submodule update --init --recursive
29+
30+
# Use cached python and dependencies, install poetry
31+
- name: "Setup Python, Poetry and Dependencies"
32+
uses: packetcoders/action-setup-cache-python-poetry@main
33+
with:
34+
python-version: 3.8
35+
poetry-version: 1.2.2
36+
37+
# Run pytest with coverage report, saving to xml
38+
- name: Run tests on python 3.8
39+
run: |
40+
poetry run pytest --cov --cov-report xml:cobertura.xml --full-trace --show-capture=no -sv -n auto tests/
41+
42+
# Take report and upload to coveralls
43+
# - name: Coveralls
44+
# uses: coverallsapp/github-action@v2
45+
# with:
46+
# github-token: ${{ secrets.GITHUB_TOKEN }}
47+
# file: ./cobertura.xml
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: unit tests [Python 3.8|3.9|3.10|3.11]
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches: [ main ]
7+
paths-ignore:
8+
pyproject.toml
9+
10+
jobs:
11+
pytest:
12+
# Using matrix strategy
13+
strategy:
14+
matrix:
15+
python-version: ["3.8", "3.9", "3.10", "3.11"]
16+
runs-on: ubuntu-latest
17+
steps:
18+
# Check out repo and set up Python
19+
- name: Check out the repository
20+
uses: actions/checkout@v4
21+
with:
22+
lfs: true
23+
24+
# 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
25+
- name: checkout test data
26+
run: |
27+
eval `ssh-agent -s`
28+
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
29+
git submodule sync --recursive
30+
git submodule update --init --recursive
31+
32+
- name: "Setup Python, Poetry and Dependencies"
33+
uses: packetcoders/action-setup-cache-python-poetry@main
34+
with:
35+
python-version: ${{matrix.python-version}}
36+
poetry-version: 1.2.2
37+
38+
# Use cached python and dependencies, install poetry
39+
- name: Run tests on python ${{matrix.python-version}}
40+
run: |
41+
poetry run pytest --full-trace --show-capture=no -sv -n auto tests/
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Update depencies in poetry lockfile
2+
3+
on:
4+
schedule:
5+
- cron: '0 1 * * 1'
6+
workflow_dispatch:
7+
push:
8+
branches: main
9+
paths:
10+
- .github/workflows/update_dependencies.yml
11+
12+
jobs:
13+
update_dependencies:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Check out repo and set up Python
17+
- uses: actions/checkout@v3
18+
with:
19+
lfs: true
20+
21+
# see https://stackoverflow.com/questions/57612428/cloning-private-github-repository-within-organisation-in-actions
22+
- name: checkout test data
23+
run: |
24+
eval `ssh-agent -s`
25+
ssh-add - <<< '${{ secrets.TEST_DATA_ACCESS_KEY }}'
26+
git submodule sync --recursive
27+
git submodule update --init --recursive
28+
29+
30+
# see https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md
31+
- uses: tibdex/github-app-token@v1
32+
id: generate-token
33+
with:
34+
app_id: ${{ secrets.APP_ID }}
35+
private_key: ${{ secrets.APP_PRIVATE_KEY }}
36+
37+
# Use cached python and dependencies, install poetry
38+
- name: "Setup Python, Poetry and Dependencies"
39+
uses: packetcoders/action-setup-cache-python-poetry@main
40+
with:
41+
python-version: 3.8
42+
poetry-version: 1.2.2
43+
44+
# update poetry lockfile
45+
- name: "Update poetry lock file"
46+
id: update
47+
run: |
48+
poetry self update
49+
exec 5>&1
50+
UPDATE_OUTPUT=$(poetry update|tee >(cat - >&5))
51+
echo "UPDATE_OUTPUT<<EOF" >> $GITHUB_OUTPUT
52+
echo "$UPDATE_OUTPUT" >> $GITHUB_OUTPUT
53+
echo "EOF" >> $GITHUB_OUTPUT
54+
55+
- name: Obtain git status
56+
id: status
57+
run: |
58+
exec 5>&1
59+
STATUS=$(git status|tee >(cat - >&5))
60+
echo "STATUS<<EOF" >> $GITHUB_OUTPUT
61+
echo "$STATUS" >> $GITHUB_OUTPUT
62+
echo "EOF" >> $GITHUB_OUTPUT
63+
64+
# create pull request if necessary
65+
- name: "Create Pull Request"
66+
uses: peter-evans/create-pull-request@v5
67+
if: ${{ contains(steps.status.outputs.STATUS, 'poetry.lock')}}
68+
with:
69+
token: ${{ steps.generate-token.outputs.token }}
70+
commit-message: Update dependencies
71+
title: "Update dependencies"
72+
body: |
73+
Dependency updates using Poetry:
74+
${{ steps.update.outputs.UPDATE_OUTPUT }}

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "tests/data"]
2+
path = tests/data
3+
url = [email protected]:OpenCOMPES/specsanalyzer-testdata.git

.pre-commit-config.yaml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,18 @@ repos:
1111
- id: check-ast
1212
- id: check-docstring-first
1313

14-
- repo: https://github.com/psf/black
15-
rev: 22.3.0
14+
- repo: https://github.com/astral-sh/ruff-pre-commit
15+
# Ruff version.
16+
rev: v0.1.7
1617
hooks:
17-
- id: black
18-
args: [--line-length=100]
19-
- repo: https://github.com/PyCQA/flake8
20-
rev: 5.0.4
18+
# Run the formatter.
19+
- id: ruff-format
20+
# Run the linter.
21+
- id: ruff
22+
- repo: https://github.com/pre-commit/mirrors-mypy
23+
rev: v1.7.1
2124
hooks:
22-
- id: flake8
25+
- id: mypy
2326
- repo: https://github.com/asottile/reorder_python_imports
2427
rev: v3.8.2
2528
hooks:

MANIFEST.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
include specsanalyzer/config/*
2+
include specsscan/config/*

0 commit comments

Comments
 (0)