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

feature/update cruft to 121653 #37

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/robert-koch-institut/mex-template",
"commit": "d1a461de3c7ff099045b71a156ad667887c32368",
"commit": "12165319453990fdbe02bce39a3236337e298bc0",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down
10 changes: 9 additions & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,22 @@ updates:
- package-ecosystem: "github-actions"
allow:
- dependency-type: "all"
assignees:
- ${{secrets.MEX_BOT_USER}}
directory: "/"
labels:
- "dependabot"
open-pull-requests-limit: 1
schedule:
interval: "monthly"
interval: "weekly"
- package-ecosystem: "pip"
allow:
- dependency-type: "all"
assignees:
- ${{secrets.MEX_BOT_USER}}
directory: "/"
labels:
- "dependabot"
open-pull-requests-limit: 1
schedule:
interval: "daily"
61 changes: 54 additions & 7 deletions .github/workflows/cookiecutter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ name: Cookiecutter

on:
push:
pull_request:
branches: ["main"]
tags: ["**"]
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
Expand All @@ -18,12 +19,13 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1
fetch-depth: 0
token: ${{ secrets.WORKFLOW_TOKEN }}

- name: Cache requirements
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
Expand All @@ -33,12 +35,57 @@ jobs:
${{ env.cache-name }}-

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Install requirements
run: make setup

- name: Check template
run: cruft check
- name: Configure git
env:
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
SIGNING_PUB: ${{ secrets.SIGNING_PUB }}
run: |
eval "$(ssh-agent -s)"
install --directory ~/.ssh --mode 700
base64 -d <<< '${{ secrets.SIGNING_KEY }}' > ~/.ssh/mex
base64 -d <<< '${{ secrets.SIGNING_PUB }}' > ~/.ssh/mex.pub
chmod 600 ~/.ssh/*
ssh-add ~/.ssh/mex
git config --local user.email ${{ vars.MEX_BOT_EMAIL }}
git config --local user.name ${{ vars.MEX_BOT_USER }}
git config --local gpg.format ssh
git config --local user.signingkey ~/.ssh/mex.pub
git config --local commit.gpgsign true

- name: Update template
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if cruft check; then
echo template is up to date
exit 0
fi
if [[ $(gh pr list --label cruft | wc -c) -ne 0 ]]; then
echo already seeing pull request
exit 0
fi
template_url=$(python -c "print(__import__('json').load(open('.cruft.json'))['template'])")
template_ref=$(git ls-remote ${template_url} --heads main --exit-code | cut -c -6)
git checkout main
git checkout -b cruft/cookiecutter-template-${template_ref}
cruft update --skip-apply-ask
printf '# Changes\n\n- bumped cookiecutter template to %s/commit/%s\n' "$template_url" "$template_ref" > .cruft-pr-body
if [[ $(git status --porcelain | grep .rej | wc -c) -ne 0 ]]; then
printf '\n# Conflicts\n' > .cruft-pr-body
fi
git status --porcelain | grep .rej | awk '{print $2;}' | while read -r line ; do
printf '\n```' >> .cruft-pr-body
cat ${line} >> .cruft-pr-body
printf '```\n' >> .cruft-pr-body
done
git add --all --verbose
git commit --message "Bump cookiecutter template to $template_ref" --verbose
git push --set-upstream origin cruft/cookiecutter-template-${template_ref} --force --verbose
gh pr create --title "Bump cookiecutter template to $template_ref" --body-file .cruft-pr-body --label cruft --assignee ${{ vars.MEX_BOT_USER }}
8 changes: 6 additions & 2 deletions .github/workflows/cve-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ on:
branches-ignore:
- 'dependabot/**'
pull_request:
types:
- opened
- reopened
- synchronize
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
Expand All @@ -18,12 +22,12 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Cache trivy
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-trivy
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ jobs:
timeout-minutes: 10
steps:
- name: Build, tag and push docker image to ghcr
uses: GlueOps/github-actions-build-push-containers@v0.1.3
uses: GlueOps/[email protected]
14 changes: 7 additions & 7 deletions .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Cache requirements
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
Expand All @@ -40,7 +40,7 @@ jobs:
${{ env.cache-name }}-

- name: Cache poetry
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-poetry
with:
Expand All @@ -50,12 +50,12 @@ jobs:
${{ env.cache-name }}-

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11

- name: Setup pages
uses: actions/configure-pages@v3
uses: actions/configure-pages@v4

- name: Install requirements
run: make install
Expand All @@ -64,7 +64,7 @@ jobs:
run: make docs

- name: Upload artifact
uses: actions/upload-pages-artifact@v2
uses: actions/upload-pages-artifact@v3
with:
path: ./docs/dist

Expand All @@ -77,4 +77,4 @@ jobs:
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
uses: actions/deploy-pages@v4
12 changes: 8 additions & 4 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Linting
on:
push:
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:

env:
Expand All @@ -16,12 +20,12 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Cache requirements
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-requirements
with:
Expand All @@ -31,7 +35,7 @@ jobs:
${{ env.cache-name }}-

- name: Cache poetry
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-poetry
with:
Expand All @@ -41,7 +45,7 @@ jobs:
${{ env.cache-name }}-

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/open-code.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
timeout-minutes: 10
steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
ref: 'main'
fetch-depth: 0
Expand Down
27 changes: 27 additions & 0 deletions .github/workflows/reviewing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Reviewing

on:
pull_request:
types:
- opened
- reopened

jobs:
assignee:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Add assignee
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
user_name="${{ github.event.pull_request.user.login }}"
user_type=$(gh api "users/${user_name}" --jq ".type")
echo $user_name is a $user_type
if [[ "$user_type" != "User" ]]; then
user_name="${{ vars.MEX_BOT_USER }}"
echo using $user_name instead
fi
if [[ -z "${{ github.event.pull_request.assignee.login }}" ]]; then
gh pr edit ${{ github.event.pull_request.html_url }} --add-assignee "${user_name}"
fi
8 changes: 6 additions & 2 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: Testing
on:
push:
pull_request:
types:
- opened
- reopened
- synchronize
workflow_dispatch:

env:
Expand Down Expand Up @@ -40,7 +44,7 @@ jobs:
${{ env.cache-name }}-

- name: Cache poetry
uses: actions/cache@v3
uses: actions/cache@v4
env:
cache-name: cache-poetry
with:
Expand All @@ -50,7 +54,7 @@ jobs:
${{ env.cache-name }}-

- name: Setup python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: 3.11

Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ dmypy.json
# ruff
.ruff_cache

# cruft
.cruft-pr-body
*.rej

# PyCharm
.idea/
.idea_modules/
Expand Down
10 changes: 8 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ default_language_version:
python: python3.11
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.2.0
rev: v0.3.0
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
Expand All @@ -20,8 +20,14 @@ repos:
exclude: .cruft.json
- id: check-yaml
name: yaml
- id: end-of-file-fixer
name: eof
- id: trailing-whitespace
name: whitespaces
- id: fix-byte-order-marker
name: byte-order
- repo: https://github.com/python-poetry/poetry
rev: 1.7.1
rev: 1.8.1
hooks:
- id: poetry-check
name: poetry
Expand Down
Loading
Loading