Skip to content

Commit

Permalink
CI: Apply Copier template
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-berchet committed Jan 27, 2023
1 parent 57d28e3 commit 7547dc3
Show file tree
Hide file tree
Showing 15 changed files with 154 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .auto-changelog
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"template": ".auto-changelog-template.hbs",
"commitLimit": false,
"backfillLimit": false,
"ignoreCommitPattern": "Release [0-9]+\\.[0-9]+\\.[0-9]+|Update CHANGELOG.*|.*\\[skip-changelog\\].*|\\[pre-commit.ci\\]",
"ignoreCommitPattern": "Release:? [0-9]+\\.[0-9]+\\.[0-9]+|Update CHANGELOG.*|.*\\[skip-changelog\\].*|\\[pre-commit.ci\\]",
"commitUrl": "https://github.com/BlueBrain/NeuroTS/commit/{id}",
"issueUrl": "https://github.com/BlueBrain/NeuroTS/issues/{id}",
"mergeUrl": "https://github.com/BlueBrain/NeuroTS/pull/{id}",
Expand Down
21 changes: 16 additions & 5 deletions .auto-changelog-template.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ Introduction
• The types feat:, fix:, chore:, docs:, refactor:, test:, style:, perf: must be at the beginning of the commit subject with an : on end.
• They can optionally have a scope set to outline the module or component that is affected eg feat(bldAssess):
• There is a short hash on the end of every commit that is currently commented out so that change log did not grow too long (due to some system's file size limitations). You can uncomment if you wish [`{{shorthash}}`]({{href}})
Example Definitions
• feat: A new feature
• fix: A bug fix
Expand All @@ -30,6 +31,8 @@ Example Definitions
"replaceText": {
"([bB]reaking:)": "",
"([bB]reaking change:)": "",
"(^[bB]uild:)": "",
"(^[bB]uild\\()": "\\(",
"(^[fF]eat:)": "",
"(^[fF]eat\\()": "\\(",
"(^[fF]ix:)": "",
Expand Down Expand Up @@ -59,7 +62,7 @@ Example Definitions
\s = whitespace
. = any character except newline
| = or
[aA] = charcter a or character A
[aA] = character a or character A
--}}


Expand Down Expand Up @@ -87,7 +90,11 @@ Example Definitions
{{/commit-list}}

{{! List commits organised under a heading, but not those already listed in the breaking section }}
{{#commit-list merges heading='### New Features' message='^[fF]eat:|[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
{{#commit-list merges heading='### Build' message='^[bB]uild:|^[bB]uild\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}

{{#commit-list merges heading='### New Features' message='^[fF]eat:|^[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}

Expand Down Expand Up @@ -123,7 +130,7 @@ Example Definitions
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}

{{#commit-list merges heading='### Uncategorized Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[cC][iI]:|^[cC][iI]\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
{{#commit-list merges heading='### General Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[bB]uild:|^[bB]uild\(|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[cC][iI]:|^[cC][iI]\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
- {{message}} ({{author}}{{#if href}} - [#{{id}}]({{href}}){{/if}})
{{/commit-list}}

Expand All @@ -133,7 +140,11 @@ Example Definitions
{{/commit-list}}

{{! List commits organised under a heading, but not those already listed in the breaking section }}
{{#commit-list commits heading='### New Features' message='^[fF]eat:|[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
{{#commit-list commits heading='### Build' message='^[bB]uild:|^[bB]uild\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}

{{#commit-list commits heading='### New Features' message='^[fF]eat:|^[fF]eat\(' exclude='[bB]reaking [cC]hange:|[bB]reaking:|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}

Expand Down Expand Up @@ -169,7 +180,7 @@ Example Definitions
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}

{{#commit-list commits heading='### Uncategorized Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[cC][iI]:|^[cC][iI]\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
{{#commit-list commits heading='### General Changes' exclude='[bB]reaking [cC]hange:|[bB]reaking:|^[bB]uild:|^[bB]uild\(|^[fF]eat:|^[fF]eat\(|^[fF]ix:|^[fF]ix\(|^[cC]hore:|^[cC]hore\(|^[cC][iI]:|^[cC][iI]\(|^[dD]ocs:|^[dD]ocs\(|^[rR]efactor:|^[rR]efactor\(|^[tT]est:|^[tT]est\(|^[sS]tyle:|^[sS]tyle\(|^[pP]erf:|^[pP]erf\(|\[skip-changelog\]'}}
- {{subject}} ({{author}}{{#if href}} - [{{shorthash}}]({{href}}){{/if}})
{{/commit-list}}

Expand Down
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changes here will be overwritten by Copier

_commit: 0.1.9
_commit: 0.1.33
_src_path: git@bbpgitlab.epfl.ch:neuromath/python-template.git
author_email: ''
author_name: Blue Brain Project, EPFL
Expand Down
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
*.asc linguist-detectable=false
.auto-changelog-template.hbs linguist-detectable=false
commitlint.config.js linguist-detectable=false
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for all configuration options:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates

version: 2
updates:
# Configure check for outdated GitHub Actions actions in workflows.
# See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
- package-ecosystem: "github-actions"
directory: "/" # Check the repository's workflows under /.github/workflows/
schedule:
interval: "weekly"
71 changes: 71 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"

on:
push:
branches: [ "main" ]
schedule:
- cron: '56 17 * * 4'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: [ 'python' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support

steps:
- name: Checkout repository
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
# queries: security-extended,security-and-quality


# Autobuild attempts to build any compiled languages (C/C++, C#, Go, 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@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
8 changes: 4 additions & 4 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ jobs:
name: Check PR title
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v2
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '14'
node-version: '16'
- run: npm install -g --force commitlint @commitlint/cli commitlint-plugin-cleanfeet
- run: npm install conventional-changelog-conventionalcommits
- run: touch .git/COMMIT_EDITMSG
- run: echo ${{ github.event.pull_request.title }} | commitlint
- run: echo "${{ github.event.pull_request.title }}" | commitlint
8 changes: 4 additions & 4 deletions .github/workflows/publish-sdist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ jobs:
name: Build and publish on PyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
- name: Set up Python 3.8
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: 3.8
- name: Build a wheel and a source tarball
run: |
pip install setuptools>=42 wheel setuptools_scm[toml]>=3.4
python setup.py sdist bdist_wheel
pip install setuptools>=42 build setuptools_scm[toml]>=3.4
python -m build -o dist
- name: Publish distribution package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
31 changes: 26 additions & 5 deletions .github/workflows/run-tox.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
workflow_dispatch:

jobs:
build:
Expand All @@ -15,28 +16,48 @@ jobs:
python-version: ["3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Cache tox and precommit environments
uses: actions/cache@v3
with:
path: |
.tox
~/.cache/pre-commit
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}-${{ hashFiles('setup.py') }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip setuptools
pip install tox-gh-actions
- name: Clear results in tox environments
run: |
rm -rf .tox/*/tmp
- name: Run tox
run: |
tox
- name: JUnit Report Action
uses: mikepenz/action-junit-report@v3.2.0
uses: mikepenz/action-junit-report@v3
if: always() # always run even if the previous step fails
with:
report_paths: 'reports/pytest-*.xml'
- name: Upload to codecov
if: ${{matrix.python-version == '3.9'}}
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v3
with:
fail_ci_if_error: false
files: ./coverage.xml
flags: pytest
name: "NeuroTS"
name: "NeuroTS-py${{ matrix.python-version }}"
- name: Upload test artifacts
uses: actions/upload-artifact@v3
if: always()
with:
name: tests-${{ matrix.python-version }}
retention-days: 4
path: |
.tox/py*/tmp
docs/build
reports
6 changes: 6 additions & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ module.exports = {
'Fix',
'Perf',
'Refactor',
'Release',
'Revert',
'Style',
'Test',
Expand Down Expand Up @@ -95,6 +96,11 @@ module.exports = {
title: 'Reverts',
emoji: '🗑',
},
Release: {
description: 'Release commit',
title: 'Release',
emoji: '🎉',
},
},
},
scope: {
Expand Down
1 change: 1 addition & 0 deletions neurots/astrocyte/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ def __init__(self, coordinates):
self.active = np.ones(len(coordinates), dtype=bool)

def __len__(self):
"""Return the number of active points."""
return len(self.active)

@property
Expand Down
2 changes: 2 additions & 0 deletions neurots/generate/algorithms/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def __init__(self, bif_id, bif, term_id, term, ref):
# self.verify()

def __str__(self):
"""Return the string representation of the TMDStop."""
return (
f"(Ref: {self.ref}, BifID: {self.bif_id}, Bif: {self.bif}, TermID: {self.term_id}, "
f"Term: {self.term})"
Expand Down Expand Up @@ -167,6 +168,7 @@ def expected_maximum_length(self):
return abs(self.ref - max(self.bif, self.term))

def __eq__(self, other):
"""Check for equality with another object."""
if isinstance(other, TMDStop):
return (
self.bif_id == other.bif_id
Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ target-version = [
"py38",
"py39",
]
include = 'neurots\/.*\.py$|tests\/.*\.py$|doc\/source\/conf\.py$|setup\.py$|examples\/*.py$'

# PYDOCSTYLE
[tool.pydocstyle]
Expand All @@ -24,7 +23,7 @@ add-ignore = [
"D107",
]
convention = "google"
match = "[neurots, tests, docs/source/conf.py, setup.py, examples]"
match = 'neurots\/.*\.py$|docs\/source\/conf\.py$|setup\.py$|examples\/.*.py$'

# ISORT
[tool.isort]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"docs": doc_reqs,
"test": test_reqs,
},
include_package_data=True,
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Science/Research",
Expand All @@ -86,5 +87,4 @@
"Programming Language :: Python :: 3.11",
"Topic :: Scientific/Engineering :: Bio-Informatics",
],
include_package_data=True,
)
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ commands =
[testenv:check-packaging]
skip_install = true
deps =
wheel
build
twine
commands =
python setup.py sdist bdist_wheel -d {envtmpdir}/dist
python -m build -o {envtmpdir}/dist
twine check {envtmpdir}/dist/*

[testenv:lint]
Expand All @@ -75,13 +75,14 @@ deps =
codespell
pre-commit
commands =
codespell -i 2 -x .codespellignorelines -w {[base]files} README.md CHANGELOG.md
codespell -i 3 -x .codespellignorelines -w {[base]files} README.md CHANGELOG.md docs/source
pre-commit run --all-files

[testenv:docs]
changedir = docs
extras = docs
allowlist_externals = make
allowlist_externals =
make
# set warnings as errors using the -W sphinx option
commands =
make clean
Expand Down

0 comments on commit 7547dc3

Please sign in to comment.