Skip to content

Commit

Permalink
version tests
Browse files Browse the repository at this point in the history
  • Loading branch information
b2un0 committed Jan 11, 2024
1 parent 50a9f10 commit d676483
Show file tree
Hide file tree
Showing 4 changed files with 96 additions and 9 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/build_all.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 'build all'

on:
workflow_dispatch:

env:
REPO_URL: "https://registry.hub.docker.com/v2/namespaces/homeassistant/repositories/amd64-addon-silabs-multiprotocol/tags?page=1&page_size=1000"

jobs:
provide_versions:
name: provide base versions
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.tags.outputs.matrix }}
steps:
- name: get all tags
id: tags
run: echo matrix=$(curl -s '${{ env.REPO_URL }}' | jq -r '.results | reverse') >> $GITHUB_OUTPUT
- name: count tags
run: jq -r 'length' <<< '${{ steps.tags.outputs.matrix }}'

call_build:
runs-on: ubuntu-latest
needs: provide_versions
permissions: write-all
strategy:
matrix:
include: ${{ fromJson(needs.provide_versions.outputs.matrix) }}
name: trigger build for ${{ fromJSON(toJSON(matrix)).name }}
steps:
- name: Check
env:
VERSION: ${{ fromJSON(toJSON(matrix)).name }}
run: |
echo "VERSION: ${{ env.VERSION }}"
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
event-type: container
client-payload: '{"base_version": "${{ fromJSON(toJSON(matrix)).name }}"}'
28 changes: 28 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: 'cleanup'
on:
workflow_dispatch:
schedule:
- cron: '0 0 1 * *'

jobs:
del_runs:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: clean workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 1
keep_minimum_runs: 35

remove-package-versions:
runs-on: ubuntu-latest
steps:
- name: purge container packages
uses: dylanratcliffe/delete-untagged-containers@main
with:
package_name: 'silabs-multipan-docker'
token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 11 additions & 9 deletions .github/workflows/container.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: 'container'
run-name: 'build for base version ${{ inputs.base_version }}${{ github.event.client_payload.base_version }}'

on:
workflow_dispatch:
Expand All @@ -7,19 +8,20 @@ on:
description: 'base image version'
required: true
default: 'latest'
# push:
# branches:
# - main
# paths-ignore:
# - 'README.md'
repository_dispatch:
types: [container]

jobs:
release:
runs-on: ubuntu-latest
permissions: write-all
steps:
- name: Checkout
uses: actions/checkout@v3

- name: set version
run: echo "BASE_VERSION=${{ inputs.base_version }}${{ github.event.client_payload.base_version }}" >> $GITHUB_ENV

- name: Login to DockerHub
uses: docker/login-action@v2
with:
Expand All @@ -39,7 +41,7 @@ jobs:
with:
images: ${{ vars.DOCKER_USERNAME }}/${{ vars.DOCKER_IMAGE }},ghcr.io/${{ github.repository }}
tags: |
type=raw,value=${{ inputs.base_version }}
type=raw,value=${{ env.BASE_VERSION }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
Expand All @@ -54,11 +56,11 @@ jobs:
# create an alias for arm64 (TARGETARCH in build arg) from the existing aarch64 image
# create an alias for arm (TARGETARCH in build arg) from the existing armv7 image
build-contexts: |
homeassistant/arm64-addon-silabs-multiprotocol:latest=docker-image://docker.io/homeassistant/aarch64-addon-silabs-multiprotocol:latest
homeassistant/arm-addon-silabs-multiprotocol:latest=docker-image://docker.io/homeassistant/armv7-addon-silabs-multiprotocol:latest
homeassistant/arm64-addon-silabs-multiprotocol:latest=docker-image://docker.io/homeassistant/aarch64-addon-silabs-multiprotocol:${{ env.BASE_VERSION }}
homeassistant/arm-addon-silabs-multiprotocol:latest=docker-image://docker.io/homeassistant/armv7-addon-silabs-multiprotocol:${{ env.BASE_VERSION }}
platforms: linux/amd64,linux/arm64,linux/arm/v7
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build-args: |
BASE_VERSION: ${{ inputs.base_version }}
BASE_VERSION: ${{ env.BASE_VERSION }}
16 changes: 16 additions & 0 deletions .github/workflows/scheduler.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: 'scheduler'

on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'

jobs:
latest:
runs-on: ubuntu-latest
steps:
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v2
with:
event-type: container
client-payload: '{"base_version": "latest"}'

0 comments on commit d676483

Please sign in to comment.