Files
create-linux-swapfile/.github/workflows/ci.yml
Kevin Veen-Birkenbach 02760e5864 feat: package as pip-installable distribution
Turns the loose main.py into the 'swap-forge' distribution with a src layout, shipping both the swap-forge and the older swafo command.

A failing swap command no longer produces a traceback: CalledProcessError is caught and reported as "'mkswap' failed with exit code 1" at exit 1, a missing binary as exit 127. Required binaries are declared per filesystem path so an ext4 host is never asked for btrfs tooling.

The fstab entry is still written last, after swapon, so a failed activation leaves /etc/fstab untouched. The e2e suite proves that byte for byte across a create, a same-size rerun and a resize cycle, with real fallocate, chmod and file sizes.

Adds unit, integration and container-based e2e tests, ruff and markdown/mermaid linting, CodeQL and Dependabot, and pins the core metadata to 2.4 so twine accepts the artifacts.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-14 14:28:08 +02:00

81 lines
1.5 KiB
YAML

name: CI
on:
push:
pull_request:
jobs:
test-and-lint:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- name: Install package and tooling
shell: bash
run: |
set -euo pipefail
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install ruff
- name: Ruff (lint)
shell: bash
run: |
set -euo pipefail
ruff check .
- name: Ruff (format check)
shell: bash
run: |
set -euo pipefail
ruff format --check .
- name: Unit tests
shell: bash
run: |
set -euo pipefail
make test-unit
- name: Integration tests
shell: bash
run: |
set -euo pipefail
make test-integration
docs:
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Markdown and mermaid lint
shell: bash
run: |
set -euo pipefail
make lint-docs
e2e:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v4
- name: End-to-end tests in a container
shell: bash
run: |
set -euo pipefail
make test-e2e