Skip to content

Commit

Permalink
chore(ci): split build workflows by fedora version (#208)
Browse files Browse the repository at this point in the history
* chore(ci): split build workflows by fedora version

* chore: update README with badges

* chore: tweak time to match akmods/main
  • Loading branch information
bsherman authored Mar 25, 2024
1 parent 064f604 commit b558c83
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 40 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/build-38.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: ublue nvidia 38
on:
pull_request:
merge_group:
schedule:
- cron: '40 15 * * *' # 15:30-ish UTC everyday (30 min delay after 'main' builds)
workflow_dispatch:

jobs:
build:
name: build
uses: ./.github/workflows/reusable-build.yml
secrets: inherit
with:
fedora_version: 38
15 changes: 15 additions & 0 deletions .github/workflows/build-39.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: ublue nvidia 39
on:
pull_request:
merge_group:
schedule:
- cron: '30 15 * * *' # 15:30-ish UTC everyday (30 min delay after 'main' builds)
workflow_dispatch:

jobs:
build:
name: build
uses: ./.github/workflows/reusable-build.yml
secrets: inherit
with:
fedora_version: 39
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: build-ublue
on:
pull_request:
merge_group:
schedule:
- cron: '30 15 * * *' # 15:30 UTC everyday (30 min delay after 'main' builds)
workflow_dispatch:
workflow_call:
inputs:
fedora_version:
description: 'The Fedora release version: 38, 39, 40, etc'
required: true
type: string
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:
push-ghcr:
name: nvidia image
name: nvidia
runs-on: ubuntu-22.04
permissions:
contents: read
Expand All @@ -19,6 +20,8 @@ jobs:
strategy:
fail-fast: false
matrix:
fedora_version:
- ${{ inputs.fedora_version }}
image_name:
- silverblue
- kinoite
Expand All @@ -29,28 +32,23 @@ jobs:
- lazurite
- mate
- vauxite
major_version: [38, 39]
driver_version: [470, 550]
include:
- major_version: 38
is_latest_version: false
is_stable_version: true
is_gts_driver: true
- driver_version: 550
is_latest_driver: true
- major_version: 39
is_latest_version: true
is_stable_version: true
is_gts_version: false
driver_version:
- 470
- 550
exclude:
# There is no Fedora 38 version of onyx or lazurite
- image_name: onyx
major_version: 38
fedora_version: 38
- image_name: lazurite
major_version: 38
# There is no Fedora 39 version of lxqt as it was replaced by lazurite
fedora_version: 38
# There is no Fedora 39+ version of lxqt as it was replaced by lazurite
- image_name: lxqt
major_version: 39
fedora_version: 39
- image_name: lxqt
fedora_version: 40
# There is currently no Fedora 40 version of mate
- image_name: mate
fedora_version: 40
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
Expand All @@ -59,7 +57,7 @@ jobs:
- name: Verify base image
uses: EyeCantCU/cosign-action/[email protected]
with:
containers: ${{ matrix.image_name }}-main:${{ matrix.major_version }}
containers: ${{ matrix.image_name }}-main:${{ matrix.fedora_version }}

- name: Matrix Variables
run: |
Expand All @@ -71,7 +69,25 @@ jobs:
run: |
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
VARIANT="${{ matrix.major_version }}-${{ matrix.driver_version }}"
VARIANT="${{ matrix.fedora_version }}-${{ matrix.driver_version }}"
if [[ "${{ matrix.fedora_version }}" -eq "38" ]]; then
IS_LATEST_VERSION=false
IS_STABLE_VERSION=true
IS_GTS_VERSION=true
elif [[ "${{ matrix.fedora_version }}" -eq "39" ]]; then
IS_LATEST_VERSION=true
IS_STABLE_VERSION=true
IS_GTS_VERSION=false
elif [[ "${{ matrix.fedora_version }}" -eq "40" ]]; then
IS_LATEST_VERSION=false
IS_STABLE_VERSION=false
IS_GTS_VERSION=false
fi
if [[ "${{ matrix.driver_version }}" -eq "550" ]]; then
IS_LATEST_DRIVER=true
fi
COMMIT_TAGS=()
BUILD_TAGS=()
Expand All @@ -81,34 +97,34 @@ jobs:
COMMIT_TAGS+=("pr-${{ github.event.number }}-${VARIANT}")
COMMIT_TAGS+=("${SHA_SHORT}-${VARIANT}")
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]] && \
[[ "${{ matrix.is_latest_driver }}" == "true" ]]; then
if [[ "${IS_LATEST_VERSION}" == "true" ]] && \
[[ "${IS_STABLE_VERSION}" == "true" ]] && \
[[ "${IS_LATEST_DRIVER}" == "true" ]]; then
COMMIT_TAGS+=("pr-${{ github.event.number }}")
COMMIT_TAGS+=("${SHA_SHORT}")
fi
BUILD_TAGS=("${VARIANT}")
if [[ "${{ matrix.is_latest_driver }}" == "true" ]]; then
BUILD_TAGS+=("${{ matrix.major_version }}-current")
BUILD_TAGS+=("${{ matrix.major_version }}")
if [[ "${IS_LATEST_DRIVER}" == "true" ]]; then
BUILD_TAGS+=("${{ matrix.fedora_version }}-current")
BUILD_TAGS+=("${{ matrix.fedora_version }}")
fi
# Append matching timestamp tags to keep a version history
for TAG in "${BUILD_TAGS[@]}"; do
BUILD_TAGS+=("${TAG}-${TIMESTAMP}")
done
if [[ "${{ matrix.is_latest_version }}" == "true" ]] && \
[[ "${{ matrix.is_stable_version }}" == "true" ]] && \
[[ "${{ matrix.is_latest_driver }}" == "true" ]]; then
if [[ "${IS_LATEST_VERSION}" == "true" ]] && \
[[ "${IS_STABLE_VERSION}" == "true" ]] && \
[[ "${IS_LATEST_DRIVER}" == "true" ]]; then
BUILD_TAGS+=("${TIMESTAMP}")
BUILD_TAGS+=("latest")
fi
if [[ "${{ matrix.is_gtst_version }}" == "true" ]] && \
[[ "${{ matrix.is_latest_driver }}" == "true" ]]; then
if [[ "${IS_GTS_VERSION}" == "true" ]] && \
[[ "${IS_LATEST_DRIVER}" == "true" ]]; then
BUILD_TAGS+=("gts-${TIMESTAMP}")
BUILD_TAGS+=("gts")
fi
Expand Down Expand Up @@ -139,7 +155,7 @@ jobs:
attempt_delay: 15000
command: |
set -eo pipefail
ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ matrix.image_name }}-main:${{ matrix.major_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
ver=$(skopeo inspect docker://ghcr.io/ublue-os/${{ matrix.image_name }}-main:${{ matrix.fedora_version }} | jq -r '.Labels["org.opencontainers.image.version"]')
if [ -z "$ver" ] || [ "null" = "$ver" ]; then
echo "inspected image version must not be empty or null"
exit 1
Expand Down Expand Up @@ -168,7 +184,7 @@ jobs:
command: |
# pull the base image used for FROM in containerfile so
# we can retry on that unfortunately common failure case
podman pull ghcr.io/ublue-os/${{ matrix.image_name }}-main:${{ matrix.major_version }}
podman pull ghcr.io/ublue-os/${{ matrix.image_name }}-main:${{ matrix.fedora_version }}
# Build image using Buildah action
- name: Build Image
Expand All @@ -182,7 +198,7 @@ jobs:
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
IMAGE_NAME=${{ matrix.image_name }}
FEDORA_MAJOR_VERSION=${{ matrix.major_version }}
FEDORA_MAJOR_VERSION=${{ matrix.fedora_version }}
NVIDIA_MAJOR_VERSION=${{ matrix.driver_version }}
RPMFUSION_MIRROR=${{ vars.RPMFUSION_MIRROR }}
labels: ${{ steps.meta.outputs.labels }}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Nvidia

[![build-ublue](https://github.com/ublue-os/nvidia/actions/workflows/build.yml/badge.svg)](https://github.com/ublue-os/nvidia/actions/workflows/build.yml)
[![build-38](https://github.com/ublue-os/nvidia/actions/workflows/build-38.yml/badge.svg)](https://github.com/ublue-os/nvidia/actions/workflows/build-38.yml) [![build-39](https://github.com/ublue-os/nvidia/actions/workflows/build-39.yml/badge.svg)](https://github.com/ublue-os/nvidia/actions/workflows/build-39.yml)

The purpose of these images is to provide [community Fedora images](https://github.com/ublue-os/main) with Nvidia drivers built-in. This approach can lead to greater reliability as failures can be caught at the build level instead of the client machine. This also allows for individual sets of images for each series of Nvidia drivers, allowing users to remain current with their OS but on an older, known working driver. Performance regression with a recent driver update? Reboot into a known-working driver after one command. That's the goal!

Expand Down

0 comments on commit b558c83

Please sign in to comment.