Skip to content

Commit 666ec6d

Browse files
committed
feat: Add configuration and validation for Docker image factory
- Implemented configuration models in `config.py` for managing distributions, package groups, and variants. - Introduced a validation system in `validator.py` to ensure configuration consistency and correctness. - Created `PKG-INFO` and other metadata files for packaging the project. - Defined entry points for command-line interface in `entry_points.txt`. - Added dependencies and development requirements in `requires.txt`.
1 parent 445c8b0 commit 666ec6d

22 files changed

Lines changed: 968 additions & 568 deletions

.github/workflows/feelpp-env.yml

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ on:
66
- master
77
paths:
88
- 'feelpp-env/**'
9+
- 'src/feelpp/docker/factory/**'
10+
- 'pyproject.toml'
911
- '.github/workflows/feelpp-env.yml'
1012
workflow_dispatch:
1113
inputs:
@@ -52,8 +54,8 @@ jobs:
5254
fail-fast: true
5355
max-parallel: 4
5456
matrix:
55-
# Auto-generated from: feelpp-env/factory.sh matrix --format yaml
56-
# To update: cd feelpp-env && ./factory.sh matrix --format yaml
57+
# Auto-generated from: feelpp-factory matrix --format yaml
58+
# To update: uv venv .venv && source .venv/bin/activate && uv pip install -e . && feelpp-factory matrix --format yaml
5759
include:
5860
- {service: feelpp-env, dist: trixie, flavor: debian, version: "13", tag: debian-13, experimental: false, platforms: "linux/amd64,linux/arm64", dockerfile: Dockerfile}
5961
- {service: feelpp-env, dist: testing, flavor: debian, version: "testing", tag: debian-testing, experimental: true, platforms: "linux/amd64", dockerfile: Dockerfile}
@@ -77,19 +79,17 @@ jobs:
7779
- name: Setup Python factory
7880
run: |
7981
echo "Setting up Python factory environment..."
80-
cd feelpp-env
8182
uv venv .venv
8283
source .venv/bin/activate
83-
uv pip install -q pyyaml jinja2 click rich pydantic
84-
./factory.sh validate
84+
uv pip install -q -e .
85+
.venv/bin/feelpp-factory validate
8586
- name: generate
8687
run: |
87-
./factory.sh generate --dist ${{ matrix.flavor }}:${{ matrix.version }}
88+
.venv/bin/feelpp-factory generate --dist ${{ matrix.flavor }}:${{ matrix.version }} --output-dir feelpp-env
8889
dir="${{ matrix.flavor }}-${{ matrix.version }}-clang++"
8990
echo "context=feelpp-env/${dir}" >> "$GITHUB_OUTPUT"
9091
ls -lrt
9192
id: generate
92-
working-directory: feelpp-env
9393
- name: Set up QEMU
9494
uses: docker/setup-qemu-action@v3
9595
- name: Set up Docker Buildx
@@ -135,19 +135,17 @@ jobs:
135135
- name: Setup Python factory
136136
run: |
137137
echo "Setting up Python factory environment..."
138-
cd feelpp-env
139138
uv venv .venv
140139
source .venv/bin/activate
141-
uv pip install -q pyyaml jinja2 click rich pydantic
142-
./factory.sh validate
140+
uv pip install -q -e .
141+
.venv/bin/feelpp-factory validate
143142
- name: generate
144143
run: |
145-
./factory.sh generate --dist ${{ inputs.flavor }}:${{ inputs.version }}
144+
.venv/bin/feelpp-factory generate --dist ${{ inputs.flavor }}:${{ inputs.version }} --output-dir feelpp-env
146145
dir="${{ inputs.flavor }}-${{ inputs.version }}-clang++"
147146
echo "context=feelpp-env/${dir}" >> "$GITHUB_OUTPUT"
148147
ls -lrt
149148
id: generate
150-
working-directory: feelpp-env
151149
- name: Set up QEMU
152150
uses: docker/setup-qemu-action@v3
153151
- name: Set up Docker Buildx
@@ -172,4 +170,4 @@ jobs:
172170
token: ${{ secrets.CR_PAT }}
173171
repository: feelpp/runners
174172
event-type: runner-update-baseimage
175-
client-payload: '{"flavor":"${{ inputs.flavor }}","version":"${{ inputs.version }}"}'
173+
client-payload: '{"flavor":"${{ inputs.flavor }}","version":"${{ inputs.version }}"}'

.github/workflows/test-factory.yml

Lines changed: 13 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ run-name: "Test Factory [${{ github.event_name }}]"
44
on:
55
pull_request:
66
paths:
7-
- 'feelpp-env/factory/**'
7+
- 'src/feelpp/docker/factory/**'
88
- 'feelpp-env/config/**'
99
- 'feelpp-env/templates/**'
10-
- 'feelpp-env/factory.sh'
10+
- 'pyproject.toml'
1111
- '.github/workflows/test-factory.yml'
1212
workflow_dispatch:
1313

@@ -19,41 +19,33 @@ jobs:
1919
steps:
2020
- uses: actions/checkout@v5
2121

22-
- name: Install uv
23-
run: |
24-
curl -LsSf https://astral.sh/uv/install.sh | sh
25-
echo "$HOME/.local/bin" >> $GITHUB_PATH
22+
- name: Setup uv
23+
uses: astral-sh/setup-uv@v5
24+
with:
25+
enable-cache: true
2626

2727
- name: Setup Python environment
28-
working-directory: feelpp-env
2928
run: |
3029
uv venv .venv
3130
source .venv/bin/activate
32-
uv pip install pyyaml jinja2 click rich pydantic
31+
uv pip install -e .
3332
3433
- name: Validate configuration
35-
working-directory: feelpp-env
3634
run: |
37-
source .venv/bin/activate
38-
./factory.sh validate
35+
.venv/bin/feelpp-factory validate
3936
4037
- name: Show configuration
41-
working-directory: feelpp-env
4238
run: |
43-
source .venv/bin/activate
44-
./factory.sh show --variant feelpp-env
39+
.venv/bin/feelpp-factory show --variant feelpp-env
4540
4641
- name: Generate all Dockerfiles
47-
working-directory: feelpp-env
4842
run: |
49-
source .venv/bin/activate
50-
./factory.sh generate --output-dir test-output
43+
.venv/bin/feelpp-factory generate --output-dir feelpp-env/test-output
5144
5245
- name: Verify ninja-build in all Dockerfiles
53-
working-directory: feelpp-env
5446
run: |
5547
echo "Checking for ninja-build in generated Dockerfiles..."
56-
for dockerfile in test-output/*/Dockerfile; do
48+
for dockerfile in feelpp-env/test-output/*/Dockerfile; do
5749
if ! grep -q "ninja-build" "$dockerfile"; then
5850
echo "ERROR: ninja-build missing in $dockerfile"
5951
exit 1
@@ -62,10 +54,9 @@ jobs:
6254
done
6355
6456
- name: Verify auxiliary files
65-
working-directory: feelpp-env
6657
run: |
6758
echo "Checking for auxiliary files..."
68-
for dir in test-output/*/; do
59+
for dir in feelpp-env/test-output/*/; do
6960
for file in Dockerfile bashrc.feelpp feelpp.conf.sh start.sh WELCOME; do
7061
if [ ! -f "$dir/$file" ]; then
7162
echo "ERROR: $file missing in $dir"
@@ -76,11 +67,9 @@ jobs:
7667
done
7768
7869
- name: Generate build matrix
79-
working-directory: feelpp-env
8070
run: |
81-
source .venv/bin/activate
8271
echo "Build matrix:"
83-
./factory.sh matrix
72+
.venv/bin/feelpp-factory matrix
8473
8574
- name: Lint Dockerfiles
8675
uses: hadolint/hadolint-action@v3.1.0

feelpp-env/compare.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,15 @@
33
set -euo pipefail
44

55
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
cd "$SCRIPT_DIR"
7+
PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
8+
9+
if [ ! -x ".venv/bin/feelpp-factory" ]; then
10+
uv venv .venv
11+
source .venv/bin/activate
12+
uv pip install -q -e "${PROJECT_ROOT}"
13+
fi
14+
FACTORY=".venv/bin/feelpp-factory"
615

716
echo "=== Dockerfile Comparison ==="
817
echo ""
@@ -51,7 +60,7 @@ if [ -f ".github/workflows/feelpp-env.yml" ]; then
5160
echo " Old workflow: ~$old_count distributions"
5261
fi
5362

54-
new_count=$(./factory.sh matrix --format json | grep -c '"service"' || echo 0)
63+
new_count=$("$FACTORY" matrix --format json | grep -c '"service"' || echo 0)
5564
echo " New factory: $new_count distributions"
5665

5766
echo ""

feelpp-env/config/variants.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ variants:
1414
- debian:testing
1515
- debian:sid
1616
- ubuntu:24.04
17-
# - ubuntu:26.04 # Disabled: resolute repositories not yet available on mirrors
17+
- ubuntu:26.04
1818
- fedora:42
1919
extra_packages:
2020
apt: []

feelpp-env/factory.sh

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)