Skip to content

Commit

Permalink
feat: add more granularity to github CI
Browse files Browse the repository at this point in the history
Signed-off-by: AtomicFS <[email protected]>
  • Loading branch information
AtomicFS committed Dec 5, 2024
1 parent c7cb5d6 commit 14a01e2
Showing 1 changed file with 103 additions and 4 deletions.
107 changes: 103 additions & 4 deletions .github/workflows/example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,57 @@ jobs:
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Fetch few missing submodules
run: |
git submodule update --depth 1 --init --recursive --checkout
#==================================
# Get commit hashes for submodules
#==================================

- name: Extract uroot commit sha
id: uroot_commit
run: |
echo "uroot_commit=$( git rev-parse HEAD:coreboot-linuxboot-example/u-root )" >> "${GITHUB_OUTPUT}"
- name: Extract Linux commit sha
id: linux_commit
run: |
echo "linux_commit=$( git rev-parse HEAD:coreboot-linuxboot-example/linux )" >> "${GITHUB_OUTPUT}"
- name: Extract Coreboot commit sha
id: coreboot_commit
run: |
echo "coreboot_commit=$( git rev-parse HEAD:coreboot-linuxboot-example/coreboot )" >> "${GITHUB_OUTPUT}"
#===============
# Restore cache
#===============

- name: Restore cached u-root artefact
uses: actions/cache/restore@v4
id: cache-uroot
with:
path: output-linuxboot-uroot
key: uroot-${{ steps.uroot_commit.outputs.uroot_commit }}-${{ hashFiles('coreboot-linuxboot-example.json') }}

- name: Restore cached Linux artefact
uses: actions/cache/restore@v4
id: cache-linux
with:
path: output-linuxboot-linux
key: linux-${{ steps.linux_commit.outputs.linux_commit }}-${{ hashFiles('coreboot-linuxboot-example.json', 'coreboot-linuxboot-example/linux_defconfig', 'output-linuxboot-uroot/*') }}

- name: Restore cached coreboot artefact
uses: actions/cache/restore@v4
id: cache-coreboot
with:
path: output-linuxboot-coreboot
key: coreboot-${{ steps.coreboot_commit.outputs.coreboot_commit }}-${{ hashFiles('coreboot-linuxboot-example.json', 'coreboot-linuxboot-example/coreboot_linuxboot_defconfig', 'output-linuxboot-linux/*') }}

#============================
# Build with firmware-action
#============================

- name: firmware-action
uses: 9elements/[email protected]
Expand All @@ -50,9 +101,57 @@ jobs:
target: 'coreboot-example-with-linuxboot'
recursive: 'true'

- name: Get artifacts
#==========================
# Upload artifacts - uroot
#==========================

- name: Cache u-root
uses: actions/cache/save@v4
if: always()
with:
key: uroot-${{ steps.uroot_commit.outputs.uroot_commit }}-${{ hashFiles('coreboot-linuxboot-example.json') }}
path: output-linuxboot-uroot

- name: Upload artifacts for uroot
uses: actions/upload-artifact@v4
if: always()
with:
name: coreboot-4.19
path: output-coreboot
retention-days: 30
name: linuxboot-uroot
path: output-linuxboot-uroot

#==========================
# Upload artifacts - Linux
#==========================

- name: Cache Linux
uses: actions/cache/save@v4
if: always()
with:
key: linux-${{ steps.linux_commit.outputs.linux_commit }}-${{ hashFiles('coreboot-linuxboot-example.json', 'coreboot-linuxboot-example/linux_defconfig', 'output-linuxboot-uroot/*') }}
path: output-linuxboot-linux

- name: Upload artifacts for Linux
uses: actions/upload-artifact@v4
if: always()
with:
name: linuxboot-linux
path: output-linuxboot-linux

#=============================
# Upload artifacts - coreboot
#=============================

- name: Cache coreboot
uses: actions/cache/save@v4
if: always()
with:
key: coreboot-${{ steps.coreboot_commit.outputs.coreboot_commit }}-${{ hashFiles('coreboot-linuxboot-example.json', 'coreboot-linuxboot-example/coreboot_linuxboot_defconfig', 'output-linuxboot-linux/*') }}
path: output-linuxboot-coreboot

- name: Upload artifacts for coreboot
uses: actions/upload-artifact@v4
if: always()
with:
name: linuxboot-coreboot
path: output-linuxboot-coreboot

0 comments on commit 14a01e2

Please sign in to comment.