Compare commits
10
Commits
aebddb60a2
...
a8b7b59484
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a8b7b59484 | ||
|
|
0e6941dccf | ||
|
|
a6428ccd29 | ||
|
|
655fdc4ee8 | ||
|
|
e031c549e5 | ||
|
|
49b6238b7d | ||
|
|
0549358fe1 | ||
|
|
33efbd1005 | ||
|
|
24126e4044 | ||
|
|
f3b6cdbc9e |
@@ -17,7 +17,7 @@ on:
|
|||||||
env:
|
env:
|
||||||
REGISTRY: gitea.lille-vemmelund.dk
|
REGISTRY: gitea.lille-vemmelund.dk
|
||||||
REGISTRY_USER: ci-bot
|
REGISTRY_USER: ci-bot
|
||||||
IMAGE: gitea.lille-vemmelund.dk/brian/python-repositories-ci
|
IMAGE: gitea.lille-vemmelund.dk/lillevemmelund/python-repositories-ci
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
@@ -37,7 +37,7 @@ jobs:
|
|||||||
CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }}
|
CI_RUNNER_TOKEN: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
echo "$CI_RUNNER_TOKEN" > /tmp/uv_token
|
echo "$CI_RUNNER_TOKEN" > /tmp/uv_token
|
||||||
docker build -f docker/ci/Dockerfile \
|
docker build --network=host -f docker/ci/Dockerfile \
|
||||||
--secret id=uv_token,src=/tmp/uv_token \
|
--secret id=uv_token,src=/tmp/uv_token \
|
||||||
-t "${IMAGE}:latest" \
|
-t "${IMAGE}:latest" \
|
||||||
.
|
.
|
||||||
|
|||||||
@@ -8,23 +8,17 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
code-quality:
|
code-quality:
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Sync dependencies
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
env:
|
env:
|
||||||
UV_LINK_MODE: copy
|
UV_LINK_MODE: copy
|
||||||
run: uv sync --all-extras
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
run: uv sync --all-extras --frozen
|
||||||
|
|
||||||
- name: Type check with mypy
|
- name: Type check with mypy
|
||||||
run: uv run mypy .
|
run: uv run mypy .
|
||||||
|
|||||||
@@ -7,22 +7,17 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-check:
|
update-check:
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.CI_RUNNER_TOKEN }}
|
token: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Upgrade dependencies
|
- name: Upgrade dependencies
|
||||||
|
env:
|
||||||
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
run: uv lock --upgrade
|
run: uv lock --upgrade
|
||||||
|
|
||||||
- name: Commit and push changes
|
- name: Commit and push changes
|
||||||
|
|||||||
@@ -9,25 +9,24 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-publish:
|
build-and-publish:
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Update version in pyproject.toml to match tag
|
- name: Update version in pyproject.toml to match tag
|
||||||
|
env:
|
||||||
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
run: scripts/ci/bump-version.sh --from-tag "${GITHUB_REF##*/}"
|
run: scripts/ci/bump-version.sh --from-tag "${GITHUB_REF##*/}"
|
||||||
|
|
||||||
- name: Build package
|
- name: Build package
|
||||||
|
env:
|
||||||
|
UV_LINK_MODE: copy
|
||||||
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
run: |
|
run: |
|
||||||
uv sync --no-dev
|
uv sync --no-dev --frozen
|
||||||
uv build
|
uv build
|
||||||
|
|
||||||
- name: Publish to Gitea Package Registry
|
- name: Publish to Gitea Package Registry
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
if: ${{ !contains(github.event.head_commit.message, '[skip ci]') }}
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -22,19 +22,12 @@ jobs:
|
|||||||
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
COMMIT_MSG: ${{ github.event.head_commit.message }}
|
||||||
run: scripts/ci/parse-merge-commit.sh "$COMMIT_MSG"
|
run: scripts/ci/parse-merge-commit.sh "$COMMIT_MSG"
|
||||||
|
|
||||||
- name: Set up Python
|
|
||||||
if: steps.meta.outputs.bump != 'skip'
|
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
if: steps.meta.outputs.bump != 'skip'
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Bump version
|
- name: Bump version
|
||||||
if: steps.meta.outputs.bump != 'skip'
|
if: steps.meta.outputs.bump != 'skip'
|
||||||
id: bump
|
id: bump
|
||||||
|
env:
|
||||||
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
run: scripts/ci/bump-version.sh "${{ steps.meta.outputs.bump }}"
|
run: scripts/ci/bump-version.sh "${{ steps.meta.outputs.bump }}"
|
||||||
|
|
||||||
- name: Generate release notes
|
- name: Generate release notes
|
||||||
|
|||||||
@@ -7,23 +7,17 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
safety:
|
safety:
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Sync dependencies
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
env:
|
env:
|
||||||
UV_LINK_MODE: copy
|
UV_LINK_MODE: copy
|
||||||
run: uv sync
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
run: uv sync --frozen
|
||||||
|
|
||||||
- name: Run safety check
|
- name: Run safety check
|
||||||
run: uv run safety check
|
run: uv run safety check
|
||||||
|
|||||||
+15
-33
@@ -8,23 +8,17 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
unit-tests:
|
unit-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Sync dependencies
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
env:
|
env:
|
||||||
UV_LINK_MODE: copy
|
UV_LINK_MODE: copy
|
||||||
run: uv sync --all-extras
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
run: uv sync --all-extras --frozen
|
||||||
|
|
||||||
- name: Run unit tests
|
- name: Run unit tests
|
||||||
run: |
|
run: |
|
||||||
@@ -43,23 +37,17 @@ jobs:
|
|||||||
compression-level: 0
|
compression-level: 0
|
||||||
|
|
||||||
integration-tests:
|
integration-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Sync dependencies
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
env:
|
env:
|
||||||
UV_LINK_MODE: copy
|
UV_LINK_MODE: copy
|
||||||
run: uv sync --all-extras
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
run: uv sync --all-extras --frozen
|
||||||
|
|
||||||
- name: Verify Docker
|
- name: Verify Docker
|
||||||
run: docker info
|
run: docker info
|
||||||
@@ -83,24 +71,18 @@ jobs:
|
|||||||
coverage-report:
|
coverage-report:
|
||||||
# Merges unit + integration coverage and enforces fail_under from pyproject.toml.
|
# Merges unit + integration coverage and enforces fail_under from pyproject.toml.
|
||||||
needs: [unit-tests, integration-tests]
|
needs: [unit-tests, integration-tests]
|
||||||
runs-on: ubuntu-latest
|
runs-on: python-repositories-ci
|
||||||
if: github.event_name == 'pull_request' || github.event_name == 'push'
|
if: github.event_name == 'pull_request' || github.event_name == 'push'
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Sync dependencies
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
|
||||||
python-version-file: .python-version
|
|
||||||
|
|
||||||
- name: Install uv
|
|
||||||
run: pip install uv
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
env:
|
env:
|
||||||
UV_LINK_MODE: copy
|
UV_LINK_MODE: copy
|
||||||
run: uv sync --all-extras
|
UV_INDEX_GITEA_USERNAME: ci-bot
|
||||||
|
UV_INDEX_GITEA_PASSWORD: ${{ secrets.CI_RUNNER_TOKEN }}
|
||||||
|
run: uv sync --all-extras --frozen
|
||||||
|
|
||||||
- name: Download unit coverage
|
- name: Download unit coverage
|
||||||
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
uses: https://github.com/christopherHX/gitea-download-artifact@v4
|
||||||
|
|||||||
@@ -5,10 +5,10 @@ RUN apt-get update \
|
|||||||
&& apt-get install -y --no-install-recommends \
|
&& apt-get install -y --no-install-recommends \
|
||||||
ca-certificates \
|
ca-certificates \
|
||||||
curl \
|
curl \
|
||||||
docker.io \
|
|
||||||
git \
|
git \
|
||||||
&& rm -rf /var/lib/apt/lists/*
|
&& rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
COPY --from=docker:27-cli /usr/local/bin/docker /usr/local/bin/docker
|
||||||
COPY --from=ghcr.io/astral-sh/uv:0.7.0 /uv /usr/local/bin/uv
|
COPY --from=ghcr.io/astral-sh/uv:0.7.0 /uv /usr/local/bin/uv
|
||||||
|
|
||||||
ENV UV_PYTHON_INSTALL_DIR=/opt/uv-python \
|
ENV UV_PYTHON_INSTALL_DIR=/opt/uv-python \
|
||||||
|
|||||||
+5
-5
@@ -14,10 +14,10 @@ Built from [`docker/ci/Dockerfile`](../docker/ci/Dockerfile):
|
|||||||
- Docker CLI (integration tests via testcontainers)
|
- Docker CLI (integration tests via testcontainers)
|
||||||
- Dev dependencies from `uv.lock` (`uv sync --all-extras --no-install-project`)
|
- Dev dependencies from `uv.lock` (`uv sync --all-extras --no-install-project`)
|
||||||
|
|
||||||
Published to the Gitea container registry:
|
Published to the Gitea container registry (owner segment must be lowercase for Docker):
|
||||||
|
|
||||||
- `gitea.lille-vemmelund.dk/brian/python-repositories-ci:latest`
|
- `gitea.lille-vemmelund.dk/lillevemmelund/python-repositories-ci:latest`
|
||||||
- `gitea.lille-vemmelund.dk/brian/python-repositories-ci:YYYYMMDDHHmm` (timestamped rollback tag)
|
- `gitea.lille-vemmelund.dk/lillevemmelund/python-repositories-ci:YYYYMMDDHHmm` (timestamped rollback tag)
|
||||||
|
|
||||||
## Rebuild triggers
|
## Rebuild triggers
|
||||||
|
|
||||||
@@ -108,7 +108,7 @@ homelab-platform
|
|||||||
[`platform/gitea-runners/values.yaml`](https://gitea.lille-vemmelund.dk/LilleVemmelund/homelab-platform/src/branch/main/platform/gitea-runners/values.yaml):
|
[`platform/gitea-runners/values.yaml`](https://gitea.lille-vemmelund.dk/LilleVemmelund/homelab-platform/src/branch/main/platform/gitea-runners/values.yaml):
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
python-repositories-ci:docker://gitea.lille-vemmelund.dk/brian/python-repositories-ci:latest
|
python-repositories-ci:docker://gitea.lille-vemmelund.dk/lillevemmelund/python-repositories-ci:latest
|
||||||
```
|
```
|
||||||
|
|
||||||
After label changes, roll runner pods so they re-register with Gitea.
|
After label changes, roll runner pods so they re-register with Gitea.
|
||||||
@@ -137,7 +137,7 @@ bash scripts/ci/build-ci-image.sh --push
|
|||||||
```
|
```
|
||||||
|
|
||||||
Run from the repo root on the branch you want to test. Runners pull
|
Run from the repo root on the branch you want to test. Runners pull
|
||||||
`gitea.lille-vemmelund.dk/brian/python-repositories-ci:latest` from the registry;
|
`gitea.lille-vemmelund.dk/lillevemmelund/python-repositories-ci:latest` from the registry;
|
||||||
they do not care which git branch built it.
|
they do not care which git branch built it.
|
||||||
|
|
||||||
Override registry settings if needed:
|
Override registry settings if needed:
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
# Optional overrides:
|
# Optional overrides:
|
||||||
# REGISTRY=gitea.lille-vemmelund.dk
|
# REGISTRY=gitea.lille-vemmelund.dk
|
||||||
# REGISTRY_USER=ci-bot
|
# REGISTRY_USER=ci-bot
|
||||||
# IMAGE_OWNER=brian
|
# IMAGE_OWNER=lillevemmelund
|
||||||
# IMAGE_NAME=python-repositories-ci
|
# IMAGE_NAME=python-repositories-ci
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
@@ -24,7 +24,7 @@ REPO_ROOT="$(cd "${SCRIPT_DIR}/../.." && pwd)"
|
|||||||
|
|
||||||
REGISTRY="${REGISTRY:-gitea.lille-vemmelund.dk}"
|
REGISTRY="${REGISTRY:-gitea.lille-vemmelund.dk}"
|
||||||
REGISTRY_USER="${REGISTRY_USER:-ci-bot}"
|
REGISTRY_USER="${REGISTRY_USER:-ci-bot}"
|
||||||
IMAGE_OWNER="${IMAGE_OWNER:-brian}"
|
IMAGE_OWNER="${IMAGE_OWNER:-lillevemmelund}"
|
||||||
IMAGE_NAME="${IMAGE_NAME:-python-repositories-ci}"
|
IMAGE_NAME="${IMAGE_NAME:-python-repositories-ci}"
|
||||||
IMAGE="${IMAGE:-${REGISTRY}/${IMAGE_OWNER}/${IMAGE_NAME}}"
|
IMAGE="${IMAGE:-${REGISTRY}/${IMAGE_OWNER}/${IMAGE_NAME}}"
|
||||||
|
|
||||||
@@ -52,7 +52,7 @@ cd "$REPO_ROOT"
|
|||||||
|
|
||||||
if [[ "$MODE" == "local" ]]; then
|
if [[ "$MODE" == "local" ]]; then
|
||||||
echo "=== Building local CI image (no push): python-repositories-ci:local ==="
|
echo "=== Building local CI image (no push): python-repositories-ci:local ==="
|
||||||
docker build -f docker/ci/Dockerfile \
|
docker build --network=host -f docker/ci/Dockerfile \
|
||||||
--secret "id=uv_token,src=${TOKEN_FILE}" \
|
--secret "id=uv_token,src=${TOKEN_FILE}" \
|
||||||
-t python-repositories-ci:local \
|
-t python-repositories-ci:local \
|
||||||
.
|
.
|
||||||
@@ -64,7 +64,7 @@ echo "=== Logging in to ${REGISTRY} as ${REGISTRY_USER} ==="
|
|||||||
echo "$CI_RUNNER_TOKEN" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
|
echo "$CI_RUNNER_TOKEN" | docker login "$REGISTRY" -u "$REGISTRY_USER" --password-stdin
|
||||||
|
|
||||||
echo "=== Building ${IMAGE}:latest ==="
|
echo "=== Building ${IMAGE}:latest ==="
|
||||||
docker build -f docker/ci/Dockerfile \
|
docker build --network=host -f docker/ci/Dockerfile \
|
||||||
--secret "id=uv_token,src=${TOKEN_FILE}" \
|
--secret "id=uv_token,src=${TOKEN_FILE}" \
|
||||||
-t "${IMAGE}:latest" \
|
-t "${IMAGE}:latest" \
|
||||||
.
|
.
|
||||||
|
|||||||
Reference in New Issue
Block a user