Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### Added

* Make SonarCloud optional [#515](https://github.com/NLeSC/python-template/pull/515)
* Make citation optional [#471](https://github.com/NLeSC/python-template/pull/471)
* Make online documentation optional [#476](https://github.com/NLeSC/python-template/pull/476)
* Added Python 3.12 support [#356](https://github.com/NLeSC/python-template/issues/356)
Expand Down
6 changes: 6 additions & 0 deletions copier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ AddPreCommit:
default: "{{ template_profile != 'minimum' }}"
help: Add pre-commit hook to check code style and format on every commit?

AddSonarCloud:
when: "{{ template_profile == 'ask' }}"
type: bool
default: "{{ template_profile != 'minimum' }}"
help: Add SonarCloud (code analysis service) integration?

# internal fields
_subdirectory: template

Expand Down
2 changes: 1 addition & 1 deletion profiles.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
- project_setup.md

- code quality:
- sonarcloud
- sonarcloud #515
- ruff and lint workflow
- github action to build (exist) #451
- pre-commit
Expand Down
8 changes: 0 additions & 8 deletions template/.github/workflows/next_steps.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Sonarcloud integration issue
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/next_steps/01_sonarcloud_integration.md
id: sonarcloud
- name: Create Zenodo integration issue
uses: JasonEtco/create-an-issue@v2
env:
Expand All @@ -32,7 +25,6 @@ jobs:
- name: List created issues
run: |
echo 'Created issues that must be completed to have fully working Python package:
* Sonarcloud integration ${{ steps.sonarcloud.outputs.url }}
* Zenodo integration ${{ steps.zenodo.outputs.url }}
* Linting fixes ${{ steps.linting.outputs.url }}'
- name: Cleanup files needed to create next steps issues
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
on: [push]
permissions:
contents: write
issues: write
name: Create an issue for Sonarcloud
jobs:
next_steps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Create Sonarcloud issue
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/workflows/next_steps_sonarcloud_issue.md
id: sonarcloud
- name: List created issues
run: |
echo 'Created issues that must be completed to have fully working Python package:
* Sonarcloud integration ${{ steps.sonarcloud.outputs.url }}'
- name: Cleanup files needed to create next steps issues
run: |
git config --global user.name 'NLeSC Python template'
git config --global user.email 'nlesc-python-template@users.noreply.github.com'
git pull # other next step workflows may push changes before
git rm .github/workflows/next_steps_sonarcloud.yml
git rm .github/workflows/next_steps_sonarcloud_issue.md
git commit -am "Cleanup automated next steps issue generator for sonarcloud"
git push
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,5 @@ jobs:
- name: SonarCloud Scan
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ '{{' -}} secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ '{{' -}} secrets.SONAR_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
4 changes: 4 additions & 0 deletions template/README.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@
| (5/5) checklist | [![workflow cii badge](https://bestpractices.coreinfrastructure.org/projects/<replace-with-created-project-identifier>/badge)](https://bestpractices.coreinfrastructure.org/projects/<replace-with-created-project-identifier>) |
| howfairis | [![fair-software badge](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8B-yellow)](https://fair-software.eu) |
| **Other best practices** | &nbsp; |
{% if AddSonarCloud -%}
| Static analysis | [![workflow scq badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=alert_status)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) |
| Coverage | [![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project={{github_organization}}_{{package_name}}&metric=coverage)](https://sonarcloud.io/dashboard?id={{github_organization}}_{{package_name}}) |
{%- endif -%}
{% if AddOnlineDocumentation -%}
| Documentation | [![Documentation Status](https://readthedocs.org/projects/{{package_name}}/badge/?version=latest)](https://{{package_name}}.readthedocs.io/en/latest/?badge=latest) |
{%- endif -%}
Expand All @@ -21,7 +23,9 @@
{% if AddCitation -%}
| Citation data consistency | [![cffconvert]({{repository_url}}/actions/workflows/cffconvert.yml/badge.svg)]({{repository_url}}/actions/workflows/cffconvert.yml) |
{%- endif -%}
{% if AddSonarCloud -%}
| SonarCloud | [![sonarcloud]({{repository_url}}/actions/workflows/sonarcloud.yml/badge.svg)]({{repository_url}}/actions/workflows/sonarcloud.yml) |
{%- endif -%}
| MarkDown link checker | [![markdown-link-check]({{repository_url}}/actions/workflows/markdown-link-check.yml/badge.svg)]({{repository_url}}/actions/workflows/markdown-link-check.yml) |

## How to use {{ package_name }}
Expand Down
2 changes: 2 additions & 0 deletions template/project_setup.md.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,14 @@ help you decide which tool to use for packaging.

- [Relevant section in the NLeSC guide](https://guide.esciencecenter.nl/#/best_practices/language_guides/python?id=coding-style-conventions) and [README.dev.md](README.dev.md).

{% if AddSonarCloud -%}
## Continuous code quality

[Sonarcloud](https://sonarcloud.io/) is used to perform quality analysis and code coverage report

- `sonar-project.properties` is the SonarCloud [configuration](https://docs.sonarqube.org/latest/analysis/analysis-parameters/) file
- `.github/workflows/sonarcloud.yml` is the GitHub action workflow which performs the SonarCloud analysis
{%- endif -%}

## Package version number

Expand Down