From 2937e0ce9050db1f6be6d3f63bc1ab7e4cba180b Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 4 Jan 2023 18:25:30 +0100 Subject: [PATCH 1/5] add control file --- FHEM/70_Matrix.pm | 2 +- controls_Matrix.txt | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) create mode 100644 controls_Matrix.txt diff --git a/FHEM/70_Matrix.pm b/FHEM/70_Matrix.pm index 57784d3..206bdac 100644 --- a/FHEM/70_Matrix.pm +++ b/FHEM/70_Matrix.pm @@ -370,7 +370,7 @@ __END__ "abstract": "Stellt einen Matrix-Chatbot bereit" } }, - "version": "v0.15.3", + "version": "v0.15.4", "author": [ "Manfred Bielemeier" ], diff --git a/controls_Matrix.txt b/controls_Matrix.txt new file mode 100644 index 0000000..64b00a2 --- /dev/null +++ b/controls_Matrix.txt @@ -0,0 +1,2 @@ +UPD 2023-01-04_18:24:55 16959 FHEM/70_Matrix.pm +UPD 2023-01-04_17:59:18 51844 lib/FHEM/Devices/Matrix/Client.pm From d24ada08f591cce3b3f2623bce263f10408c8ed2 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 4 Jan 2023 18:30:23 +0100 Subject: [PATCH 2/5] remove not supported files --- controls_matrix.txt | 1 - controls_mod_template.txt | 1 - cpanfile | 4 ---- hooks/pre-commit | 12 ++++++------ t/FHEM/98_MATRIX/00_define.t | 31 ------------------------------- t/FHEM/98_MATRIX/fhem.cfg | 1 - 6 files changed, 6 insertions(+), 44 deletions(-) delete mode 100644 controls_matrix.txt delete mode 100644 controls_mod_template.txt delete mode 100644 cpanfile delete mode 100644 t/FHEM/98_MATRIX/00_define.t delete mode 100644 t/FHEM/98_MATRIX/fhem.cfg diff --git a/controls_matrix.txt b/controls_matrix.txt deleted file mode 100644 index 35d67bd..0000000 --- a/controls_matrix.txt +++ /dev/null @@ -1 +0,0 @@ -UPD 2022-11-24_23:21:11 16031 FHEM/98_Matrix.pm diff --git a/controls_mod_template.txt b/controls_mod_template.txt deleted file mode 100644 index e2a7990..0000000 --- a/controls_mod_template.txt +++ /dev/null @@ -1 +0,0 @@ -UPD 2022-01-07_00:05:45 4688 FHEM/98_Matrix.pm diff --git a/cpanfile b/cpanfile deleted file mode 100644 index 4eade56..0000000 --- a/cpanfile +++ /dev/null @@ -1,4 +0,0 @@ -requires 'Test2::Suite'; -requires 'Devel::Cover'; -requires 'Devel::Cover::Report::Clover'; -recommends 'Pod::Usage'; diff --git a/hooks/pre-commit b/hooks/pre-commit index 7c0320b..9ac47d6 100644 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -1,20 +1,20 @@ -parseParams#!/usr/bin/perl -w +#!/usr/bin/perl -w use File::Basename; use POSIX qw(strftime); use strict; -my @filenames = ( 'FHEM/98_Matrix.pm', - 'lib/FHEM/Devices/Matrix.pm' - ); +my @filenames = ( 'FHEM/70_Matrix.pm', + 'lib/FHEM/Devices/Matrix/Client.pm', + ); -my $controlsfile = 'controls_Matrix.txt'; +my $controlsfile = 'controls_Matrix.txt'; open(FH, ">$controlsfile") || return("Can't open $controlsfile: $!"); for my $filename (@filenames) { my @statOutput = stat($filename); - + if (scalar @statOutput != 13) { printf 'error: stat has unexpected return value for ' . $filename . "\n"; next; diff --git a/t/FHEM/98_MATRIX/00_define.t b/t/FHEM/98_MATRIX/00_define.t deleted file mode 100644 index f6d8f31..0000000 --- a/t/FHEM/98_MATRIX/00_define.t +++ /dev/null @@ -1,31 +0,0 @@ -use strict; -use warnings; - -use Test2::V0; -use Test2::Tools::Compare qw{is U}; - -InternalTimer(time()+1, sub() { - my %hash; - $hash{TEMPORARY} = 1; - $hash{NAME} = q{dummyMatrix}; - $hash{TYPE} = q{Matrix server user}; - $hash{STAE} = q{???}; - - subtest "Matrix Test checking define" => sub { - $hash{DEF} = "pass"; - plan(2); - my $ret = Matrix_Define(\%hash,qq{$hash{NAME} $hash{TYPE}}); - like ($ret, qr/too few parameters: define Matrix /, 'check error message Matrix_Define'); - - $ret = Matrix_Define(\%hash,qq{$hash{NAME} $hash{TYPE} $hash{DEF}}); - is ($ret, U(), 'check returnvalue Matrix_Define'); - }; - - - - done_testing(); - exit(0); - -}, 0); - -1; \ No newline at end of file diff --git a/t/FHEM/98_MATRIX/fhem.cfg b/t/FHEM/98_MATRIX/fhem.cfg deleted file mode 100644 index 6508fce..0000000 --- a/t/FHEM/98_MATRIX/fhem.cfg +++ /dev/null @@ -1 +0,0 @@ -define dummyMatrix Matrix matrix.web05.de \ No newline at end of file From 9460fb059ced2e19c6a8fb98ebce9d9ddc44b22c Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 4 Jan 2023 18:32:21 +0100 Subject: [PATCH 3/5] remove perlcritic and github actions --- .gitattributes | 14 ----- .github/dependabot.yml | 7 --- .github/workflows/fhem_test.yml | 97 -------------------------------- .github/workflows/perlCritic.yml | 34 ----------- .perlcritic | 2 - 5 files changed, 154 deletions(-) delete mode 100644 .gitattributes delete mode 100644 .github/dependabot.yml delete mode 100644 .github/workflows/fhem_test.yml delete mode 100644 .github/workflows/perlCritic.yml delete mode 100644 .perlcritic diff --git a/.gitattributes b/.gitattributes deleted file mode 100644 index 5b791c0..0000000 --- a/.gitattributes +++ /dev/null @@ -1,14 +0,0 @@ -# Set the default behavior, in case people don't have core.autocrlf set. -* text=auto eol=lf - -# Explicitly declare text files you want to always be normalized and converted -# to native line endings on checkout. -*.pm text eol=lf -*.pl text eol=lf -*.hash text eol=lf -*.txt text eol=lf -*.sh text eol=lf - -# Denote all files that are truly binary and should not be modified. -*.hex binary -*.bin binary diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 6fddca0..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -1,7 +0,0 @@ -version: 2 -updates: - # Maintain dependencies for GitHub Actions - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "weekly" diff --git a/.github/workflows/fhem_test.yml b/.github/workflows/fhem_test.yml deleted file mode 100644 index 9e3a92e..0000000 --- a/.github/workflows/fhem_test.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Fhem UnitTest -on: - push: - branches: - paths: - - 'FHEM/**' - - 'UnitTest/**' - - 't/**' - - '.github/workflows/fhem_test.yml' - - schedule: - - cron: '43 17 * * 1' - -jobs: - update_controls: - env: - CONTROLS_FILENAME: controls_${{ github.event.repository.name }}.txt - runs-on: ubuntu-latest - steps: - - name: Extract branch name - run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/*/})" - id: extract_branch - - name: Checkout Repostory - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - name: update controls files - uses: fhem/fhem-controls-actions@v2 - with: - filename: ${{env.CONTROLS_FILENAME}} - - name: update CHANGED - run: | - LOG=$(date +"%Y-%m-%d") - LOG+=" - $(git log -1 --pretty=%B)" - echo "$LOG" | cat - CHANGED 2>/dev/null >> temp || true && mv temp CHANGED - - name: git commit back - run: | - git config --global user.email "action@github.com" - git config --local user.name "GitHub Action" - git add CHANGED ${{env.CONTROLS_FILENAME}} || true - git log -1 --name-only --pretty=format: | grep -Eo '[0-9]{2}_.*.pm$' && git commit CHANGED ${{env.CONTROLS_FILENAME}} -m "Automatic updated controls and CHANGED" || true - - name: git push - uses: ad-m/github-push-action@v0.6.0 - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: ${{ steps.extract_branch.outputs.branch }} -# test: -# runs-on: ubuntu-latest -# if: github.event_name == 'push' -# strategy: -# matrix: -# os: ['ubuntu-latest'] -# perl: [ '5.22', '5.28', '5.30', '5.32' ] -# -# name: Perl ${{ matrix.perl }} on ${{ matrix.os }} -# steps: -# - uses: actions/checkout@v3 -# - uses: shogo82148/actions-setup-perl@v1.18.0 -# with: -# perl-version: ${{ matrix.perl }} -# install-modules-with: cpanm -# install-modules-args: --notest -# - name: install fhem via deb package -# run: | -# wget -qO - http://debian.fhem.de/archive.key | sudo apt-key add - -# echo "deb http://debian.fhem.de/nightly/ /" | sudo tee -a /etc/apt/sources.list -# sudo apt-get update -qq -# sudo apt-get install fhem -y -# sudo systemctl stop fhem -# sudo chown -R --reference=README.md /opt/fhem -## - name: run prove on perl modules (testscripts) -## run: prove --exec 'perl -MDevel::Cover=-silent,1 -I FHEM ' -I FHEM -r -vv t/FHEM/ -## - uses: codecov/codecov-action@v1 -## with: -## token: ${{ secrets.CODECOV_TOKEN }} -## file: ./cover_db/clover.xml -## flags: unittests,perl,modules -## name: perl modules (testscripts) ${{ matrix.perl }} -# - name: run prove fhem testsuite ${{ matrix.perl }} on modules -# run: | -# cp -r FHEM/* ${FHEM_DIR}/FHEM/ -# cd ${FHEM_DIR} -# prove --exec 'perl -MDevel::Cover=-silent,1 fhem.pl -t' -I FHEM -r -vv ${GITHUB_WORKSPACE}/t/FHEM/98_Matrix/[0-9][0-9]_*/ -# sleep 3 -# cp -R /opt/fhem/cover_db ${GITHUB_WORKSPACE}/ -# ls -l ${GITHUB_WORKSPACE} -# env: -# FHEM_DIR: /opt/fhem -# - name: Create clover report -# run: cover -report clover -## - uses: codecov/codecov-action@v1 -## with: -## token: ${{ secrets.CODECOV_TOKEN }} -## file: ./cover_db/clover.xml -## flags: unittests,fhem,modules -## name: fhem (testscripts) ${{ matrix.perl }} - \ No newline at end of file diff --git a/.github/workflows/perlCritic.yml b/.github/workflows/perlCritic.yml deleted file mode 100644 index 61ff9c6..0000000 --- a/.github/workflows/perlCritic.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Perlcritic check - -on: - pull_request: - types: [opened, synchronize] - - -jobs: - critic: - runs-on: ubuntu-latest - if: github.event_name == 'pull_request' - steps: - - name: Checkout repository - uses: actions/checkout@v3 - - uses: shogo82148/actions-setup-perl@v1.18.0 - with: - perl-version: 5.32 - install-modules-with: cpanm - install-modules: Perl::Critic Task::PerlCriticAllPolicies - install-modules-args: --notest - - uses: reviewdog/action-setup@v1 - with: - reviewdog_version: latest # Optional. [latest,nightly,v.X.Y.Z] - - name: run perlcritic and send report via reviewdog - env: - REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - (perlcritic --verbose 1 --profile .perlcritic ./FHEM; perlcritic --verbose 1 --profile .perlcritic ./lib; ) | \ - reviewdog -efm '%f:%l:%c:%m' \ - -name="perlcritic" \ - -reporter="github-pr-check" \ - -filter-mode="added" \ - -fail-on-error="false" \ - -level="warning" \ diff --git a/.perlcritic b/.perlcritic deleted file mode 100644 index 307b0c7..0000000 --- a/.perlcritic +++ /dev/null @@ -1,2 +0,0 @@ -severity = 5 -color = 1 \ No newline at end of file From e64e71ba179598981bf9ccd88f5f58b11030e30a Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 4 Jan 2023 18:34:10 +0100 Subject: [PATCH 4/5] remove gitignore file --- .gitignore | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100644 .gitignore diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 25f63f6..0000000 --- a/.gitignore +++ /dev/null @@ -1,37 +0,0 @@ -!Build/ -.last_cover_stats -/META.yml -/META.json -/MYMETA.* -*.o -*.pm.tdy -*.bs -.vscode/ -.gitignore - -# Devel::Cover -cover_db/ - -# Devel::NYTProf -nytprof.out - -# Dizt::Zilla -/.build/ - -# Module::Build -_build/ -Build -Build.bat - -# Module::Install -inc/ - -# ExtUtils::MakeMaker -/blib/ -/_eumm/ -/*.gz -/Makefile -/Makefile.old -/MANIFEST.bak -/pm_to_blib -/*.zip \ No newline at end of file From 1961d02f10c4be19b054b4419d31173b363eba71 Mon Sep 17 00:00:00 2001 From: Marko Oldenburg Date: Wed, 4 Jan 2023 18:36:06 +0100 Subject: [PATCH 5/5] change README --- README.md | 51 ++------------------------------------------------- 1 file changed, 2 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index 66b148a..b1bfffb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# FHEM/98_Matrix.pm +# FHEM/70_Matrix.pm ## Vorwort Ich habe seit gefühlten Ewigkeiten FHEM im Einsatz und jetzt neu auch Matrix, was bei mir Telegram als Meldungszentrale ablösen soll. Ich bin dabei einen Bot als FHEM-Modul aufzubauen der sowohl Meldungen absetzen kann als auch Befehle empfangen kann. @@ -32,51 +32,4 @@ https://wiki.fhem.de/wiki/DevelopmentModuleIntro ### lib/ -Put any libs(pure perl modules) you provide in a own package (not main) create in here - -## automated Testing - -### t/FHEM/98_Matrix/* - -Unittests for the fhem mdoule run via github actions if needed you have to write them into folder t/FHEM// - - -### t/FHEM//* - -Unittests for the perl mdoule run via github actions if needed you have to write them into folder t/FHEM// -Unittests (run prove on perl modules (testscripts)) needs to be enabled in the fhem_test.yml workflow - -``` - - name: run prove on perl modules (testscripts) - run: prove --exec 'perl -MDevel::Cover=-silent,1 -I FHEM ' -I FHEM -r -vv t/FHEM/ -``` - -### cpanfile - -Cpan modules needed for running your module and your tests, they will be installed after perl is set up and running - -### .github/workflows/update.yml - -This is a github action workflow which creates a controls file which is needed for fhem update command. -You are then able to install your new module -`update all https://raw.githubusercontent.com/fhem///controls_.txt` - -### .github/workflows/fhem_test.yml - -This is a github action workflow which runs all your tests in t/xx_ folder with different perl versions. - -### .github/dependabot.yml - -Dependabot will check if there are new versions form used actions you are using in your worflows and inform you. - -### Code coverage -You can use codecov (https://about.codecov.io/) to monitor your test code coveage. -Simply enable the coverage action an provide a token vom codecov.io via github secrets - - - uses: codecov/codecov-action@v1 - with: - token: ${{ secrets.CODECOV_TOKEN }} - file: ./cover_db/clover.xml - flags: unittests,fhem,modules - name: fhem (testscripts) ${{ matrix.perl }} - +Put any libs(pure perl modules) you provide in a own package (not main) create in here \ No newline at end of file