Skip to content

Commit 174f646

Browse files
CI: Apply Copier template (#23)
* Add support for Python 3.10 * Add dependabot for Github Actions * Use cache in Github Actions
1 parent f0518a8 commit 174f646

File tree

11 files changed

+148
-33
lines changed

11 files changed

+148
-33
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Changes here will be overwritten by Copier
22

3-
_commit: 0.1.9
3+
_commit: 0.1.26
44
_src_path: [email protected]:neuromath/python-template.git
55
author_email: ''
66
author_name: Blue Brain Project, EPFL

.gitattributes

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*.asc linguist-detectable=false
2+
.auto-changelog-template.hbs linguist-detectable=false
3+
commitlint.config.js linguist-detectable=false

.github/dependabot.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# To get started with Dependabot version updates, you'll need to specify which
2+
# package ecosystems to update and where the package manifests are located.
3+
# Please see the documentation for all configuration options:
4+
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
5+
6+
version: 2
7+
updates:
8+
# Configure check for outdated GitHub Actions actions in workflows.
9+
# See: https://docs.github.com/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot
10+
- package-ecosystem: "github-actions"
11+
directory: "/" # Check the repository's workflows under /.github/workflows/
12+
schedule:
13+
interval: "weekly"

.github/workflows/codeql.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
# For most projects, this workflow file will not need changing; you simply need
2+
# to commit it to your repository.
3+
#
4+
# You may wish to alter this file to override the set of languages analyzed,
5+
# or to provide custom queries or build logic.
6+
#
7+
# ******** NOTE ********
8+
# We have attempted to detect the languages in your repository. Please check
9+
# the `language` matrix defined below to confirm you have the correct set of
10+
# supported CodeQL languages.
11+
#
12+
name: "CodeQL"
13+
14+
on:
15+
push:
16+
branches: [ "main" ]
17+
schedule:
18+
- cron: '55 17 * * 2'
19+
20+
jobs:
21+
analyze:
22+
name: Analyze
23+
runs-on: ubuntu-latest
24+
permissions:
25+
actions: read
26+
contents: read
27+
security-events: write
28+
29+
strategy:
30+
fail-fast: false
31+
matrix:
32+
language: [ 'python' ]
33+
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
34+
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
35+
36+
steps:
37+
- name: Checkout repository
38+
uses: actions/checkout@v3
39+
40+
# Initializes the CodeQL tools for scanning.
41+
- name: Initialize CodeQL
42+
uses: github/codeql-action/init@v2
43+
with:
44+
languages: ${{ matrix.language }}
45+
# If you wish to specify custom queries, you can do so here or in a config file.
46+
# By default, queries listed here will override any specified in a config file.
47+
# Prefix the list here with "+" to use these queries and those in the config file.
48+
49+
# 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
50+
# queries: security-extended,security-and-quality
51+
52+
53+
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
54+
# If this step fails, then you should remove it and run the build manually (see below)
55+
- name: Autobuild
56+
uses: github/codeql-action/autobuild@v2
57+
58+
# ℹ️ Command-line programs to run using the OS shell.
59+
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
60+
61+
# If the Autobuild fails above, remove it and uncomment the following three lines.
62+
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
63+
64+
# - run: |
65+
# echo "Run, Build Application using script"
66+
# ./location_of_script_within_repo/buildscript.sh
67+
68+
- name: Perform CodeQL Analysis
69+
uses: github/codeql-action/analyze@v2
70+
with:
71+
category: "/language:${{matrix.language}}"

.github/workflows/commitlint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ jobs:
99
name: Check PR title
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@master
13-
- uses: actions/setup-node@v2
12+
- uses: actions/checkout@v3
13+
- uses: actions/setup-node@v3
1414
with:
15-
node-version: '14'
15+
node-version: '16'
1616
- run: npm install -g --force commitlint @commitlint/cli commitlint-plugin-cleanfeet
1717
- run: npm install conventional-changelog-conventionalcommits
1818
- run: touch .git/COMMIT_EDITMSG
19-
- run: echo ${{ github.event.pull_request.title }} | commitlint
19+
- run: echo "${{ github.event.pull_request.title }}" | commitlint

.github/workflows/publish-sdist.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ jobs:
1010
name: Build and publish on PyPI
1111
runs-on: ubuntu-latest
1212
steps:
13-
- uses: actions/checkout@master
13+
- uses: actions/checkout@v3
1414
- name: Set up Python 3.8
15-
uses: actions/setup-python@v2
15+
uses: actions/setup-python@v4
1616
with:
1717
python-version: 3.8
1818
- name: Build a wheel and a source tarball
1919
run: |
20-
pip install setuptools>=42 wheel setuptools_scm[toml]>=3.4
21-
python setup.py sdist bdist_wheel
20+
pip install setuptools>=42 build setuptools_scm[toml]>=3.4
21+
python -m build -o dist
2222
- name: Publish distribution package to PyPI
2323
uses: pypa/gh-action-pypi-publish@release/v1
2424
with:

.github/workflows/run-tox.yml

Lines changed: 37 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,59 @@ jobs:
1313
runs-on: ubuntu-latest
1414
strategy:
1515
matrix:
16-
python-version: [3.8, 3.9]
16+
python-version: ["3.8", "3.9", "3.10"]
1717

1818
steps:
19-
- uses: actions/checkout@v2
19+
- uses: actions/checkout@v3
2020
- name: Set up Python ${{ matrix.python-version }}
21-
uses: actions/setup-python@v2
21+
uses: actions/setup-python@v4
2222
with:
2323
python-version: ${{ matrix.python-version }}
24-
- name: Install dependencies
24+
- name: Get current month
25+
id: date
26+
run: echo "date=$(date +'%Y-%m')" >> $GITHUB_OUTPUT
27+
- name: Cache APT Packages
28+
uses: awalsh128/cache-apt-pkgs-action@latest
29+
with:
30+
packages: poppler-utils imagemagick
31+
version: 1.0
32+
execute_install_scripts: true
33+
- name: Cache tox and precommit environments
34+
uses: actions/cache@v3
35+
with:
36+
path: |
37+
.tox
38+
~/.cache/pre-commit
39+
key: ${{ runner.os }}-${{ matrix.python-version }}-${{ steps.date.outputs.date }}-${{ hashFiles('setup.py') }}-${{ hashFiles('.pre-commit-config.yaml') }}
40+
- name: Install dependencies and register dot plugin
2541
run: |
26-
sudo apt-get install -y poppler-utils imagemagick
2742
python -m pip install --upgrade pip setuptools
2843
pip install tox-gh-actions
44+
- name: Clear results in tox environments
45+
run: |
46+
rm -rf .tox/*/tmp
2947
- name: Run tox
3048
run: |
3149
tox
3250
- name: JUnit Report Action
33-
uses: mikepenz/action-junit-report@v3.2.0
51+
uses: mikepenz/action-junit-report@v3
3452
if: always() # always run even if the previous step fails
3553
with:
3654
report_paths: 'reports/pytest-*.xml'
3755
- name: Upload to codecov
38-
if: ${{matrix.python-version == '3.8'}}
39-
uses: codecov/codecov-action@v1
56+
uses: codecov/codecov-action@v3
4057
with:
4158
fail_ci_if_error: false
42-
files: ./reports/coverage-py38.xml
59+
files: ./reports/coverage-*.xml
4360
flags: pytest
44-
name: "dir-content-diff-py38"
61+
name: "dir-content-diff-py${{ matrix.python-version }}"
62+
- name: Upload test artifacts
63+
uses: actions/upload-artifact@v3
64+
if: always()
65+
with:
66+
name: tests-${{ matrix.python-version }}
67+
retention-days: 4
68+
path: |
69+
.tox/py*/tmp
70+
docs/build
71+
reports

.readthedocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ version: 2
88
build:
99
os: ubuntu-20.04
1010
tools:
11-
python: "3.8"
11+
python: "3.9"
1212

1313
sphinx:
1414
configuration: docs/source/conf.py

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ target-version = [
1515
"py38",
1616
"py39",
1717
]
18-
include = 'dir_content_diff\/.*\.py$|tests\/.*\.py$|docs\/source\/conf\.py$|setup\.py$'
1918

2019
# PYDOCSTYLE
2120
[tool.pydocstyle]
@@ -25,7 +24,6 @@ add-ignore = [
2524
"D107",
2625
]
2726
convention = "google"
28-
match = "[dir_content_diff, tests, docs/source/conf.py, setup.py]"
2927

3028
# ISORT
3129
[tool.isort]

setup.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Setup for the dir-content-diff package."""
22
from pathlib import Path
33

4-
from setuptools import find_packages
4+
from setuptools import find_namespace_packages
55
from setuptools import setup
66

77
reqs = [
@@ -40,7 +40,7 @@
4040
"Source": "https://github.com/BlueBrain/dir-content-diff",
4141
},
4242
license="Apache License 2.0",
43-
packages=find_packages(include=["dir_content_diff"]),
43+
packages=find_namespace_packages(include=["dir_content_diff*"]),
4444
python_requires=">=3.8",
4545
use_scm_version=True,
4646
setup_requires=[
@@ -52,6 +52,10 @@
5252
"docs": doc_reqs + pandas_reqs,
5353
"test": test_reqs + pandas_reqs,
5454
},
55+
entry_points={
56+
"pytest11": ["dir-content-diff = dir_content_diff.pytest_plugin"],
57+
},
58+
include_package_data=True,
5559
classifiers=[
5660
"Development Status :: 4 - Beta",
5761
"Intended Audience :: Developers",
@@ -60,10 +64,7 @@
6064
"Programming Language :: Python :: 3",
6165
"Programming Language :: Python :: 3.8",
6266
"Programming Language :: Python :: 3.9",
67+
"Programming Language :: Python :: 3.10",
6368
"Topic :: Software Development :: Libraries :: Python Modules",
6469
],
65-
include_package_data=True,
66-
entry_points={
67-
"pytest11": ["dir-content-diff = dir_content_diff.pytest_plugin"],
68-
},
6970
)

0 commit comments

Comments
 (0)