Skip to content

Commit

Permalink
Merge pull request #66 from os-climate/update-devops-tooling
Browse files Browse the repository at this point in the history
Chore: Update DevOps tooling from central repository [skip ci]
  • Loading branch information
ModeSevenIndustrialSolutions authored May 7, 2024
2 parents 0903c25 + f545bd9 commit ea07a50
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 74 deletions.
1 change: 1 addition & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
[flake8]
max-line-length = 160
extend-ignore = E203, E501
3 changes: 1 addition & 2 deletions .github/workflows/bootstrap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ jobs:
id: update-repository
env:
GH_TOKEN: ${{ github.token }}
GITHUB_TOKEN: ${{ github.token }}
# yamllint disable rule:line-length
run: |
#SHELLCODESTART
Expand Down Expand Up @@ -303,7 +302,7 @@ jobs:
# If running shell code locally, continue to raise the PR
# Reinstate exit on unbound variables
set -euxo pipefail
set -euo pipefail
git status
if ! (git commit -as -S -m "Chore: Update DevOps tooling from central repository [skip ci]" \
Expand Down
62 changes: 62 additions & 0 deletions .github/workflows/notebooks.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
---
# Run all notebooks on every push
name: "🗒️ Build notebooks"

# yamllint disable-line rule:truthy
on:
workflow_dispatch:
pull_request:
types: [opened, reopened, edited, synchronize]

jobs:

parse-project-metadata:
name: "Determine Python versions"
# yamllint disable-line rule:line-length
uses: os-climate/devops-reusable-workflows/.github/workflows/pyproject-toml-fetch-matrix.yaml@main

notebook-build:
name: "Build and test Notebooks"
needs: [parse-project-metadata]
runs-on: ubuntu-latest
continue-on-error: true
# Don't run when pull request is merged
if: github.event.pull_request.merged == false

strategy:
fail-fast: false
matrix: ${{ fromJson(needs.parse-project-metadata.outputs.matrix) }}
steps:
- name: "Checkout repository"
uses: actions/checkout@v4

- name: "Set up Python ${{ matrix.python-version }}"
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: "Setup PDM for build commands"
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}

- name: "Install dependencies"
run: |
which python; which python3
python --version; python3 --version
python -m pip install --upgrade pip
pdm export -o requirements.txt
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .
pip install pytest nbmake
- name: "Test notebooks: pytest --nbmake"
run: pytest --nbmake -- **/*ipynb

- name: Upload logs as artefacts
if: always()
uses: actions/upload-artifact@v4
with:
name: debug-logs
path: /tmp/*.log
retention-days: 14
18 changes: 2 additions & 16 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
### SIGNING ###

- name: "Sign packages with Sigstore"
uses: sigstore/[email protected].0
uses: sigstore/[email protected].1
with:
inputs: >-
./dist/*.tar.gz
Expand Down Expand Up @@ -86,26 +86,12 @@ jobs:
name: ${{ github.ref_name }}
path: dist/

- name: "📦 Publish release to GitHub"
uses: ModeSevenIndustrialSolutions/action-automatic-releases@latest
with:
# Valid inputs are:
# repo_token, automatic_release_tag, draft, prerelease, title, files
repo_token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
automatic_release_tag: ${{ github.ref_name }}
title: ${{ github.ref_name }}
files: |
dist/*.tar.gz
dist/*.whl
dist/*.sigstore
- name: "📦 Publish artefacts to GitHub"
# https://github.com/softprops/action-gh-release
uses: softprops/action-gh-release@v2
with:
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: true
prerelease: false
tag_name: ${{ github.ref_name }}
name: "Test/Development Build \
${{ github.ref_name }}"
Expand Down
3 changes: 0 additions & 3 deletions .github/workflows/security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,3 @@ jobs:
- name: "Run: pip-audit"
uses: pypa/[email protected]
# with:
# ignore-vulns: |
# PYSEC-2023-163
3 changes: 2 additions & 1 deletion .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ jobs:
### SIGNING ###

- name: "Sign packages with Sigstore"
uses: sigstore/[email protected]
uses: sigstore/[email protected]

with:
inputs: >-
./dist/*.tar.gz
Expand Down
90 changes: 38 additions & 52 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ ci:
skip:
# pre-commit.ci cannot install WGET, so tomlint must be disabled
- tomllint
# - pre-commit-update

exclude: |
(?x)^(
Expand All @@ -14,12 +13,6 @@ exclude: |
repos:

# - repo: https://gitlab.com/vojko.pribudic/pre-commit-update
# rev: v0.1.0
# hooks:
# - id: pre-commit-update
# args: [--dry-run]

- repo: local
hooks:
- id: tomllint
Expand Down Expand Up @@ -52,7 +45,6 @@ repos:
args: ["--fix=lf"]
- id: name-tests-test
args: ["--pytest-test-first"]
# Do not allow direct push to main/master branches
- id: no-commit-to-branch
# - id: pretty-format-json
- id: requirements-txt-fixer
Expand All @@ -68,23 +60,22 @@ repos:

# Lint: Markdown
- repo: https://github.com/igorshubovych/markdownlint-cli
rev: v0.39.0
rev: v0.40.0
hooks:
- id: markdownlint
args: ["--fix"]

# - repo: https://github.com/asottile/pyupgrade
# rev: v3.15.0
# hooks:
# - id: pyupgrade
# args: ['--py37-plus']

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 24.4.0
rev: 24.4.2
hooks:
- id: black
- id: black-jupyter

- repo: https://github.com/tomcatling/black-nb
rev: '0.7'
hooks:
- id: black-nb

- repo: https://github.com/jorisroovers/gitlint
rev: v0.19.1
hooks:
Expand All @@ -100,64 +91,59 @@ repos:
rev: v0.10.0.1
hooks:
- id: shellcheck
# Optionally only show errors and warnings
# args: ["--severity=warning"]

# If you want to avoid flake8 errors due to unused vars or imports:
# - repo: https://github.com/PyCQA/autoflake
# rev: v2.0.0
# hooks:
# - id: autoflake
# args: [
# --in-place,
# --remove-all-unused-imports,
# --remove-unused-variables,
# ]
- repo: https://github.com/pycqa/pydocstyle.git
rev: 6.3.0
hooks:
- id: pydocstyle
additional_dependencies: ["tomli"]

- repo: https://github.com/PyCQA/isort
rev: 5.13.2
hooks:
- id: isort
args: ["--profile", "black"]

- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args: [
"-d",
"{rules: {line-length: {max: 120}},
ignore-from-file: [.gitignore],
}",
]

- repo: https://github.com/Mateusz-Grzelinski/actionlint-py
rev: v1.6.27.13
hooks:
- id: actionlint

# If like to embrace black styles even in the docs:
# - repo: https://github.com/asottile/blacken-docs
# rev: v1.13.0
# hooks:
# - id: blacken-docs
# additional_dependencies: [black]

- repo: https://github.com/pycqa/flake8
rev: "7.0.0"
hooks:
- id: flake8

# Check for misspells in documentation files:
# - repo: https://github.com/codespell-project/codespell
# rev: v2.2.2
# hooks:
# - id: codespell
- repo: https://github.com/adrienverge/yamllint.git
rev: v1.35.1
hooks:
- id: yamllint
args: [ "-d", "{rules: {line-length: {max: 120}}, ignore-from-file: [.gitignore],}", ]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: "v1.9.0"
rev: "v1.10.0"
hooks:
- id: mypy
verbose: true
args: [--show-error-codes]
additional_dependencies: ["pytest", "types-requests"]

# Check for misspellings in documentation files
# - repo: https://github.com/codespell-project/codespell
# rev: v2.2.2
# hooks:
# - id: codespell

# To embrace black styles, even in docs
# - repo: https://github.com/asottile/blacken-docs
# rev: v1.13.0
# hooks:
# - id: blacken-docs
# additional_dependencies: [black]

# Automatically upgrade Python syntax for newer versions
# - repo: https://github.com/asottile/pyupgrade
# rev: v3.15.0
# hooks:
# - id: pyupgrade
# args: ['--py37-plus']

0 comments on commit ea07a50

Please sign in to comment.