Update README with installation instructions for FHEM #220
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: FHEM Unit Tests | |
| permissions: | |
| actions: write | |
| contents: read | |
| on: | |
| pull_request: | |
| paths: | |
| - 'FHEM/**' | |
| - 'lib/**' | |
| - 'CHANGED' | |
| - 'controls_WebAuth.txt' | |
| - 'README.md' | |
| - '.devcontainer/svn-manifest.txt' | |
| - 't/**' | |
| - 'cpanfile' | |
| - 'scripts/**' | |
| - '.github/workflows/fhem_test.yml' | |
| push: | |
| paths: | |
| - 'FHEM/**' | |
| - 'lib/**' | |
| - 'CHANGED' | |
| - 'controls_WebAuth.txt' | |
| - 'README.md' | |
| - '.devcontainer/svn-manifest.txt' | |
| - 't/**' | |
| - 'cpanfile' | |
| - 'scripts/**' | |
| - '.github/workflows/fhem_test.yml' | |
| schedule: | |
| - cron: '33 16 * * 1' | |
| workflow_dispatch: | |
| jobs: | |
| update_controls: | |
| if: github.event_name == 'push' | |
| env: | |
| CONTROLS_FILENAME: controls_${{ github.event.repository.name }}.txt | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Extract branch name | |
| id: branch | |
| run: echo "name=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT" | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Update controls file | |
| uses: fhem/fhem-controls-actions@v3.0.1 | |
| with: | |
| filename: ${{ env.CONTROLS_FILENAME }} | |
| - name: Add authentication helper entries to controls file | |
| uses: fhem/fhem-controls-actions@v3.0.1 | |
| with: | |
| filename: ${{ env.CONTROLS_FILENAME }} | |
| directory: lib/FHEM/Core/Authentication | |
| extension: .pm | |
| writemode: a | |
| - name: Update README branch-specific update command | |
| env: | |
| CONTROLS_URL: https://raw.githubusercontent.com/${{ github.repository }}/${{ steps.branch.outputs.name }}/${{ env.CONTROLS_FILENAME }} | |
| run: | | |
| perl -0pi -e 's{(<!-- BEGIN GENERATED FHEM UPDATE URL: one-shot -->\n```text\nupdate all )\S+(\n```\n<!-- END GENERATED FHEM UPDATE URL: one-shot -->)}{$1$ENV{CONTROLS_URL}$2}s; s{(<!-- BEGIN GENERATED FHEM UPDATE URL: persistent -->\n```text\nupdate add )\S+(\n```\n<!-- END GENERATED FHEM UPDATE URL: persistent -->)}{$1$ENV{CONTROLS_URL}$2}s' README.md | |
| - name: Regenerate README module reference | |
| run: perl scripts/update-readme-from-module-docs.pl | |
| - name: Update CHANGED | |
| run: | | |
| log="$(date +'%Y-%m-%d') - $(git log -1 --pretty=%B)" | |
| { | |
| printf '%s\n\n' "$log" | |
| cat CHANGED 2>/dev/null || true | |
| } > CHANGED.new | |
| mv CHANGED.new CHANGED | |
| - name: Commit generated files | |
| id: commit_generated | |
| run: | | |
| git config --global user.email action@github.com | |
| git config --local user.name 'GitHub Action' | |
| git add CHANGED README.md "${CONTROLS_FILENAME}" || true | |
| if ! git diff --cached --quiet; then | |
| git commit -m 'Automatic update of controls and CHANGED' | |
| echo "created=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "created=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Push generated files | |
| if: steps.commit_generated.outputs.created == 'true' | |
| env: | |
| BOT_PUSH_TOKEN: ${{ secrets.BOT_PUSH_TOKEN }} | |
| BRANCH_NAME: ${{ steps.branch.outputs.name }} | |
| run: | | |
| echo "::add-mask::$BOT_PUSH_TOKEN" | |
| git remote set-url origin "https://x-access-token:${BOT_PUSH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | |
| git push origin "HEAD:${BRANCH_NAME}" | |
| - name: Trigger follow-up runs for generated branch head | |
| if: steps.commit_generated.outputs.created == 'true' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| for (const workflow_id of ['perlCritic.yml']) { | |
| await github.rest.actions.createWorkflowDispatch({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| workflow_id, | |
| ref: process.env.BRANCH_NAME, | |
| }); | |
| } | |
| env: | |
| BRANCH_NAME: ${{ steps.branch.outputs.name }} | |
| test: | |
| runs-on: ubuntu-latest | |
| concurrency: | |
| group: ${{ github.workflow }}-test-${{ matrix.perl }}-${{ github.event.pull_request.head.ref || github.ref_name }} | |
| cancel-in-progress: true | |
| strategy: | |
| matrix: | |
| perl: ['5.28', '5.32', '5.38'] | |
| name: Perl ${{ matrix.perl }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: shogo82148/actions-setup-perl@v1.38.1 | |
| with: | |
| perl-version: ${{ matrix.perl }} | |
| install-modules-with: cpanm | |
| install-modules-args: --notest | |
| - name: Install CPAN dependencies | |
| run: cpanm --installdeps . --notest | |
| - name: Install FHEM via debian nightly | |
| uses: fhem/setup-fhem@v1.0.1 | |
| - name: Change ownership of /opt/fhem | |
| run: sudo chown -R --reference=cpanfile /opt/fhem | |
| - name: Run helper module tests | |
| run: prove -I lib -r -vv t/FHEM/Core/Authentication | |
| - name: Run FHEM testsuite | |
| env: | |
| FHEM_DIR: /opt/fhem | |
| run: | | |
| cp -r FHEM/* ${FHEM_DIR}/FHEM/ | |
| mkdir -p ${FHEM_DIR}/lib | |
| cp -r lib/* ${FHEM_DIR}/lib/ | |
| cd ${FHEM_DIR} | |
| prove --exec 'perl fhem.pl -t' -I FHEM -r -vv \ | |
| ${GITHUB_WORKSPACE}/t/FHEM/01_FHEMWEB \ | |
| ${GITHUB_WORKSPACE}/t/FHEM/98_WebAuth |