Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dependabot #1827

Merged
merged 15 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 13 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
26 changes: 1 addition & 25 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,30 +4,6 @@ version: 2
updates:
# GitHub Action update PRs
- package-ecosystem: "github-actions"
directory: "/" # Checks /.github/workflows/
directory: "/" # The exact logic is unclear, but it recursively searches at least .github/workflows/
schedule:
interval: "weekly"
# data_safe_haven pip dependency(pyproject.toml) update PRs
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
groups:
# Group all version updates into a single PR
all-dependencies:
applies-to: version-updates
patterns: ["*"]
# documentations pip dependency (pip-compile requirements.in, requirements.txt) update PRs
- package-ecosystem: "pip"
directory: "/docs/"
schedule:
interval: "monthly"
ignore:
# Don't open PRs for patch version updates for all packages
- update-types: ["version-update:semver-patch"]
dependency-name: "*"
groups:
# Group all version updates into a single PR
all-dependencies:
applies-to: version-updates
patterns: ["*"]
23 changes: 23 additions & 0 deletions .github/scripts/update_python_dependencies.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#! /bin/sh
jemrobinson marked this conversation as resolved.
Show resolved Hide resolved
set -e

# Check for required arguments
if [ "$#" -ne 2 ]; then
echo "Usage: update_python_dependencies [environment_name] [target]"
exit 1
fi
ENV_NAME=$1
TARGET=$2

# Check for pip-compile
if ! command -v pip-compile > /dev/null; then
echo "pip-compile could not be found"
exit 1
fi

# Run pip-compile
if [ "$ENV_NAME" = "default" ]; then
pip-compile -U pyproject.toml -o "$TARGET"
else
hatch env show --json | jq -r ".${ENV_NAME}.dependencies | .[]" | pip-compile -U - -o "$TARGET"
jemrobinson marked this conversation as resolved.
Show resolved Hide resolved
JimMadge marked this conversation as resolved.
Show resolved Hide resolved
fi
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Documentation
name: Build documentation

# Run workflow on pushes to matching branches
on: # yamllint disable-line rule:truthy
Expand All @@ -18,16 +18,17 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Sphinx build
run: |
make html SPHINXOPTS="-W"

- name: Install hatch
run: pip install hatch

- name: Build documentation
run: hatch run docs:build

check_links:
name: Check links
Expand All @@ -39,17 +40,18 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Sphinx build
# Set warnings to be treated as errors
run: |
make html SPHINXOPTS="-W"

- name: Install hatch
run: pip install hatch

- name: Build documentation
run: hatch run docs:build

- name: Link Checker
uses: lycheeverse/[email protected]
with:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/update_docker_versions.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
name: Update Pulumi Docker image versions
name: Update Docker image versions

on: # yamllint disable-line rule:truthy
schedule:
Expand Down Expand Up @@ -35,7 +35,7 @@ jobs:

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

- name: Create pull request
if: ${{ ! env.ACT }}
Expand Down
6 changes: 2 additions & 4 deletions .github/workflows/update_package_versions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,8 @@ name: Update package versions

# Run workflow on pushes to matching branches
on: # yamllint disable-line rule:truthy
push:
branches: [develop]
schedule:
- cron: "0 0 */7 * *" # run once per week
- cron: "0 3 * * 1" # run at 3:00 every Monday
workflow_dispatch: # allow this workflow to be manually triggered

# checkout needs 'contents:read'
Expand Down Expand Up @@ -50,7 +48,7 @@ jobs:

- name: Get current date
id: date
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

- name: Create pull request
if: ${{ ! env.ACT }}
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/update_python_dependencies.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
name: Update Python dependencies

# Run workflow on pushes to matching branches
on: # yamllint disable-line rule:truthy
schedule:
- cron: "0 3 * * 1" # run at 3:00 every Monday
workflow_dispatch: # allow this workflow to be manually triggered


jobs:
update_python_dependencies:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12

- name: Install dependencies
run: pip install hatch pip-tools

- name: Update 'default' dependencies
run: .github/scripts/update_python_dependencies.sh default requirements.txt

- name: Update 'docs' dependencies
run: .github/scripts/update_python_dependencies.sh docs docs/requirements.txt

- name: Check for changes
shell: bash
run: git --no-pager diff -- .

- name: Get current date
id: date
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT

- name: Create pull request
if: ${{ ! env.ACT }}
id: pull-request
uses: peter-evans/[email protected]
with:
commit-message: Update Python dependencies
committer: GitHub Actions <[email protected]>
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
base: develop
branch: python-dependencies
delete-branch: true
title: Update Python dependencies
body: |
### :arrow_heading_up: Summary
- Apply Python dependency diff from ${{ github.sha }} on ${{ steps.date.outputs.date }}

### :closed_umbrella: Related issues
None

### :microscope: Tests
Package versions only
labels: |
affected: developers
severity: minor
type: enhancement
draft: false
4 changes: 0 additions & 4 deletions docs/requirements.in

This file was deleted.

16 changes: 16 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,22 @@ path = "data_safe_haven/version.py"
[tool.hatch.envs.default]
pre-install-commands = ["pip install -r requirements.txt"]

[tool.hatch.envs.docs]
jemrobinson marked this conversation as resolved.
Show resolved Hide resolved
detached = true
dependencies = [
"emoji>=2.10.0",
"myst-parser>=2.0.0",
"pydata-sphinx-theme>=0.15.0",
"Sphinx>=7.3.0",
]
pre-install-commands = ["pip install -r docs/requirements.txt"]

[tool.hatch.envs.docs.scripts]
build = [
# Treat warnings as errors
"make -C docs html SPHINXOPTS='-W'"
]

[tool.hatch.envs.lint]
detached = true
dependencies = [
Expand Down