Skip to content

Commit

Permalink
Merge branch 'dresden-elektronik:master' into ubisys-h1
Browse files Browse the repository at this point in the history
  • Loading branch information
jan666 authored Jun 26, 2024
2 parents 389fff4 + 6f307e6 commit 4024c78
Show file tree
Hide file tree
Showing 447 changed files with 14,077 additions and 3,087 deletions.
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ body:
- deCONZ GUI: Menu > Help > About deCONZ.
value: |
- Host system: (Raspberry Pi / PC / NAS / MAC)
- Running method: (Raspbian / Ubuntu / Home Assistent deCONZ Add-on / Marthoc Docker container / Windows / Virtual Machine)
- Running method: (Raspbian / Ubuntu / Home Assistent deCONZ Add-on / deconz-docker container / Windows / Virtual Machine)
- Firmware version: (26xxyy00)
- deCONZ version (not Home assistant Addon version!): (2.xx.yy)
- Device: (ConBee I / ConBee II / ConBee III / RaspBee I / RaspBee II)
Expand All @@ -88,4 +88,4 @@ body:
description: |
If relevant, add any other context about the problem here, like network size, number of routers and end-devices and what kind of devices/brands are in the network.
validations:
required: false
required: false
171 changes: 171 additions & 0 deletions .github/workflows/ci-ddf-bundles.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# This is a basic workflow to help you get started with Actions

name: CI DDF Bundles

# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
paths:
- 'devices/**'

pull_request:
types: [opened, synchronize]
branches: [ master ]
paths:
- 'devices/**'

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
inputs:
uploadArtifact:
description: Build an artifact for the DDF
required: true
default: true
type: boolean
uploadOnStore:
description: Upload the DDF on the store
required: true
default: false
type: boolean
bundlerSignatureKeys:
description: Comma seperated list of private keys to sign the bundle with
required: false
default: ''
type: string
bundlerOutputDirectoryFormat:
description: Format of the output directory structure
required: true
default: 'flat'
type: choice
options:
- 'flat'
- 'source-tree'
bundlerOutputFileFormat:
description: Format of the output files names
required: true
default: 'hash'
type: choice
options:
- 'hash'
- 'name'
- 'name-hash'
bundlerFileModifiedMethod:
description: Method to use to get the file modification time
required: true
default: 'gitlog'
type: choice
options:
- 'gitlog'
- 'mtime'
- 'ctime'
validationStrict:
description: Enable strict validation
required: true
default: false
type: boolean
validationEnforceUUID:
description: Enforce UUID in the DDF
required: true
default: true
type: boolean
autoCommitUUID:
description: Enable auto update of UUID
required: true
default: true
type: boolean

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "ci-ddf-bundles"
ci-ddf-bundles:
# The type of runner that the job will run on
runs-on: ubuntu-latest
name: CI DDF Bundles

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Run DDF Workflow Dispatch
if: github.event_name == 'workflow_dispatch'
uses: deconz-community/ddf-tools-action@v1
with:
mode: manual
source-devices-path: 'devices'

# Bundler options
bundler-sign-keys: ${{ inputs.bundlerSignatureKeys }}
bundler-output-directory-format: ${{ inputs.bundlerOutputDirectoryFormat }}
bundler-output-file-format: ${{ inputs.bundlerOutputFileFormat }}
bundler-file-modified-method: ${{ inputs.bundlerFileModifiedMethod }}

# Bundler Validation options
bundler-validation-strict: ${{ inputs.validationStrict }}
bundler-validation-enforce-uuid: ${{ inputs.validationEnforceUUID && !inputs.autoCommitUUID }}

# UUID automatic generation
auto-commit-uuid: ${{ inputs.autoCommitUUID }}

# Github artifact
upload-artifact-enabled: ${{ inputs.uploadArtifact == true }}
upload-artifact-filter: 'added,modified,unchanged'
upload-artifact-retention-days: 7

# DDF Store
upload-store-enabled: ${{ inputs.uploadOnStore == true }}
upload-store-status: 'beta'
upload-store-url: 'https://ddf.cryonet.io'
upload-store-token: ${{ secrets.STORE_TOKEN }}

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run DDF Push Action
if: github.event_name == 'push'
uses: deconz-community/ddf-tools-action@v1
with:
mode: push
source-devices-path: 'devices'

# UUID automatic generation
auto-commit-uuid: 'true'
bundler-validation-enforce-uuid: 'false'

# Github artifact
upload-artifact-enabled: false

# DDF Store
upload-store-enabled: true
upload-store-status: 'beta'
upload-store-url: 'https://ddf.cryonet.io'
upload-store-token: ${{ secrets.STORE_TOKEN }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Run DDF Pull Request Interaction
if: github.event_name == 'pull_request'
uses: deconz-community/ddf-tools-action@v1
with:
mode: pull_request
source-devices-path: 'devices'

# Github artifact
upload-artifact-enabled: true
upload-artifact-filter: 'added,modified'
upload-artifact-retention-days: 30

# DDF Store
# Bundles are uploaded only on the push event when the PR is merged
upload-store-enabled: false

# Validation
bundler-validation-enforce-uuid: 'false'

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90 changes: 90 additions & 0 deletions .github/workflows/interactions-dispatcher.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Interactions dispatcher

on:
workflow_run:
workflows: ["CI DDF Bundles"]

jobs:
use_output:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v7
name: 'Interactions dispatcher'

with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const fs = require('fs');
async function upsertComment(owner, repo, issue_number, marker, body) {
const {data: comments} = await github.rest.issues.listComments(
{owner, repo, issue_number});
body = `${marker}\n${body}`;
const existing = comments.filter((c) => c.body.includes(marker));
if (existing.length > 0) {
const last = existing[existing.length - 1];
core.info(`Updating comment ${last.id}`);
await github.rest.issues.updateComment({
owner, repo,
body,
comment_id: last.id,
});
} else {
core.info(`Creating a comment in issue / PR #${issue_number}`);
await github.rest.issues.createComment({issue_number, body, owner, repo});
}
}
async function run(){
const {owner, repo} = context.repo;
core.info("Fetching artifacts list")
const allArtifacts = await github.rest.actions.listWorkflowRunArtifacts({
owner,
repo,
run_id: context.payload.workflow_run.id,
});
const matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name === "interaction_data"
})[0];
if(matchArtifact === undefined) {
core.info("No artifact found, stopping the action")
return
}
core.info(`Downloading artifact #${matchArtifact.id}`)
const download = await github.rest.actions.downloadArtifact({
owner,
repo,
artifact_id: matchArtifact.id,
archive_format: 'zip',
});
await github.rest.actions.deleteArtifact({
owner,
repo,
artifact_id: matchArtifact.id
})
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/interaction_data.zip`, Buffer.from(download.data));
await exec.exec(`unzip ${process.env.GITHUB_WORKSPACE}/interaction_data.zip`);
const interaction_data = JSON.parse(fs.readFileSync(`${process.env.GITHUB_WORKSPACE}/interaction_data.json`));
await Promise.all(interaction_data.map(async (data) => {
const {mode, marker, issue_number, body} = data;
if(mode === 'upsert')
await upsertComment(owner, repo, issue_number, marker, body);
else if(mode === 'insert')
await github.rest.issues.createComment({issue_number, body, owner, repo});
}));
}
run();
46 changes: 0 additions & 46 deletions .github/workflows/verify-ddf-json.yml

This file was deleted.

Loading

0 comments on commit 4024c78

Please sign in to comment.