Skip to content

Commit

Permalink
Merge branch 'RFD-FHEM:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Devirex authored Feb 4, 2024
2 parents 769962c + 910f5eb commit 2d02ef0
Show file tree
Hide file tree
Showing 29 changed files with 3,171 additions and 1,001 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/perlCritic.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ jobs:
if: github.event_name == 'pull_request'
steps:
- name: Checkout repository
uses: actions/checkout@v3
- uses: shogo82148/actions-setup-perl@v1.21.2
uses: actions/checkout@v4
- uses: shogo82148/actions-setup-perl@v1.28.0
with:
perl-version: 5.32
install-modules-with: cpanm
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/prove.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ jobs:
perl: [ '5.24', '5.28','5.32' ]
name: Perl ${{ matrix.perl }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: shogo82148/actions-setup-perl@v1.21.2
- uses: actions/checkout@v4
- uses: shogo82148/actions-setup-perl@v1.28.0
with:
perl-version: ${{ matrix.perl }}
install-modules-with: cpanm
Expand All @@ -43,7 +43,7 @@ jobs:
FHEM_DIR: /opt/fhem
- name: Create clover report for perl Modules
run: cover -report clover
- uses: codecov/codecov-action@v3.1.4
- uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./cover_db/clover.xml
Expand All @@ -53,7 +53,7 @@ jobs:
- name: Create clover report for fhem tests
working-directory: /opt/fhem/
run: cover -report clover
- uses: codecov/codecov-action@v3.1.4
- uses: codecov/codecov-action@v4.0.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: /opt/fhem/cover_db/clover.xml
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ jobs:
- name: Extract branch name
id: extract_branch
run: |
echo ::set-output name=BRANCH_NAME::${GITHUB_REF#refs/*/}
echo "BRANCH_NAME=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Check if Branch is in PR
if: github.event_name == 'push'
id: checkbranch
uses: actions/github-script@v6
uses: actions/github-script@v7
with:
script: |
console.log(process.env.BRANCH_NAME)
Expand Down Expand Up @@ -58,18 +58,18 @@ jobs:
id: extract_branch
- name: Checkout Repostory
if: needs.pr_check.outputs.result != 'true'
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: false
- name: update controls file (FHEM)
if: needs.pr_check.outputs.result != 'true'
uses: fhem/fhem-controls-actions@v2.2.0
uses: fhem/fhem-controls-actions@V2.2.1
with:
filename: controls_signalduino.txt
- name: update controls file (lib)
if: needs.pr_check.outputs.result != 'true'
uses: fhem/fhem-controls-actions@v2.2.0
uses: fhem/fhem-controls-actions@V2.2.1
with:
filename: controls_signalduino.txt
directory: FHEM/lib
Expand Down
104 changes: 53 additions & 51 deletions .github/workflows/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
# We need to fetch with a depth of 2 for pull_request so we can do HEAD^2
fetch-depth: 2
Expand All @@ -22,15 +22,25 @@ jobs:
- name: "[Push] Get commit message"
if: github.event_name == 'push'
id: push_get_commit_message
run:
echo ::set-output name=push_commit_message::$(git log --format=%B -n 1 HEAD)
run: |
{
echo 'pr_commit_message<<EOF'
git log --format=%B -n 1 HEAD
echo EOF
} >> $GITHUB_OUTPUT
# If this workflow was triggered by a pull request (open or synchronize!) then resolve the commit message from HEAD^2
# It is stored in output steps, to be referenced with ${{ steps.pr_get_commit_message.outputs.pr_commit_message }}
- name: "[Pull Request] Get commit message"
if: github.event_name == 'pull_request'
id: pr_get_commit_message
run: echo ::set-output name=pr_commit_message::$(git log --format=%B -n 1 HEAD^2)
run: |
{
echo 'pr_commit_message<<EOF'
git log --format=%B -n 1 HEAD^2
echo EOF
} >> $GITHUB_OUTPUT
# Finally we want to make the commit message available to other jobs. This can be done with job-level outputs
# However as we do not know whether the commit message was set in Push or Pull Request event we need to do some
Expand All @@ -54,59 +64,43 @@ jobs:
runs-on: ubuntu-latest
steps:
- id: file_changes
uses: trilom/[email protected]
uses: tj-actions/changed-files@v42
with:
output: ','
json: true
quotepath: false
files: |
FHEM/**.pm
FHEM/lib/**.pm
lib/FHEM/**.pm
- name: Get current date
id: date
run: |
echo "::set-output name=date::$(date -u +'%Y%m%d')"
echo "::set-output name=datetimestr::$(date -u +'%Y-%m-%d %T')"
echo "date=$(date -u +'%Y%m%d')" >> $GITHUB_OUTPUT
echo "datetimestr=$(date -u +'%Y-%m-%d %T')" >> $GITHUB_OUTPUT
- name: Set matrix for build
id: set-matrix
if: ${{ github.event.sender != 'actions-user' }}
run: |
JSON="{\"include\":["
# Loop by lines
IFS=, read -ra values <<< "${{ steps.file_changes.outputs.files_modified}},${{ steps.file_changes.outputs.files_added}}"
for v in "${values[@]}"
do
# Exclude non pm files
if [[ "$v" != *.pm ]]; then
continue
fi;
# Add build to the matrix only if it is not already included
JSONline="{\"file\": \"$v\"},"
if [[ "$JSON" != *"$JSONline"* ]]; then
JSON="$JSON$JSONline"
fi
done
# Remove last "," and add closing brackets
if [[ $JSON == *, ]]; then
JSON="${JSON%?}"
fi
JSON="$JSON]}"
echo $JSON
run:
echo "matrix={\"files\":${{ steps.file_changes.outputs.all_changed_files }}}" >> "$GITHUB_OUTPUT"

# Set output
echo "::set-output name=matrix::$( echo "$JSON" )"
modify:
if: ${{ fromJSON( needs.metadata.outputs.matrix ).include[0] }}
if: ${{ fromJSON( needs.metadata.outputs.matrix ).files[0] }}
continue-on-error: true
runs-on: ubuntu-latest
needs: metadata
strategy:
matrix: ${{ fromJson(needs.metadata.outputs.matrix) }}
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Find Version String
if: endsWith(matrix.file, '00_SIGNALduino.pm')
if: endsWith(matrix.files, '00_SIGNALduino.pm')
id: versionList
uses: nguyenvanuyn96/str-find-action@master
with:
find: '\d\.\d\.\d'
include: "${{ matrix.file }}"
include: "${{ matrix.files }}"
- uses: jungwinter/split@v2
name: Split array result
if: ${{ steps.versionList.outputs.fileFoundCount > 0 }}
Expand All @@ -120,48 +114,56 @@ jobs:
with:
find: \w+\s+=>\s\'\d.\d.\d\+\d+\'
replace: "SDUINO_VERSION => '${{ steps.versions.outputs._1 }}+${{ needs.metadata.outputs.date }}'"
include: "${{ matrix.file }}"
include: "${{ matrix.files }}"
- name: Update Date in ID line
uses: jacobtomlinson/[email protected]
with:
find: \d\d\d\d-\d\d-\d\d\s\d\d:\d\d:\d\dZ\s[\w|-]+\s
replace: "${{ needs.metadata.outputs.datetime }}Z ${{ github.event.pull_request.user.login }} "
include: "${{ matrix.file }}"
include: "${{ matrix.files }}"
- name: Artifactname
env:
ARTIFACT_NAME: "${{ matrix.files }}"
run: |
ARTIFACT_NAME=${{ env.ARTIFACT_NAME }}
ARTIFACT_NAME=$(basename $ARTIFACT_NAME) # get only the filename and use this as artifact name
echo ARTIFACT_NAME=${ARTIFACT_NAME} >> $GITHUB_ENV # update GitHub ENV vars
- name: Save updated Files in artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: updated-files
name: ${{ env.ARTIFACT_NAME }}
retention-days: 1
path: |
${{ matrix.file }}
${{ matrix.files }}
commit:
permissions:
contents: write
runs-on: ubuntu-latest
needs: modify
name: Commit and Push back
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0
persist-credentials: false
- name: Download all modified artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
path: ${{ github.workspace }}
path: ${{ github.workspace }}/artifacts

- name: replace files from artifacts
run: |
for FPATH in ./updated-files/*.pm; do
for FPATH in ./artifacts/*/*.pm; do
FILE=$(basename $FPATH)
find ./FHEM -name "$FILE" -exec cp $FPATH "{}" \;
done
- name: update controls file (FHEM)
uses: fhem/fhem-controls-actions@v2.2.0
uses: fhem/fhem-controls-actions@V2.2.1
with:
filename: controls_signalduino.txt
- name: update controls file (lib)
uses: fhem/fhem-controls-actions@v2.2.0
uses: fhem/fhem-controls-actions@V2.2.1
with:
filename: controls_signalduino.txt
directory: FHEM/lib
Expand All @@ -171,11 +173,11 @@ jobs:
run: |
git config --global user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -m "Update Versiondate" -a && echo "::set-output name=status::true" || true
git commit -m "Update Versiondate" -a && echo "status=true" >> $GITHUB_OUTPUT || true
- name: Wait for tests to succeed
if: ${{ steps.commit.outputs.status }}
uses: lewagon/[email protected].1
uses: lewagon/[email protected].3
with:
running-workflow-name: 'Commit and Push back'
ref: ${{ github.head_ref }}
Expand All @@ -185,7 +187,7 @@ jobs:

- name: git push
if: ${{ steps.commit.outputs.status }}
uses: ad-m/github-push-action@v0.6.0
uses: ad-m/github-push-action@v0.8.0
with:
github_token: ${{ secrets.GH_TOKEN }}
branch: ${{ github.head_ref }}
Expand Down
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cover_db/
.vscode
jsonExtract.pl
errorformat
errorformat.small
docker_test.sh
testOutput.*
memleak.pl
t/FHEM/global/*
lib/Test2/Formatter/gha.pm
bin/reviewdog
workspace.code-workspace
.vstags
Loading

0 comments on commit 2d02ef0

Please sign in to comment.