Skip to content

Commit

Permalink
chore(ci): move to reusable workflow (#114)
Browse files Browse the repository at this point in the history
Convert to a reusable workflow such that stable and testing builds can happen on separate schedules and so that stable builds are all that gate merge success, allowing testing to be more unstable.
  • Loading branch information
bsherman authored Jan 15, 2024
1 parent f55a60f commit 403994e
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 80 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/build-stable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: stable
on:
pull_request:
merge_group:
schedule:
- cron: '40 23 * * *' # 11:45PM UTC everyday (approx 1.5 hours after coreos images publish)
workflow_dispatch:

jobs:
build-stable:
uses: ./.github/workflows/reusable-build.yml
secrets: inherit
with:
coreos_version: stable
14 changes: 14 additions & 0 deletions .github/workflows/build-testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: testing
on:
pull_request:
merge_group:
schedule:
- cron: '55 23 * * *' # 11:45PM UTC everyday (approx 1.75 hours after coreos images publish)
workflow_dispatch:

jobs:
build-testing:
uses: ./.github/workflows/reusable-build.yml
secrets: inherit
with:
coreos_version: testing
120 changes: 41 additions & 79 deletions .github/workflows/build.yml → .github/workflows/reusable-build.yml
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
name: build-ucore
on:
pull_request:
merge_group:
schedule:
- cron: '45 23 * * *' # 11:45PM UTC everyday (approx 1.5 hours after coreos images publish)
workflow_dispatch:
workflow_call:
inputs:
coreos_version:
description: 'The CoreOS stream: stable or testing'
required: true
type: string
env:
IMAGE_REGISTRY: ghcr.io/${{ github.repository_owner }}

jobs:
build_info:
name: Get Build Info
workflow_info:
name: Get Workflow Info
runs-on: ubuntu-latest
outputs:
pr_prefix: ${{ steps.pr_prefix.outputs.pr_prefix }}
Expand All @@ -29,72 +30,49 @@ jobs:
run: |
echo "${{ toJSON(steps.pr_prefix.outputs) }}"
coreos_versions:
name: Get CoreOS versions
stream_info:
name: Get Stream Info
runs-on: ubuntu-latest
outputs:
stable_linux: ${{ steps.stable.outputs.linux }}
stable_version: ${{ steps.stable.outputs.version }}
testing_linux: ${{ steps.testing.outputs.linux }}
testing_version: ${{ steps.testing.outputs.version }}
linux: ${{ steps.fetch.outputs.linux }}
version: ${{ steps.fetch.outputs.version }}
steps:
- name: Fetch CoreOS stable versions
id: stable
- name: Fetch CoreOS stream versions
id: fetch
run: |
skopeo inspect docker://quay.io/fedora/fedora-coreos:stable > inspect.json
linux=$(jq -r '.["Labels"]["ostree.linux"]' inspect.json)
echo "linux=$linux" >> $GITHUB_OUTPUT
version=$(jq -r '.["Labels"]["version"]' inspect.json)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Fetch CoreOS testing versions
id: testing
run: |
skopeo inspect docker://quay.io/fedora/fedora-coreos:testing > inspect.json
skopeo inspect docker://quay.io/fedora/fedora-coreos:${{ inputs.coreos_version }} > inspect.json
linux=$(jq -r '.["Labels"]["ostree.linux"]' inspect.json)
echo "linux=$linux" >> $GITHUB_OUTPUT
version=$(jq -r '.["Labels"]["version"]' inspect.json)
echo "version=$version" >> $GITHUB_OUTPUT
- name: Echo outputs
run: |
echo "${{ toJSON(steps.stable.outputs) }}"
echo "${{ toJSON(steps.testing.outputs) }}"
echo "${{ toJSON(steps.fetch.outputs) }}"
build_fcos:
name: Build CoreOS
name: fedora-coreos
runs-on: ubuntu-22.04
if: always() && !cancelled()
needs: [build_info, coreos_versions]
needs: [workflow_info, stream_info]
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
image_name:
- fedora-coreos
coreos_version:
- stable
- testing
nvidia_tag:
- "-nvidia"
- ""
zfs_tag:
- "-zfs"
- ""
pr_prefix:
- ${{ needs.build_info.outputs.pr_prefix }}
include:
- coreos_version: stable
image_version: ${{ needs.coreos_versions.outputs.stable_version }}
- coreos_version: testing
image_version: ${{ needs.coreos_versions.outputs.testing_version }}
- image_name: fedora-coreos
- image_version: ${{ needs.stream_info.outputs.version }}
- pr_prefix: ${{ needs.workflow_info.outputs.pr_prefix }}
exclude:
- coreos_version: stable
nvidia_tag: ""
zfs_tag: ""
- coreos_version: testing
nvidia_tag: ""
- nvidia_tag: ""
zfs_tag: ""
steps:
# Checkout push-to-registry action GitHub repository
Expand All @@ -107,7 +85,7 @@ jobs:
run: |
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
COREOS_VERSION="${{ matrix.coreos_version }}${{ matrix.nvidia_tag }}${{ matrix.zfs_tag }}"
COREOS_VERSION="${{ inputs.coreos_version }}${{ matrix.nvidia_tag }}${{ matrix.zfs_tag }}"
COMMIT_TAGS=()
BUILD_TAGS=()
Expand Down Expand Up @@ -163,7 +141,7 @@ jobs:
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
COREOS_VERSION=${{ matrix.coreos_version }}
COREOS_VERSION=${{ inputs.coreos_version }}
PR_PREFIX=${{ matrix.pr_prefix }}
NVIDIA_TAG=${{ matrix.nvidia_tag }}
ZFS_TAG=${{ matrix.zfs_tag }}
Expand Down Expand Up @@ -221,36 +199,28 @@ jobs:
run: |
echo "${{ toJSON(steps.push.outputs) }}"
build_main:
name: Build uCore
build_ucore:
name: ucore
runs-on: ubuntu-22.04
if: always() && !cancelled()
needs: [build_info, coreos_versions]
needs: [workflow_info, stream_info]
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
image_name:
- ucore
coreos_version:
- stable
- testing
nvidia_tag:
- "-nvidia"
- ""
zfs_tag:
- "-zfs"
- ""
pr_prefix:
- ${{ needs.build_info.outputs.pr_prefix }}
include:
- coreos_version: stable
image_version: ${{ needs.coreos_versions.outputs.stable_version }}
- coreos_version: testing
image_version: ${{ needs.coreos_versions.outputs.testing_version }}
- image_name: ucore
- image_version: ${{ needs.stream_info.outputs.version }}
- pr_prefix: ${{ needs.workflow_info.outputs.pr_prefix }}
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
Expand All @@ -262,7 +232,7 @@ jobs:
run: |
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
COREOS_VERSION="${{ matrix.coreos_version }}${{ matrix.nvidia_tag }}${{ matrix.zfs_tag }}"
COREOS_VERSION="${{ inputs.coreos_version }}${{ matrix.nvidia_tag }}${{ matrix.zfs_tag }}"
COMMIT_TAGS=()
BUILD_TAGS=()
Expand Down Expand Up @@ -322,7 +292,7 @@ jobs:
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
COREOS_VERSION=${{ matrix.coreos_version }}
COREOS_VERSION=${{ inputs.coreos_version }}
PR_PREFIX=${{ matrix.pr_prefix }}
NVIDIA_TAG=${{ matrix.nvidia_tag }}
ZFS_TAG=${{ matrix.zfs_tag }}
Expand Down Expand Up @@ -381,35 +351,27 @@ jobs:
echo "${{ toJSON(steps.push.outputs) }}"
build_hci:
name: Build HCI
name: ucore-hci
runs-on: ubuntu-22.04
if: always() && !cancelled()
needs: [build_info, build_main, coreos_versions]
needs: [workflow_info, build_ucore, stream_info]
permissions:
contents: read
packages: write
id-token: write
strategy:
fail-fast: false
matrix:
image_name:
- ucore
coreos_version:
- stable
- testing
nvidia_tag:
- "-nvidia"
- ""
zfs_tag:
- "-zfs"
- ""
pr_prefix:
- ${{ needs.build_info.outputs.pr_prefix }}
include:
- coreos_version: stable
image_version: ${{ needs.coreos_versions.outputs.stable_version }}
- coreos_version: testing
image_version: ${{ needs.coreos_versions.outputs.testing_version }}
- image_name: ucore
- image_version: ${{ needs.stream_info.outputs.version }}
- pr_prefix: ${{ needs.workflow_info.outputs.pr_prefix }}
steps:
# Checkout push-to-registry action GitHub repository
- name: Checkout Push to Registry action
Expand All @@ -421,7 +383,7 @@ jobs:
run: |
# Generate a timestamp for creating an image version history
TIMESTAMP="$(date +%Y%m%d)"
COREOS_VERSION="${{ matrix.coreos_version }}${{ matrix.nvidia_tag }}${{ matrix.zfs_tag }}"
COREOS_VERSION="${{ inputs.coreos_version }}${{ matrix.nvidia_tag }}${{ matrix.zfs_tag }}"
COMMIT_TAGS=()
BUILD_TAGS=()
Expand Down Expand Up @@ -477,7 +439,7 @@ jobs:
tags: |
${{ steps.generate-tags.outputs.alias_tags }}
build-args: |
COREOS_VERSION=${{ matrix.coreos_version }}
COREOS_VERSION=${{ inputs.coreos_version }}
PR_PREFIX=${{ matrix.pr_prefix }}
NVIDIA_TAG=${{ matrix.nvidia_tag }}
ZFS_TAG=${{ matrix.zfs_tag }}
Expand Down Expand Up @@ -536,9 +498,9 @@ jobs:
echo "${{ toJSON(steps.push.outputs) }}"
check:
name: Check all builds successful
name: Check all successful
runs-on: ubuntu-latest
needs: [build_fcos, build_main, build_hci]
needs: [build_fcos, build_ucore, build_hci]
steps:
- name: Exit
shell: bash
Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# uCore

[![build-ucore](https://github.com/ublue-os/ucore/actions/workflows/build.yml/badge.svg)](https://github.com/ublue-os/ucore/actions/workflows/build.yml)
[![stable](https://github.com/ublue-os/ucore/actions/workflows/build-stable.yml/badge.svg)](https://github.com/ublue-os/ucore/actions/workflows/build-stable.yml)
[![testing](https://github.com/ublue-os/ucore/actions/workflows/build-testing.yml/badge.svg)](https://github.com/ublue-os/ucore/actions/workflows/build-testing.yml)

## What is this?

Expand Down

0 comments on commit 403994e

Please sign in to comment.