-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: CI, add brew support, migrate to justfiles
- Loading branch information
Showing
24 changed files
with
494 additions
and
183 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: integration testing | ||
on: | ||
pull_request: | ||
merge_group: | ||
push: | ||
branches: | ||
- main | ||
workflow_dispatch: | ||
|
||
jobs: | ||
push-ghcr: | ||
name: Build and test image | ||
runs-on: ubuntu-24.04 | ||
permissions: | ||
contents: read | ||
packages: write | ||
id-token: write | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
major_version: [40, 41] | ||
include: | ||
- major_version: 40 | ||
is_latest_version: false | ||
is_stable_version: true | ||
- major_version: 41 | ||
is_latest_version: true | ||
is_stable_version: false | ||
steps: | ||
# Checkout push-to-registry action GitHub repository | ||
- name: Checkout Push to Registry action | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install Deps | ||
run: | | ||
sudo apt-get install just podman | ||
- name: Build Image | ||
id: build_image | ||
env: | ||
FEDORA_MAJOR_VERSION: ${{ matrix.major_version }} | ||
run: | | ||
just container-build | ||
- name: Test Image | ||
id: test_image | ||
run: | | ||
just container-test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,18 @@ | ||
FROM registry.fedoraproject.org/fedora:latest AS builder | ||
ARG FEDORA_MAJOR_VERSION="${FEDORA_MAJOR_VERSION:-41}" | ||
|
||
FROM registry.fedoraproject.org/fedora:${FEDORA_MAJOR_VERSION} AS builder | ||
|
||
ENV UBLUE_ROOT=/app/output | ||
|
||
WORKDIR /app | ||
ADD . /app | ||
|
||
RUN dnf install --assumeyes python3-pip && pip install topgrade | ||
RUN dnf install -y just git | ||
|
||
RUN dnf install \ | ||
--disablerepo='*' \ | ||
--enablerepo='fedora,updates' \ | ||
--setopt install_weak_deps=0 \ | ||
--nodocs \ | ||
--assumeyes \ | ||
'dnf-command(builddep)' \ | ||
rpkg \ | ||
rpm-build && \ | ||
mkdir -p "$UBLUE_ROOT" && \ | ||
rpkg spec --outdir "$UBLUE_ROOT" && \ | ||
dnf builddep -y output/ublue-update.spec | ||
RUN just container-rpm-build | ||
|
||
FROM builder AS rpm | ||
FROM scratch | ||
|
||
RUN make build-rpm | ||
ENV UBLUE_ROOT=/app/output | ||
COPY --from=builder ${UBLUE_ROOT}/ublue-os/rpms /tmp/rpms |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[containers] | ||
netns="host" | ||
userns="host" | ||
ipcns="host" | ||
utsns="host" | ||
cgroupns="host" | ||
cgroups="disabled" | ||
log_driver = "k8s-file" | ||
[engine] | ||
cgroup_manager = "cgroupfs" | ||
events_logger="file" | ||
runtime="crun" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
set shell := ["bash", "-uc"] | ||
export UBLUE_ROOT := env_var_or_default("UBLUE_ROOT", "/app/output") | ||
export TARGET := "ublue-update" | ||
export SOURCE_DIR := UBLUE_ROOT + "/" + TARGET | ||
export RPMBUILD := UBLUE_ROOT + "/rpmbuild" | ||
|
||
default: | ||
just --list | ||
|
||
venv-create: | ||
/usr/bin/python -m venv venv | ||
source venv/bin/activate && pip3 install . | ||
echo 'Enter: `source venv/bin/activate` to enter the venv' | ||
|
||
build: format | ||
python3 -m build | ||
|
||
test: | ||
pytest -v | ||
|
||
spec: output | ||
rpkg spec --outdir "$PWD/output" | ||
|
||
build-rpm: | ||
rpkg local --outdir "$PWD/output" | ||
|
||
builddep: | ||
dnf builddep -y output/ublue-update.spec | ||
|
||
container-install-deps: | ||
#!/usr/bin/env bash | ||
set -eou pipefail | ||
dnf install \ | ||
--disablerepo='*' \ | ||
--enablerepo='fedora,updates' \ | ||
--setopt install_weak_deps=0 \ | ||
--nodocs \ | ||
--assumeyes \ | ||
'dnf-command(builddep)' \ | ||
rpkg \ | ||
rpm-build \ | ||
git | ||
# Used internally by build containers | ||
container-rpm-build: container-install-deps spec builddep build-rpm | ||
#!/usr/bin/env bash | ||
set -eou pipefail | ||
# clean up files | ||
for RPM in ${UBLUE_ROOT}/noarch/*.rpm; do | ||
NAME="$(rpm -q $RPM --queryformat='%{NAME}')" | ||
mkdir -p "${UBLUE_ROOT}/ublue-os/rpms/" | ||
cp "${RPM}" "${UBLUE_ROOT}/ublue-os/rpms/$(rpm -q "${RPM}" --queryformat='%{NAME}.%{ARCH}.rpm')" | ||
done | ||
|
||
output: | ||
mkdir -p output | ||
|
||
format: | ||
black src tests | ||
flake8 src tests | ||
|
||
|
||
dnf-install: | ||
dnf install -y "output/noarch/*.rpm" | ||
|
||
container-build: | ||
podman build . -t test-container -f Containerfile | ||
|
||
container-test: | ||
#!/usr/bin/env bash | ||
set -eou pipefail | ||
podman run -d --replace --name ublue-update-test --security-opt label=disable --device /dev/fuse:rw --privileged --systemd true test-container | ||
while [[ "$(podman exec ublue-update-test systemctl is-system-running)" != "running" && "$(podman exec ublue-update-test systemctl is-system-running)" != "degraded" ]]; do | ||
echo "Waiting for systemd to finish booting..." | ||
sleep 1 | ||
done | ||
# podman exec -t ublue-update-test systemd-run --user --machine podman@ --pipe --quiet sudo /usr/bin/ublue-update --dry-run | ||
podman exec -t ublue-update-test systemd-run --machine 0@ --pipe --quiet /usr/bin/ublue-update --dry-run | ||
podman rm -f ublue-update-test | ||
clean: | ||
rm -rf "$UBLUE_ROOT" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[containers] | ||
volumes = [ | ||
"/proc:/proc", | ||
] | ||
default_sysctls = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,4 +23,4 @@ install_requires = | |
|
||
[flake8] | ||
max-line-length = 90 | ||
ignore = E501,W503,W504 | ||
ignore = E501,W503,W504 E402 |
Oops, something went wrong.