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
12 changes: 12 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
version: 2
updates:

- package-ecosystem: "github-actions"
commit-message:
include: "scope"
prefix: "Actions"
directory: "/"
labels:
- "enhancement"
schedule:
interval: "weekly"
23 changes: 23 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright (c) 2024 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later

name: Enforce codespell-clean spelling

on:
pull_request:
push:
schedule:
- cron: '0 2 * * 5' # Every Friday at 2am
workflow_dispatch:

# Drop permissions to minimum, for security
permissions:
contents: read

jobs:
codespell:
name: Enforce codespell-clean spelling
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- uses: codespell-project/actions-codespell@94259cd8be02ad2903ba34a22d9c13de21a74461 # v2.0
12 changes: 12 additions & 0 deletions .github/workflows/dummy-portageq.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#! /usr/bin/env bash
mirrors=(
http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/
http://ftp-stud.hs-esslingen.de/pub/Mirrors/gentoo/
http://ftp.uni-erlangen.de/pub/mirrors/gentoo/
http://ftp.halifax.rwth-aachen.de/gentoo/
http://linux.rz.ruhr-uni-bochum.de/download/gentoo-mirror/
ftp://ftp.wh2.tu-dresden.de/pub/mirrors/gentoo/
ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo/
ftp://ftp.tu-clausthal.de/pub/linux/gentoo/
)
echo "${mirrors[@]}"
63 changes: 63 additions & 0 deletions .github/workflows/pre-commit-detect-outdated.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Copyright (c) 2024 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later

name: Detect outdated pre-commit hooks

on:
schedule:
- cron: '0 16 * * 5' # Every Friday 4pm
workflow_dispatch:

# NOTE: This will drop all permissions from GITHUB_TOKEN except metadata read,
# and then (re)add the ones listed below:
permissions:
contents: write
pull-requests: write

jobs:
pre_commit_detect_outdated:
name: Detect outdated pre-commit hooks
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2

- name: Set up Python 3.13
uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: 3.13

- name: Install pre-commit
run: |-
pip install \
--disable-pip-version-check \
--no-warn-script-location \
--user \
pre-commit
echo "PATH=${HOME}/.local/bin:${PATH}" >> "${GITHUB_ENV}"

- name: Check for outdated hooks
run: |-
pre-commit autoupdate
git diff -- .pre-commit-config.yaml

- name: Create pull request from changes (if any)
id: create-pull-request
uses: peter-evans/create-pull-request@5b4a9f6a9e2af26e5f02351490b90d01eb8ec1e5 # v5.0.0
with:
author: 'pre-commit <pre-commit@tools.invalid>'
base: master
body: |-
For your consideration.

:warning: Please **CLOSE AND RE-OPEN** this pull request so that [further workflow runs get triggered](https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs) for this pull request.
branch: precommit-autoupdate
commit-message: "pre-commit: Autoupdate"
delete-branch: true
draft: true
labels: enhancement
title: "pre-commit: Autoupdate"

- name: Log pull request URL
if: "${{ steps.create-pull-request.outputs.pull-request-url }}"
run: |
echo "Pull request URL is: ${{ steps.create-pull-request.outputs.pull-request-url }}"
26 changes: 26 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (c) 2024 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later

name: Run pre-commit

# Drop permissions to minimum, for security
permissions:
contents: read

on:
pull_request:
push:
schedule:
- cron: '0 3 * * 5' # Every Friday at 3am
workflow_dispatch:

jobs:
pre-commit:
name: Run pre-commit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: 3.13
- uses: pre-commit/action@646c83fcd040023954eafda54b4db0192ce70507 # v3.0.0
64 changes: 64 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright (c) 2024 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later

name: Run the test suite

# Drop permissions to minimum, for security
permissions:
contents: read

on:
pull_request:
push:
schedule:
- cron: '0 3 * * 5' # Every Friday at 3am
workflow_dispatch:

jobs:
run-tests:
name: Run the test suite
strategy:
matrix:
python-version: [3.9, 3.13] # no particular need for in-between versions
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
- uses: actions/setup-python@d27e3f3d7c64b4bbf8e4abfb9b63b83e846e0435 # v4.5.0
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends --yes -V \
aria2

- name: Install fetchcommandwrapper
run: |
set -x -u
pip3 install -e .
echo "${HOME}/.local/bin" >> "${GITHUB_PATH}"

- name: Install dummy portageq
run: |
sudo cp -v .github/workflows/dummy-portageq.sh /usr/bin/portageq
sudo chmod a+x /usr/bin/portageq

- name: Run smoke tests
run: |
set -x

python3 --version
head -n1 "$(type -P fetchcommandwrapper)"

fetchcommandwrapper --help
fetchcommandwrapper --version

args=(
--link-speed 100000
http://ftp.spline.inf.fu-berlin.de/mirrors/gentoo/distfiles/4f/isomaster-1.3.17.tar.bz2
./
isomaster-1.3.17.tar.bz2
)

fetchcommandwrapper --fresh "${args[@]}"
fetchcommandwrapper --continue "${args[@]}"
20 changes: 20 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Copyright (c) 2024 Sebastian Pipping <sebastian@pipping.org>
# Licensed under GPL v3 or later

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-merge-conflict
- id: check-toml
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.7.1
hooks:
- id: ruff
args:
- --fix
- id: ruff-format
Loading