Skip to content

Commit

Permalink
Merge pull request #63 from statisticsnorway/ssb-pypitemplate
Browse files Browse the repository at this point in the history
Convert to use ssb-pypitemplate
  • Loading branch information
benediktgoodman authored Sep 27, 2024
2 parents d64e98a + af52310 commit 4830fc2
Show file tree
Hide file tree
Showing 42 changed files with 5,043 additions and 3,958 deletions.
22 changes: 22 additions & 0 deletions .cookiecutter.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"_copy_without_render": [
"*.rst_t"
],
"_jinja2_env_vars": {
"lstrip_blocks": true,
"trim_blocks": true
},
"_template": "https://github.com/statisticsnorway/ssb-pypitemplate.git",
"author": "Benedikt Goodman",
"code_quality_level": "Medium",
"copyright_owner": "Statistics Norway",
"copyright_year": "2024",
"development_status": "Development Status :: 4 - Beta",
"email": "[email protected]",
"friendly_name": "SSB Model Solver",
"github_organization": "statisticsnorway",
"license": "MIT",
"package_name": "model_solver",
"project_name": "ssb-model-solver",
"version": "1.1.23"
}
30 changes: 22 additions & 8 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,29 @@
{
"template": "https://github.com/statisticsnorway/ssb-project-template-stat",
"commit": "cb5e93fbcb298920b3d76770352d823840c49a38",
"checkout": "1.0.0",
"template": "https://github.com/statisticsnorway/ssb-pypitemplate.git",
"commit": "e6f0ca2794354d16838cf36d97bee2f9f70d3142",
"checkout": "2024.9.10",
"context": {
"cookiecutter": {
"full_name": "Magnus Helliesen",
"email": "[email protected]",
"project_name": "ssb-model-solver",
"description": "Class to define, block analyse and solve dynamic and algebraic models numerically",
"license_year": "2023",
"_template": "https://github.com/statisticsnorway/ssb-project-template-stat"
"package_name": "model_solver",
"friendly_name": "SSB Model Solver",
"copyright_owner": "Statistics Norway",
"copyright_year": "2024",
"author": "Benedikt Goodman",
"email": "[email protected]",
"github_organization": "statisticsnorway",
"version": "1.1.23",
"license": "MIT",
"development_status": "Development Status :: 4 - Beta",
"code_quality_level": "Medium",
"_copy_without_render": [
"*.rst_t"
],
"_jinja2_env_vars": {
"lstrip_blocks": true,
"trim_blocks": true
},
"_template": "https://github.com/statisticsnorway/ssb-pypitemplate.git"
}
},
"directory": null
Expand Down
2 changes: 2 additions & 0 deletions .darglint
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[darglint]
strictness = long
15 changes: 15 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{py,toml}]
indent_style = space
indent_size = 4

[*.yml,yaml,json]
indent_style = space
indent_size = 2
32 changes: 32 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
version: 2
updates:
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "monthly"
open-pull-requests-limit: 99
groups:
github-action-dependencies:
patterns:
- "*"
- package-ecosystem: "pip"
directory: "/.github/workflows"
schedule:
interval: "monthly"
open-pull-requests-limit: 99
groups:
workflows-dependencies:
patterns:
- "*"
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "monthly"
versioning-strategy: lockfile-only
allow:
- dependency-type: "all"
open-pull-requests-limit: 99
groups:
poetry-dependencies:
patterns:
- "*"
66 changes: 66 additions & 0 deletions .github/labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
# Labels names are important as they are used by Release Drafter to decide
# regarding where to record them in changelog or if to skip them.
#
# The repository labels will be automatically configured using this file and
# the GitHub Action https://github.com/marketplace/actions/github-labeler.
- name: breaking
description: Breaking Changes
color: bfd4f2
- name: bug
description: Something isn't working
color: d73a4a
- name: ci
description: Continuous Integration
color: 4a97d6
- name: dependencies
description: Pull requests that update a dependency file
color: 0366d6
- name: documentation
description: Improvements or additions to documentation
color: 0075ca
- name: duplicate
description: This issue or pull request already exists
color: cfd3d7
- name: enhancement
description: New feature or request
color: a2eeef
- name: github_actions
description: Pull requests that update Github_actions code
color: "000000"
- name: good first issue
description: Good for newcomers
color: 7057ff
- name: help wanted
description: Extra attention is needed
color: 008672
- name: invalid
description: This doesn't seem right
color: e4e669
- name: performance
description: Performance
color: "016175"
- name: python
description: Pull requests that update Python code
color: 2b67c6
- name: question
description: Further information is requested
color: d876e3
- name: refactoring
description: Refactoring
color: ef67c4
- name: removal
description: Removals and Deprecations
color: 9ae7ea
- name: style
description: Style
color: c120e5
- name: testing
description: Testing
color: b1fc6f
- name: wontfix
description: This will not be worked on
color: ffffff
- name: "skip-changelog"
description: Changes that should be omitted from the release notes
color: ededed
30 changes: 30 additions & 0 deletions .github/release-drafter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
categories:
- title: ":boom: Breaking Changes"
label: "breaking"
- title: ":rocket: Features"
label: "enhancement"
- title: ":fire: Removals and Deprecations"
label: "removal"
- title: ":beetle: Fixes"
label: "bug"
- title: ":racehorse: Performance"
label: "performance"
- title: ":rotating_light: Testing"
label: "testing"
- title: ":construction_worker: Continuous Integration"
label: "ci"
- title: ":books: Documentation"
label: "documentation"
- title: ":hammer: Refactoring"
label: "refactoring"
- title: ":lipstick: Style"
label: "style"
- title: ":package: Dependencies"
labels:
- "dependencies"
exclude-labels:
- "skip-changelog"
template: |
## Changes
$CHANGES
5 changes: 5 additions & 0 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
pip==24.2
nox==2024.4.15
nox-poetry==1.0.3
poetry==1.8.3
virtualenv==20.26.3
67 changes: 67 additions & 0 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Documentation

on:
push:
branches:
- main
- master

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Install Poetry
run: |
pipx install --pip-args "-c ${{ github.workspace }}/.github/workflows/constraints.txt" poetry
poetry --version
- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.12"
cache: "poetry"

- name: Install dependencies
run: |
poetry install
- name: Build doc with Sphinx
run: |
poetry run sphinx-build docs docs/_build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: "docs/_build"

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Setup Pages
uses: actions/configure-pages@v5

- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
25 changes: 25 additions & 0 deletions .github/workflows/labeler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Labeler

on:
push:
branches:
- main
- master
paths:
- ".github/labels.yml"
- ".github/workflows/labeler.yml"

jobs:
labeler:
runs-on: ubuntu-latest
permissions:
issues: write
contents: read
steps:
- name: Check out the repository
uses: actions/checkout@v4

- name: Run Labeler
uses: crazy-max/[email protected]
with:
skip-delete: true
78 changes: 78 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: Release

on:
push:
branches:
- main
- master

jobs:
release:
name: Release
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: read
steps:
- name: Check out the repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Python
uses: actions/[email protected]
with:
python-version: "3.12"

- name: Upgrade pip
run: |
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt pip
pip --version
- name: Install Poetry
run: |
pip install -c ${{ github.workspace }}/.github/workflows/constraints.txt poetry
poetry --version
- name: Check if there is a parent commit
id: check-parent-commit
run: |
echo "sha=$(git rev-parse --verify --quiet HEAD^)" >> $GITHUB_OUTPUT
- name: Detect and tag new version
id: check-version
if: steps.check-parent-commit.outputs.sha
uses: salsify/[email protected]
with:
version-command: |
bash -o pipefail -c "poetry version | cut -f 2 -d' '"
- name: Bump version for developmental release
if: (!steps.check-version.outputs.tag)
run: |
poetry version patch &&
version=$(poetry version | awk '{ print $2 }') &&
poetry version $version.dev.$(date +%s)
- name: Build package
run: |
poetry build --ansi
- name: Publish package on PyPI
if: steps.check-version.outputs.tag
uses: pypa/[email protected]

- name: Publish package on TestPyPI
if: (!steps.check-version.outputs.tag)
uses: pypa/[email protected]
with:
repository-url: https://test.pypi.org/legacy/

- name: Publish the release notes
uses: release-drafter/[email protected]
with:
publish: ${{ steps.check-version.outputs.tag != '' }}
tag: ${{ steps.check-version.outputs.tag }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading

0 comments on commit 4830fc2

Please sign in to comment.