Skip to content

Commit

Permalink
Reusable workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexandre Bouijoux committed Feb 14, 2024
1 parent 43b2aec commit beadf8e
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 37 deletions.
45 changes: 8 additions & 37 deletions .github/workflows/build-lxc-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,46 +6,17 @@ env:
os: mageia

jobs:
clean_stale_repo:
name: Clean stale repo
runs-on: self-hosted
steps:
- name: Clean stale repo
run: sudo rm -rf .* * || true
clone_repo:
name: Clone repo
runs-on: self-hosted
needs: clean_stale_repo
steps:
- name: Clone repo
uses: actions/checkout@v4
craft_minimal_system:
name: Craft minimal system
runs-on: self-hosted
needs: clone_repo
steps:
- name: Cache squash-fs
id: squash-fs
uses: actions/cache@v4
with:
path: ${{ env.os }}.sqfs
key: ${{ env.os }}.sqfs-${{ hashFiles('./Makefile') }}
- name: Make 'minimal-fs'
if: steps.squash-fs.outputs.cache-hit != 'true'
run: make minimal-fs
- name: Make 'squash-fs'
if: steps.squash-fs.outputs.cache-hit != 'true'
run: make squash-fs
- name: Upload image
if: steps.squash-fs.outputs.cache-hit != 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ env.os }}.sqfs
path: ${{ env.os }}.sqfs
clone-repo:
uses: ./.github/workflows/checkout-self-hosted.yaml

build-rootfs:
needs: clone-repo
uses: ./.github/workflows/build-rootfs.yaml

build_for_target:
name: Build for target
runs-on: self-hosted
needs: craft_minimal_system
needs: build-rootfs
steps:
- name: Cache build
id: build
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/build-rootfs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Build rootfs
on:
workflow_dispatch:
workflow_call:

env:
os: mageia

jobs:
build-rootfs:
name: Build rootfs
runs-on: self-hosted
steps:
- name: Cache squash fs
id: squash-fs
uses: actions/cache@v4
with:
path: ${{ env.os }}.sqfs
key: ${{ env.os }}.sqfs-${{ hashFiles('./Makefile') }}

- name: Make minimal-fs
if: steps.squash-fs.outputs.cache-hit != 'true'
run: make minimal-fs

- name: Make squash-fs
if: steps.squash-fs.outputs.cache-hit != 'true'
run: make squash-fs

- name: Upload image
uses: actions/upload-artifact@v4
with:
name: ${{ env.os }}.sqfs
path: ${{ env.os }}.sqfs
20 changes: 20 additions & 0 deletions .github/workflows/checkout-self-hosted.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Clean checkout
on:
workflow_dispatch:
workflow_call:

jobs:
clean_stale_repo:
name: Clean stale repo
runs-on: self-hosted
steps:
- name: Clean stale repo
run: sudo rm -rf .* * || true

clone-repo:
name: Clone repo
runs-on: self-hosted
needs: clean_stale_repo
steps:
- name: Clone repo
uses: actions/checkout@v4

0 comments on commit beadf8e

Please sign in to comment.