mirror of
https://github.com/mkuf/prind.git
synced 2026-03-06 12:00:46 +01:00
Rework GitHub workflows (#119)
* ci: add build action for PRs * ci: use matrix job for build and review * ci: use matrix job for dockerhub description
This commit is contained in:
committed by
Markus Küffner
parent
df3be95a30
commit
328e333d91
37
.github/actions/image-build-common/action.yaml
vendored
Normal file
37
.github/actions/image-build-common/action.yaml
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
name: "image-build-common"
|
||||
description: "Common runner setup to build Container Images for prind"
|
||||
|
||||
runs:
|
||||
using: "composite"
|
||||
steps:
|
||||
- name: "[misc] Clean Runner"
|
||||
shell: bash
|
||||
run: |
|
||||
set -x
|
||||
## Remove files
|
||||
to_delete=(
|
||||
"/swapfile"
|
||||
"/usr/local/share/boost"
|
||||
"$AGENT_TOOLSDIRECTORY"
|
||||
"/usr/share/dotnet"
|
||||
"$ANDROID_SDK_ROOT"
|
||||
"/usr/local/lib/android"
|
||||
"$ANDROID_SDK_ROOT"
|
||||
"/usr/share/swift"
|
||||
)
|
||||
for f in ${to_delete[@]}; do
|
||||
sudo rm -rf ${f} || true
|
||||
done
|
||||
|
||||
## Clean docker
|
||||
docker system prune --all --volumes --force
|
||||
|
||||
- name: "[docker] set up qemu"
|
||||
uses: docker/setup-qemu-action@v2.2.0
|
||||
|
||||
- name: "[docker] set up buildx"
|
||||
uses: docker/setup-buildx-action@v2.7.0
|
||||
|
||||
- name: "[prind] install requirements"
|
||||
shell: bash
|
||||
run: pip install -r scripts/build/requirements.txt
|
||||
35
.github/workflows/image-build-and-publish.yaml
vendored
Normal file
35
.github/workflows/image-build-and-publish.yaml
vendored
Normal file
@@ -0,0 +1,35 @@
|
||||
name: 'Build and Publish Images'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
jobs:
|
||||
build:
|
||||
strategy:
|
||||
matrix:
|
||||
app:
|
||||
- klipper
|
||||
- klipperscreen
|
||||
- moonraker
|
||||
- ustreamer
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "[prind] checkout"
|
||||
uses: actions/checkout@v3
|
||||
- name: "[prind] set up build environment"
|
||||
uses: ./.github/actions/image-build-common
|
||||
- name: "[docker] login"
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: "[prind] build"
|
||||
run: |
|
||||
python3 scripts/build/build.py ${{ matrix.app }} \
|
||||
--backfill 3 \
|
||||
--platform linux/amd64 \
|
||||
--platform linux/arm/v6 \
|
||||
--platform linux/arm/v7 \
|
||||
--platform linux/arm64/v8 \
|
||||
--registry docker.io/${{ secrets.DOCKERHUB_USERNAME }} \
|
||||
--push
|
||||
13
.github/workflows/image-build-klipper.yaml
vendored
13
.github/workflows/image-build-klipper.yaml
vendored
@@ -1,13 +0,0 @@
|
||||
name: 'Image: Klipper'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/template-image-build-workflow.yaml
|
||||
with:
|
||||
app: klipper
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
13
.github/workflows/image-build-klipperscreen.yaml
vendored
13
.github/workflows/image-build-klipperscreen.yaml
vendored
@@ -1,13 +0,0 @@
|
||||
name: 'Image: KlipperScreen'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/template-image-build-workflow.yaml
|
||||
with:
|
||||
app: klipperscreen
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
13
.github/workflows/image-build-moonraker.yaml
vendored
13
.github/workflows/image-build-moonraker.yaml
vendored
@@ -1,13 +0,0 @@
|
||||
name: 'Image: Moonraker'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/template-image-build-workflow.yaml
|
||||
with:
|
||||
app: moonraker
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
58
.github/workflows/image-build-review.yaml
vendored
Normal file
58
.github/workflows/image-build-review.yaml
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
name: 'Build Images for Review'
|
||||
on:
|
||||
pull_request:
|
||||
paths:
|
||||
- .github/workflows/image-build-review.yaml
|
||||
- scripts/build/**
|
||||
- docker/**
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
apps: ${{ steps.filter.outputs.changes }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
klipper:
|
||||
- .github/workflows/image-build-review.yaml
|
||||
- scripts/build/**
|
||||
- docker/klipper/**
|
||||
klipperscreen:
|
||||
- .github/workflows/image-build-review.yaml
|
||||
- scripts/build/**
|
||||
- docker/klipperscreen/**
|
||||
moonraker:
|
||||
- .github/workflows/image-build-review.yaml
|
||||
- scripts/build/**
|
||||
- docker/moonraker/**
|
||||
ustreamer:
|
||||
- .github/workflows/image-build-review.yaml
|
||||
- scripts/build/**
|
||||
- docker/ustreamer/**
|
||||
build:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.apps != '' && toJson(fromJson(needs.changes.outputs.apps)) != '[]' }}
|
||||
strategy:
|
||||
matrix:
|
||||
app: ${{ fromJSON(needs.changes.outputs.apps) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: "[prind] checkout"
|
||||
uses: actions/checkout@v3
|
||||
- name: "[prind] set up build environment"
|
||||
uses: ./.github/actions/image-build-common
|
||||
- name: "[prind] build"
|
||||
run: |
|
||||
python3 scripts/build/build.py ${{ matrix.app }} \
|
||||
--backfill 0 \
|
||||
--platform linux/amd64 \
|
||||
--platform linux/arm/v6 \
|
||||
--platform linux/arm/v7 \
|
||||
--platform linux/arm64/v8 \
|
||||
--force
|
||||
13
.github/workflows/image-build-ustreamer.yaml
vendored
13
.github/workflows/image-build-ustreamer.yaml
vendored
@@ -1,13 +0,0 @@
|
||||
name: 'Image: Ustreamer'
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 2 * * *'
|
||||
jobs:
|
||||
build:
|
||||
uses: ./.github/workflows/template-image-build-workflow.yaml
|
||||
with:
|
||||
app: ustreamer
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
18
.github/workflows/image-docs-klipper.yaml
vendored
18
.github/workflows/image-docs-klipper.yaml
vendored
@@ -1,18 +0,0 @@
|
||||
name: 'Docs: Klipper'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/template-image-docs-workflow.yaml
|
||||
- docker/klipper/README.md
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
uses: ./.github/workflows/template-image-docs-workflow.yaml
|
||||
with:
|
||||
app: klipper
|
||||
short-description: "Klipper is a 3d-Printer firmware."
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
18
.github/workflows/image-docs-klipperscreen.yaml
vendored
18
.github/workflows/image-docs-klipperscreen.yaml
vendored
@@ -1,18 +0,0 @@
|
||||
name: 'Docs: KlipperScreen'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/template-image-docs-workflow.yaml
|
||||
- docker/klipperscreen/README.md
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
uses: ./.github/workflows/template-image-docs-workflow.yaml
|
||||
with:
|
||||
app: klipperscreen
|
||||
short-description: "KlipperScreen is a touchscreen GUI that interfaces with Klipper via Moonraker."
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
18
.github/workflows/image-docs-moonraker.yaml
vendored
18
.github/workflows/image-docs-moonraker.yaml
vendored
@@ -1,18 +0,0 @@
|
||||
name: 'Docs: Moonraker'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/template-image-docs-workflow.yaml
|
||||
- docker/moonraker/README.md
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
uses: ./.github/workflows/template-image-docs-workflow.yaml
|
||||
with:
|
||||
app: moonraker
|
||||
short-description: "Web API used to interact with the 3D printing firmware Klipper."
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
52
.github/workflows/image-docs-publish.yaml
vendored
Normal file
52
.github/workflows/image-docs-publish.yaml
vendored
Normal file
@@ -0,0 +1,52 @@
|
||||
name: "Update Image Description at Dockerhub"
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/image-docs-publish.yaml
|
||||
- docker/**/README.md
|
||||
|
||||
jobs:
|
||||
changes:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
pull-requests: read
|
||||
outputs:
|
||||
apps: ${{ steps.filter.outputs.changes }}
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: dorny/paths-filter@v3
|
||||
id: filter
|
||||
with:
|
||||
filters: |
|
||||
klipper:
|
||||
- .github/workflows/image-docs-publish.yaml
|
||||
- docker/klipper/README.md
|
||||
klipperscreen:
|
||||
- .github/workflows/image-docs-publish.yaml
|
||||
- docker/klipperscreen/README.md
|
||||
moonraker:
|
||||
- .github/workflows/image-docs-publish.yaml
|
||||
- docker/moonraker/README.md
|
||||
ustreamer:
|
||||
- .github/workflows/image-docs-publish.yaml
|
||||
- docker/moonraker/README.md
|
||||
dockerhub-description:
|
||||
needs: changes
|
||||
if: ${{ needs.changes.outputs.apps != '' && toJson(fromJson(needs.changes.outputs.apps)) != '[]' }}
|
||||
strategy:
|
||||
matrix:
|
||||
app: ${{ fromJSON(needs.changes.outputs.apps) }}
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Update Docker Hub Description"
|
||||
uses: peter-evans/dockerhub-description@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
repository: ${{ secrets.DOCKERHUB_USERNAME }}/${{ matrix.app }}
|
||||
readme-filepath: ./docker/${{ matrix.app }}/README.md
|
||||
enable-url-completion: true
|
||||
18
.github/workflows/image-docs-ustreamer.yaml
vendored
18
.github/workflows/image-docs-ustreamer.yaml
vendored
@@ -1,18 +0,0 @@
|
||||
name: 'Docs: Ustreamer'
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
paths:
|
||||
- .github/workflows/template-image-docs-workflow.yaml
|
||||
- docker/ustreamer/README.md
|
||||
|
||||
jobs:
|
||||
docs:
|
||||
uses: ./.github/workflows/template-image-docs-workflow.yaml
|
||||
with:
|
||||
app: ustreamer
|
||||
short-description: "µStreamer is a lightweight and very quick server to stream MJPEG video"
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
@@ -1,66 +0,0 @@
|
||||
name: "Template: image-build-workflow"
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
app:
|
||||
required: true
|
||||
type: string
|
||||
description: 'app image to build'
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME:
|
||||
required: true
|
||||
DOCKERHUB_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
build-images:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clean Runner
|
||||
run: |
|
||||
set -x
|
||||
## Remove files
|
||||
to_delete=(
|
||||
"/swapfile"
|
||||
"/usr/local/share/boost"
|
||||
"$AGENT_TOOLSDIRECTORY"
|
||||
"/usr/share/dotnet"
|
||||
"$ANDROID_SDK_ROOT"
|
||||
"/usr/local/lib/android"
|
||||
"$ANDROID_SDK_ROOT"
|
||||
"/usr/share/swift"
|
||||
)
|
||||
for f in ${to_delete[@]}; do
|
||||
sudo rm -rf ${f} || true
|
||||
done
|
||||
|
||||
## Clean docker
|
||||
docker system prune --all --volumes --force
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3.5.3
|
||||
|
||||
- name: Docker Setup QEMU
|
||||
uses: docker/setup-qemu-action@v2.2.0
|
||||
|
||||
- name: Docker Setup Buildx
|
||||
uses: docker/setup-buildx-action@v2.7.0
|
||||
|
||||
- name: Docker Login
|
||||
uses: docker/login-action@v2.2.0
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Install Build requirements
|
||||
run: pip install -r scripts/build/requirements.txt
|
||||
- name: Run Build Script
|
||||
run: |
|
||||
python3 scripts/build/build.py ${{ inputs.app }} \
|
||||
--backfill 3 \
|
||||
--platform linux/amd64 \
|
||||
--platform linux/arm/v6 \
|
||||
--platform linux/arm/v7 \
|
||||
--platform linux/arm64/v8 \
|
||||
--registry docker.io/${GITHUB_REPOSITORY_OWNER} \
|
||||
--push
|
||||
@@ -1,32 +0,0 @@
|
||||
name: "Template: image-docs-workflow"
|
||||
on:
|
||||
workflow_call:
|
||||
inputs:
|
||||
app:
|
||||
required: true
|
||||
type: string
|
||||
description: 'app image to build'
|
||||
short-description:
|
||||
required: true
|
||||
type: string
|
||||
description: 'Docker Hub repository short description'
|
||||
secrets:
|
||||
DOCKERHUB_USERNAME:
|
||||
required: true
|
||||
DOCKERHUB_TOKEN:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
image-docs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: "Update Docker Hub Description"
|
||||
uses: peter-evans/dockerhub-description@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
repository: ${{ secrets.DOCKERHUB_USERNAME }}/${{ inputs.app }}
|
||||
short-description: ${{ inputs.short-description }}
|
||||
readme-filepath: ./docker/${{ inputs.app }}/README.md
|
||||
enable-url-completion: true
|
||||
Reference in New Issue
Block a user