mirror of
https://github.com/funkemunky/KDE-x86_64-v4-Fedora.git
synced 2026-05-31 09:01:56 +00:00
Adding GitHub build pipeline
This commit is contained in:
@@ -0,0 +1,270 @@
|
||||
name: Build Fedora RPMs
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
package_kind:
|
||||
description: "Interpret package_input as source or binary package names"
|
||||
required: true
|
||||
default: "source"
|
||||
type: choice
|
||||
options:
|
||||
- source
|
||||
- binary
|
||||
package_input:
|
||||
description: "Comma, space, or newline separated package list. Leave blank to use a manifest batch."
|
||||
required: false
|
||||
default: ""
|
||||
type: string
|
||||
batch_index:
|
||||
description: "1-based manifest batch index used when package_input is blank"
|
||||
required: true
|
||||
default: "1"
|
||||
type: string
|
||||
batch_size:
|
||||
description: "Manifest batch size used when package_input is blank"
|
||||
required: true
|
||||
default: "8"
|
||||
type: string
|
||||
source_manifest:
|
||||
description: "Checked-in source manifest path"
|
||||
required: true
|
||||
default: "manifests/fedora-43/source-packages.txt"
|
||||
type: string
|
||||
source_map:
|
||||
description: "Checked-in binary to source map path"
|
||||
required: true
|
||||
default: "manifests/fedora-43/source-map.tsv"
|
||||
type: string
|
||||
fedora_branch:
|
||||
description: "Fedora dist-git branch"
|
||||
required: true
|
||||
default: "f43"
|
||||
type: string
|
||||
fedora_release:
|
||||
description: "Fedora container release"
|
||||
required: true
|
||||
default: "43"
|
||||
type: string
|
||||
optimization_level:
|
||||
description: "Compiler optimization level"
|
||||
required: true
|
||||
default: "-O3"
|
||||
type: choice
|
||||
options:
|
||||
- -O2
|
||||
- -O3
|
||||
target_march:
|
||||
description: "Target march override"
|
||||
required: true
|
||||
default: "x86-64-v4"
|
||||
type: string
|
||||
max_parallel:
|
||||
description: "Maximum concurrent package builds in the matrix"
|
||||
required: true
|
||||
default: "4"
|
||||
type: string
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
|
||||
jobs:
|
||||
prepare:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
matrix: ${{ steps.select.outputs.matrix }}
|
||||
package_count: ${{ steps.select.outputs.package_count }}
|
||||
max_parallel: ${{ steps.select.outputs.max_parallel }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- id: select
|
||||
env:
|
||||
PACKAGE_KIND: ${{ inputs.package_kind }}
|
||||
PACKAGE_INPUT: ${{ inputs.package_input }}
|
||||
BATCH_INDEX: ${{ inputs.batch_index }}
|
||||
BATCH_SIZE: ${{ inputs.batch_size }}
|
||||
SOURCE_MANIFEST: ${{ inputs.source_manifest }}
|
||||
SOURCE_MAP: ${{ inputs.source_map }}
|
||||
MAX_PARALLEL: ${{ inputs.max_parallel }}
|
||||
run: |
|
||||
python3 <<'PY'
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
source_manifest = Path(os.environ["SOURCE_MANIFEST"])
|
||||
source_map_path = Path(os.environ["SOURCE_MAP"])
|
||||
package_kind = os.environ["PACKAGE_KIND"].strip()
|
||||
package_input = os.environ["PACKAGE_INPUT"]
|
||||
batch_index = int(os.environ["BATCH_INDEX"])
|
||||
batch_size = int(os.environ["BATCH_SIZE"])
|
||||
max_parallel = int(os.environ["MAX_PARALLEL"])
|
||||
|
||||
source_packages = [
|
||||
line.strip()
|
||||
for line in source_manifest.read_text(encoding="ascii").splitlines()
|
||||
if line.strip()
|
||||
]
|
||||
|
||||
binary_to_source = {}
|
||||
for line in source_map_path.read_text(encoding="ascii").splitlines():
|
||||
if not line.strip():
|
||||
continue
|
||||
binary_name, source_name = line.split("\t", 1)
|
||||
binary_to_source[binary_name] = source_name
|
||||
|
||||
def tokenize(raw: str):
|
||||
parts = re.split(r"[\s,]+", raw.strip())
|
||||
return [part for part in parts if part]
|
||||
|
||||
if package_input.strip():
|
||||
selected = tokenize(package_input)
|
||||
else:
|
||||
start = max(batch_index - 1, 0) * batch_size
|
||||
end = start + batch_size
|
||||
selected = source_packages[start:end]
|
||||
|
||||
if package_kind == "binary":
|
||||
mapped = []
|
||||
missing = []
|
||||
for binary_name in selected:
|
||||
source_name = binary_to_source.get(binary_name)
|
||||
if source_name is None:
|
||||
missing.append(binary_name)
|
||||
else:
|
||||
mapped.append(source_name)
|
||||
if missing:
|
||||
raise SystemExit(
|
||||
"Missing binary-to-source mappings for: " + ", ".join(sorted(missing))
|
||||
)
|
||||
selected = mapped
|
||||
|
||||
deduped = []
|
||||
seen = set()
|
||||
for package_name in selected:
|
||||
if package_name not in seen:
|
||||
seen.add(package_name)
|
||||
deduped.append(package_name)
|
||||
|
||||
matrix = [{"package": package_name} for package_name in deduped]
|
||||
|
||||
github_output = Path(os.environ["GITHUB_OUTPUT"])
|
||||
with github_output.open("a", encoding="utf-8") as fh:
|
||||
fh.write(f"matrix={json.dumps(matrix)}\n")
|
||||
fh.write(f"package_count={len(matrix)}\n")
|
||||
fh.write(f"max_parallel={max_parallel}\n")
|
||||
PY
|
||||
|
||||
- name: Summarize selection
|
||||
run: |
|
||||
echo "Selected packages: ${{ steps.select.outputs.package_count }}" >> "$GITHUB_STEP_SUMMARY"
|
||||
echo '${{ steps.select.outputs.matrix }}' >> "$GITHUB_STEP_SUMMARY"
|
||||
|
||||
build:
|
||||
needs: prepare
|
||||
if: ${{ needs.prepare.outputs.package_count != '0' }}
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: fedora:${{ inputs.fedora_release }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
max-parallel: ${{ fromJSON(needs.prepare.outputs.max_parallel) }}
|
||||
matrix:
|
||||
include: ${{ fromJSON(needs.prepare.outputs.matrix) }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Install RPM build tooling
|
||||
run: |
|
||||
dnf -y update
|
||||
dnf -y install \
|
||||
ca-certificates \
|
||||
dnf-plugins-core \
|
||||
fedpkg \
|
||||
findutils \
|
||||
git \
|
||||
rpm-build \
|
||||
rpmdevtools \
|
||||
which
|
||||
|
||||
- name: Configure x86-64-v4 RPM macros
|
||||
env:
|
||||
OPT_LEVEL: ${{ inputs.optimization_level }}
|
||||
TARGET_MARCH: ${{ inputs.target_march }}
|
||||
run: |
|
||||
cat > /root/.rpmmacros <<EOF
|
||||
%optflags ${OPT_LEVEL} -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=${TARGET_MARCH} -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
|
||||
EOF
|
||||
cat /root/.rpmmacros
|
||||
|
||||
- name: Clone Fedora dist-git
|
||||
env:
|
||||
PACKAGE_NAME: ${{ matrix.package }}
|
||||
FEDORA_BRANCH: ${{ inputs.fedora_branch }}
|
||||
run: |
|
||||
git clone --depth 1 --branch "${FEDORA_BRANCH}" "https://src.fedoraproject.org/rpms/${PACKAGE_NAME}.git" "${PACKAGE_NAME}"
|
||||
|
||||
- name: Fetch lookaside sources
|
||||
env:
|
||||
PACKAGE_NAME: ${{ matrix.package }}
|
||||
run: |
|
||||
cd "${PACKAGE_NAME}"
|
||||
fedpkg sources
|
||||
|
||||
- name: Install BuildRequires
|
||||
env:
|
||||
PACKAGE_NAME: ${{ matrix.package }}
|
||||
run: |
|
||||
cd "${PACKAGE_NAME}"
|
||||
SPEC_FILE="$(find . -maxdepth 1 -name '*.spec' | head -n 1)"
|
||||
test -n "${SPEC_FILE}"
|
||||
dnf -y builddep "${SPEC_FILE}"
|
||||
|
||||
- name: Build SRPM and RPMs
|
||||
env:
|
||||
PACKAGE_NAME: ${{ matrix.package }}
|
||||
run: |
|
||||
TOPDIR="${GITHUB_WORKSPACE}/.rpmbuild/${PACKAGE_NAME}"
|
||||
mkdir -p "${TOPDIR}"/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
|
||||
cd "${PACKAGE_NAME}"
|
||||
SPEC_FILE="$(find . -maxdepth 1 -name '*.spec' | head -n 1)"
|
||||
test -n "${SPEC_FILE}"
|
||||
rpmbuild -ba "${SPEC_FILE}" \
|
||||
--define "_topdir ${TOPDIR}" \
|
||||
--define "_builddir ${TOPDIR}/BUILD" \
|
||||
--define "_buildrootdir ${TOPDIR}/BUILDROOT" \
|
||||
--define "_rpmdir ${TOPDIR}/RPMS" \
|
||||
--define "_srcrpmdir ${TOPDIR}/SRPMS" \
|
||||
--define "_sourcedir ${PWD}" \
|
||||
--define "_specdir ${PWD}"
|
||||
|
||||
- name: Collect artifacts
|
||||
env:
|
||||
PACKAGE_NAME: ${{ matrix.package }}
|
||||
run: |
|
||||
OUTDIR="${GITHUB_WORKSPACE}/artifacts/${PACKAGE_NAME}"
|
||||
mkdir -p "${OUTDIR}"
|
||||
find "${GITHUB_WORKSPACE}/.rpmbuild/${PACKAGE_NAME}/RPMS" -type f -name '*.rpm' -exec cp -v {} "${OUTDIR}/" \;
|
||||
find "${GITHUB_WORKSPACE}/.rpmbuild/${PACKAGE_NAME}/SRPMS" -type f -name '*.src.rpm' -exec cp -v {} "${OUTDIR}/" \;
|
||||
ls -la "${OUTDIR}"
|
||||
|
||||
- name: Upload RPM artifacts
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: rpm-${{ matrix.package }}
|
||||
path: artifacts/${{ matrix.package }}/
|
||||
if-no-files-found: error
|
||||
|
||||
- name: Append build summary
|
||||
if: always()
|
||||
env:
|
||||
PACKAGE_NAME: ${{ matrix.package }}
|
||||
run: |
|
||||
echo "### ${PACKAGE_NAME}" >> "$GITHUB_STEP_SUMMARY"
|
||||
if [ -d "artifacts/${PACKAGE_NAME}" ]; then
|
||||
find "artifacts/${PACKAGE_NAME}" -maxdepth 1 -type f | sort >> "$GITHUB_STEP_SUMMARY"
|
||||
else
|
||||
echo "No artifacts collected." >> "$GITHUB_STEP_SUMMARY"
|
||||
fi
|
||||
@@ -1,50 +1,54 @@
|
||||
# Fedora 43 KDE x86-64-v4 COPR Repo
|
||||
# Fedora 43 KDE GitHub Actions RPM Builder
|
||||
|
||||
This repository is a static input repo for a personal COPR project on
|
||||
`copr.fedorainfracloud.org`.
|
||||
This repository is a static GitHub Actions input repo for rebuilding Fedora 43
|
||||
KDE packages from Fedora dist-git with `x86-64-v4` code generation and `-O3`
|
||||
optimization.
|
||||
|
||||
It contains:
|
||||
## What Is Checked In
|
||||
|
||||
- a buildroot macro RPM that forces `x86-64-v4` optimization
|
||||
- the Fedora 43 KDE binary package manifest
|
||||
- the Fedora 43 KDE source package manifest
|
||||
- the binary-to-source mapping used to populate the COPR project
|
||||
- Fedora 43 KDE binary package manifest:
|
||||
[binary-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/binary-packages.txt)
|
||||
- Fedora 43 source package manifest:
|
||||
[source-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-packages.txt)
|
||||
- Binary to source mapping:
|
||||
[source-map.tsv](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-map.tsv)
|
||||
- A reference macro RPM spec showing the intended RPM flag override:
|
||||
[custom-macros.spec](/home/dawson/Dev/MIsc/KDE-x86_64-v4/packaging/custom-macros/custom-macros.spec)
|
||||
- On-demand GitHub Actions workflow:
|
||||
[build-fedora-rpms.yml](/home/dawson/Dev/MIsc/KDE-x86_64-v4/.github/workflows/build-fedora-rpms.yml)
|
||||
|
||||
It does not contain queueing or automation scripts.
|
||||
The checked-in manifests currently cover:
|
||||
|
||||
## Purpose
|
||||
- 342 Fedora 43 binary packages
|
||||
- 265 Fedora 43 source packages
|
||||
|
||||
The target package set is Fedora 43 `KDE Plasma Workspaces`, based on the
|
||||
Fedora KDE spin package selection:
|
||||
## Build Model
|
||||
|
||||
- environment: `kde-desktop-environment`
|
||||
- extra groups: `firefox`, `kde-apps`, `kde-media`, `kde-pim`,
|
||||
`kde-spin-initial-setup`, `libreoffice`
|
||||
- Fedora KDE spin additions such as `fedora-release-kde`, `plasma-welcome-fedora`,
|
||||
`kde-l10n`, `fuse`, `mediawriter`, `libreoffice-draw`, `libreoffice-math`
|
||||
- Fedora KDE spin removals such as `admin-tools`, `tracker`, `tracker-miners`,
|
||||
`mariadb-server-utils`, `ktorrent`, `digikam`, `kipi-plugins`, `krusader`, `k3b`
|
||||
The workflow does not use COPR. It does this instead:
|
||||
|
||||
The checked-in manifests currently resolve to:
|
||||
1. Reads package selections from the checked-in source manifest or from a manual dispatch input.
|
||||
2. Clones each selected Fedora dist-git repository from `src.fedoraproject.org`.
|
||||
3. Fetches source tarballs from Fedora lookaside using `fedpkg sources`.
|
||||
4. Installs `BuildRequires` with `dnf builddep`.
|
||||
5. Rebuilds the package with RPM macros overriding `%optflags` to:
|
||||
`-O3 -march=x86-64-v4`
|
||||
6. Uploads the built `.rpm` and `.src.rpm` files as GitHub Actions artifacts.
|
||||
|
||||
- 342 binary packages in [binary-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/binary-packages.txt)
|
||||
- 265 source packages in [source-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-packages.txt)
|
||||
## Using The Workflow
|
||||
|
||||
## Repo Contents
|
||||
Run the `Build Fedora RPMs` workflow manually with `workflow_dispatch`.
|
||||
|
||||
- Macro RPM spec: [custom-macros.spec](/home/dawson/Dev/MIsc/KDE-x86_64-v4/packaging/custom-macros/custom-macros.spec)
|
||||
- Binary package list: [binary-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/binary-packages.txt)
|
||||
- Source package list: [source-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-packages.txt)
|
||||
- Binary to source mapping: [source-map.tsv](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-map.tsv)
|
||||
- COPR setup notes: [project-setup.md](/home/dawson/Dev/MIsc/KDE-x86_64-v4/copr/project-setup.md)
|
||||
You can:
|
||||
|
||||
## How To Use This Repo In COPR
|
||||
- build a specific list of source packages
|
||||
- provide binary package names and have them mapped to source packages
|
||||
- build a chunk from the checked-in manifest by `batch_index` and `batch_size`
|
||||
|
||||
1. Create a personal COPR project with chroot `fedora-43-x86_64`.
|
||||
2. Build [custom-macros.spec](/home/dawson/Dev/MIsc/KDE-x86_64-v4/packaging/custom-macros/custom-macros.spec) into that project as `custom-macros`.
|
||||
3. Edit the project chroot and add `custom-macros` to the buildroot package list.
|
||||
4. Register each package from [source-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-packages.txt) as a Fedora dist-git package on branch `f43`.
|
||||
5. Queue the rebuild in COPR batches, starting with low-level libraries and core KDE/Qt pieces if you want tighter ordering, or by broad passes if you are comfortable with a coarse rebuild.
|
||||
This is important because GitHub Actions matrix jobs are capped, and the full
|
||||
Fedora 43 KDE source manifest contains 265 packages.
|
||||
|
||||
The exact COPR-side settings are documented in
|
||||
[project-setup.md](/home/dawson/Dev/MIsc/KDE-x86_64-v4/copr/project-setup.md).
|
||||
## Practical Notes
|
||||
|
||||
- The workflow is intended for on-demand rebuilds, not for one-click rebuilding of the full KDE stack in a single run.
|
||||
- Some packages may still fail in GitHub Actions because Fedora package builds can rely on environment assumptions that are easier to satisfy in Koji or COPR than in a generic CI runner.
|
||||
- If you want to rebuild the whole stack, dispatch the workflow in batches.
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
# COPR Project Setup
|
||||
|
||||
Use this repository as the static definition for a personal COPR project that
|
||||
rebuilds Fedora 43 KDE in `x86-64-v4`.
|
||||
|
||||
## Project
|
||||
|
||||
- Name: your choice, for example `kde-x86_64-v4`
|
||||
- Chroot: `fedora-43-x86_64`
|
||||
- Source type for the stack packages: `DistGit`
|
||||
- DistGit instance: `fedora`
|
||||
- Branch: `f43`
|
||||
- AppStream metadata: `off`
|
||||
- Automatic createrepo: `off` is recommended for the large rebuild
|
||||
|
||||
## Buildroot Macro Package
|
||||
|
||||
Build [custom-macros.spec](/home/dawson/Dev/MIsc/KDE-x86_64-v4/packaging/custom-macros/custom-macros.spec) first.
|
||||
|
||||
After it succeeds:
|
||||
|
||||
- open the `fedora-43-x86_64` chroot settings
|
||||
- add `custom-macros` to the `Packages` field
|
||||
|
||||
This makes the buildroot load `/usr/lib/rpm/macros.d/macros.custom`, which
|
||||
overrides `%optflags` to use:
|
||||
|
||||
`-march=x86-64-v4`
|
||||
|
||||
## Package Lists
|
||||
|
||||
Use these files as the project definition:
|
||||
|
||||
- build target binaries:
|
||||
[binary-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/binary-packages.txt)
|
||||
- dist-git package names:
|
||||
[source-packages.txt](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-packages.txt)
|
||||
- binary-to-source lookup:
|
||||
[source-map.tsv](/home/dawson/Dev/MIsc/KDE-x86_64-v4/manifests/fedora-43/source-map.tsv)
|
||||
|
||||
## Recommended COPR Procedure
|
||||
|
||||
1. Create the project.
|
||||
2. Build `custom-macros`.
|
||||
3. Add `custom-macros` to the `fedora-43-x86_64` chroot package list.
|
||||
4. Add every package from `source-packages.txt` as a Fedora DistGit package pinned to `f43`.
|
||||
5. Start with one broad rebuild pass.
|
||||
6. Run a second pass over the same package set so consumers rebuild against already rebuilt `x86-64-v4` libraries.
|
||||
|
||||
## Notes
|
||||
|
||||
- This repo is intentionally static. It does not attempt to solve dependency ordering for you.
|
||||
- If you want stricter ordering, use `source-map.tsv` and split the project into manual batches in the COPR UI or `copr-cli`.
|
||||
- The package set here is intended for Fedora 43 and should be refreshed if Fedora KDE package selection changes.
|
||||
@@ -1,4 +1,4 @@
|
||||
%global v4_optflags -O2 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v4 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
|
||||
%global v4_optflags -O3 -flto=auto -ffat-lto-objects -fexceptions -g -grecord-gcc-switches -pipe -Wall -Wno-complain-wrong-lang -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -march=x86-64-v4 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -mtls-dialect=gnu2 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer
|
||||
|
||||
Name: custom-macros
|
||||
Version: 1.0
|
||||
|
||||
Reference in New Issue
Block a user