diff --git a/.github/auto-merge.yml b/.github/auto-merge.yml index 3f5fbe36..1c018643 100644 --- a/.github/auto-merge.yml +++ b/.github/auto-merge.yml @@ -3,15 +3,14 @@ - match: # Only merge patches for production dependencies dependency_type: production - update_type: "semver:patch" + update_type: 'semver:patch' - match: # Except for security fixes, here we allow minor patches dependency_type: production - update_type: "security:minor" + update_type: 'security:minor' - match: # and development dependencies can have a minor update, too dependency_type: development - update_type: "semver:minor" - + update_type: 'semver:minor' # The syntax is based on the legacy dependabot v1 automerged_updates syntax, see: -# https://dependabot.com/docs/config-file/#automerged_updates \ No newline at end of file +# https://dependabot.com/docs/config-file/#automerged_updates diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 43237f8f..4aad956f 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,24 +1,24 @@ version: 2 updates: - - package-ecosystem: github-actions - directory: "/" - schedule: - interval: monthly - time: "04:00" - timezone: Europe/Berlin - - package-ecosystem: npm - directory: "/" - schedule: - interval: monthly - time: "04:00" - timezone: Europe/Berlin - open-pull-requests-limit: 5 - versioning-strategy: increase - - package-ecosystem: npm - directory: "/src" - schedule: - interval: monthly - time: "04:00" - timezone: Europe/Berlin - open-pull-requests-limit: 5 - versioning-strategy: increase + - package-ecosystem: github-actions + directory: '/' + schedule: + interval: monthly + time: '04:00' + timezone: Europe/Berlin + - package-ecosystem: npm + directory: '/' + schedule: + interval: monthly + time: '04:00' + timezone: Europe/Berlin + open-pull-requests-limit: 5 + versioning-strategy: increase + - package-ecosystem: npm + directory: '/src' + schedule: + interval: monthly + time: '04:00' + timezone: Europe/Berlin + open-pull-requests-limit: 5 + versioning-strategy: increase diff --git a/.github/stale.yml b/.github/stale.yml index 8a1bc210..c8cf3a3b 100644 --- a/.github/stale.yml +++ b/.github/stale.yml @@ -12,9 +12,9 @@ onlyLabels: [] # Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable exemptLabels: - - enhancement - - security - - bug + - enhancement + - security + - bug # Set to true to ignore issues in a project (defaults to false) exemptProjects: true @@ -30,19 +30,19 @@ staleLabel: wontfix # Comment to post when marking as stale. Set to `false` to disable markComment: > - This issue has been automatically marked as stale because it has not had - recent activity. It will be closed if no further activity occurs within the next 7 days. - Please check if the issue is still relevant in the most current version of the adapter - and tell us. Also check that all relevant details, logs and reproduction steps - are included and update them if needed. - Thank you for your contributions. - - Dieses Problem wurde automatisch als veraltet markiert, da es in letzter Zeit keine Aktivitäten gab. - Es wird geschlossen, wenn nicht innerhalb der nächsten 7 Tage weitere Aktivitäten stattfinden. - Bitte überprüft, ob das Problem auch in der aktuellsten Version des Adapters noch relevant ist, - und teilt uns dies mit. Überprüft auch, ob alle relevanten Details, Logs und Reproduktionsschritte - enthalten sind bzw. aktualisiert diese. - Vielen Dank für Eure Unterstützung. + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs within the next 7 days. + Please check if the issue is still relevant in the most current version of the adapter + and tell us. Also check that all relevant details, logs and reproduction steps + are included and update them if needed. + Thank you for your contributions. + + Dieses Problem wurde automatisch als veraltet markiert, da es in letzter Zeit keine Aktivitäten gab. + Es wird geschlossen, wenn nicht innerhalb der nächsten 7 Tage weitere Aktivitäten stattfinden. + Bitte überprüft, ob das Problem auch in der aktuellsten Version des Adapters noch relevant ist, + und teilt uns dies mit. Überprüft auch, ob alle relevanten Details, Logs und Reproduktionsschritte + enthalten sind bzw. aktualisiert diese. + Vielen Dank für Eure Unterstützung. # Comment to post when removing the stale label. # unmarkComment: > @@ -50,22 +50,21 @@ markComment: > # Comment to post when closing a stale Issue or Pull Request. closeComment: > - This issue has been automatically closed because of inactivity. Please open a new - issue if still relevant and make sure to include all relevant details, logs and - reproduction steps. - Thank you for your contributions. + This issue has been automatically closed because of inactivity. Please open a new + issue if still relevant and make sure to include all relevant details, logs and + reproduction steps. + Thank you for your contributions. - Dieses Problem wurde aufgrund von Inaktivität automatisch geschlossen. Bitte öffnet ein - neues Issue, falls dies noch relevant ist und stellt sicher das alle relevanten Details, - Logs und Reproduktionsschritte enthalten sind. - Vielen Dank für Eure Unterstützung. + Dieses Problem wurde aufgrund von Inaktivität automatisch geschlossen. Bitte öffnet ein + neues Issue, falls dies noch relevant ist und stellt sicher das alle relevanten Details, + Logs und Reproduktionsschritte enthalten sind. + Vielen Dank für Eure Unterstützung. # Limit the number of actions per hour, from 1-30. Default is 30 limitPerRun: 30 # Limit to only `issues` or `pulls` only: issues - # Optionally, specify configuration settings that are specific to just 'issues' or 'pulls': # pulls: # daysUntilStale: 30 diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index c8db44e1..79148b3b 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -1,41 +1,41 @@ -name: "CodeQL" +name: 'CodeQL' on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - schedule: - - cron: "12 18 * * 0" + push: + branches: ['master'] + pull_request: + branches: ['master'] + schedule: + - cron: '12 18 * * 0' jobs: - analyze: - name: Analyze - runs-on: ubuntu-latest - permissions: - actions: read - contents: read - security-events: write + analyze: + name: Analyze + runs-on: ubuntu-latest + permissions: + actions: read + contents: read + security-events: write - strategy: - fail-fast: false - matrix: - language: [ javascript ] + strategy: + fail-fast: false + matrix: + language: [javascript] - steps: - - name: Checkout - uses: actions/checkout@v4 + steps: + - name: Checkout + uses: actions/checkout@v4 - - name: Initialize CodeQL - uses: github/codeql-action/init@v3 - with: - languages: ${{ matrix.language }} - queries: +security-and-quality + - name: Initialize CodeQL + uses: github/codeql-action/init@v3 + with: + languages: ${{ matrix.language }} + queries: +security-and-quality - - name: Autobuild - uses: github/codeql-action/autobuild@v3 + - name: Autobuild + uses: github/codeql-action/autobuild@v3 - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 - with: - category: "/language:${{ matrix.language }}" + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v3 + with: + category: '/language:${{ matrix.language }}' diff --git a/.github/workflows/dependabot-automerge.yml b/.github/workflows/dependabot-automerge.yml index dfddd2c7..be710360 100644 --- a/.github/workflows/dependabot-automerge.yml +++ b/.github/workflows/dependabot-automerge.yml @@ -4,19 +4,19 @@ name: Auto-Merge Dependabot PRs on: - pull_request_target: + pull_request_target: jobs: - auto-merge: - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + auto-merge: + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 - - name: Check if PR should be auto-merged - uses: ahmadnassri/action-dependabot-auto-merge@v2 - with: - # This must be a personal access token with push access - github-token: ${{ secrets.AUTO_MERGE_TOKEN }} - # By default, squash and merge, so Github chooses nice commit messages - command: squash and merge \ No newline at end of file + - name: Check if PR should be auto-merged + uses: ahmadnassri/action-dependabot-auto-merge@v2 + with: + # This must be a personal access token with push access + github-token: ${{ secrets.AUTO_MERGE_TOKEN }} + # By default, squash and merge, so Github chooses nice commit messages + command: squash and merge diff --git a/.github/workflows/test-and-release.yml b/.github/workflows/test-and-release.yml index e1730230..56f245b1 100644 --- a/.github/workflows/test-and-release.yml +++ b/.github/workflows/test-and-release.yml @@ -6,149 +6,147 @@ name: Test and Release # Run this job on all pushes and pull requests # as well as tags with a semantic version on: - push: - branches: - - '*' - tags: - # normal versions - - "v?[0-9]+.[0-9]+.[0-9]+" - # pre-releases - - "v?[0-9]+.[0-9]+.[0-9]+-**" - pull_request: {} + push: + branches: + - '*' + tags: + # normal versions + - 'v?[0-9]+.[0-9]+.[0-9]+' + # pre-releases + - 'v?[0-9]+.[0-9]+.[0-9]+-**' + pull_request: {} # Cancel previous PR/branch runs when a new commit is pushed concurrency: - group: ${{ github.ref }} - cancel-in-progress: true + group: ${{ github.ref }} + cancel-in-progress: true jobs: - # Performs quick checks before the expensive test runs - check-and-lint: - if: contains(github.event.head_commit.message, '[skip ci]') == false - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js 16.x - uses: actions/setup-node@v4 - with: - node-version: 16.x - - - - name: Install Dependencies - run: npm install - -# - name: Perform a type check -# run: npm run check:ts -# env: -# CI: true - # - name: Lint TypeScript code - # run: npm run lint -# - name: Test package files -# run: npm run test:package - - # Runs adapter tests on all supported node versions and OSes - adapter-tests: - if: contains(github.event.head_commit.message, '[skip ci]') == false - - needs: [check-and-lint] - - runs-on: ${{ matrix.os }} - strategy: - matrix: - node-version: [16.x, 18.x, 20.x] - os: [ubuntu-latest, windows-latest, macos-latest] - - steps: - - uses: actions/checkout@v4 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.node-version }} - - - name: Install Dependencies - run: npm install - - - name: Run local tests - run: npm test -# - name: Run unit tests -# run: npm run test:unit -# - name: Run integration tests # (linux/osx) -# if: startsWith(runner.OS, 'windows') == false -# run: DEBUG=testing:* npm run test:integration -# - name: Run integration tests # (windows) -# if: startsWith(runner.OS, 'windows') -# run: set DEBUG=testing:* & npm run test:integration - - # Deploys the final package to NPM - deploy: - needs: [adapter-tests] - - # Trigger this step only when a commit on master is tagged with a version number - if: | - contains(github.event.head_commit.message, '[skip ci]') == false && - github.event_name == 'push' && - startsWith(github.ref, 'refs/tags/') - runs-on: ubuntu-latest - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Use Node.js 16.x - uses: actions/setup-node@v4 - with: - node-version: 16.x - - - name: Extract the version and commit body from the tag - id: extract_release - # The body may be multiline, therefore, we need to escape some characters - run: | - VERSION="${{ github.ref }}" - VERSION=${VERSION##*/} - VERSION=${VERSION##*v} - echo "::set-output name=VERSION::$VERSION" - BODY=$(git show -s --format=%b) - BODY="${BODY//'%'/'%25'}" - BODY="${BODY//$'\n'/'%0A'}" - BODY="${BODY//$'\r'/'%0D'}" - echo "::set-output name=BODY::$BODY" - - - name: Install Dependencies - run: npm install - -# - name: Create a clean build -# run: npm run build - - name: Publish package to npm - run: | - npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} - npm whoami - npm publish - - - name: Create Github Release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ github.ref }} - release_name: Release v${{ steps.extract_release.outputs.VERSION }} - draft: false - # Prerelease versions create pre-releases on GitHub - prerelease: ${{ contains(steps.extract_release.outputs.VERSION, '-') }} - body: ${{ steps.extract_release.outputs.BODY }} - - - name: Notify Sentry.io about the release - run: | - npm i -g @sentry/cli - export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} - export SENTRY_URL=https://sentry.iobroker.net - export SENTRY_ORG=iobroker - export SENTRY_PROJECT=iobroker-web - export SENTRY_VERSION=iobroker.web@${{ steps.extract_release.outputs.VERSION }} - sentry-cli releases new $SENTRY_VERSION - sentry-cli releases set-commits $SENTRY_VERSION --auto - sentry-cli releases finalize $SENTRY_VERSION - - # Add the following line BEFORE finalize if sourcemap uploads are needed - # sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/ \ No newline at end of file + # Performs quick checks before the expensive test runs + check-and-lint: + if: contains(github.event.head_commit.message, '[skip ci]') == false + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Install Dependencies + run: npm install + + # - name: Perform a type check + # run: npm run check:ts + # env: + # CI: true + # - name: Lint TypeScript code + # run: npm run lint + # - name: Test package files + # run: npm run test:package + + # Runs adapter tests on all supported node versions and OSes + adapter-tests: + if: contains(github.event.head_commit.message, '[skip ci]') == false + + needs: [check-and-lint] + + runs-on: ${{ matrix.os }} + strategy: + matrix: + node-version: [18.x, 20.x, 22.x] + os: [ubuntu-latest, windows-latest, macos-latest] + + steps: + - uses: actions/checkout@v4 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install Dependencies + run: npm install + + - name: Run local tests + run: npm test + # - name: Run unit tests + # run: npm run test:unit + # - name: Run integration tests # (linux/osx) + # if: startsWith(runner.OS, 'windows') == false + # run: DEBUG=testing:* npm run test:integration + # - name: Run integration tests # (windows) + # if: startsWith(runner.OS, 'windows') + # run: set DEBUG=testing:* & npm run test:integration + + # Deploys the final package to NPM + deploy: + needs: [adapter-tests] + + # Trigger this step only when a commit on master is tagged with a version number + if: | + contains(github.event.head_commit.message, '[skip ci]') == false && + github.event_name == 'push' && + startsWith(github.ref, 'refs/tags/') + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Use Node.js 20.x + uses: actions/setup-node@v4 + with: + node-version: 20.x + + - name: Extract the version and commit body from the tag + id: extract_release + # The body may be multiline, therefore, we need to escape some characters + run: | + VERSION="${{ github.ref }}" + VERSION=${VERSION##*/} + VERSION=${VERSION##*v} + echo "::set-output name=VERSION::$VERSION" + BODY=$(git show -s --format=%b) + BODY="${BODY//'%'/'%25'}" + BODY="${BODY//$'\n'/'%0A'}" + BODY="${BODY//$'\r'/'%0D'}" + echo "::set-output name=BODY::$BODY" + + - name: Install Dependencies + run: npm install + + # - name: Create a clean build + # run: npm run build + - name: Publish package to npm + run: | + npm config set //registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }} + npm whoami + npm publish + + - name: Create Github Release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ github.ref }} + release_name: Release v${{ steps.extract_release.outputs.VERSION }} + draft: false + # Prerelease versions create pre-releases on GitHub + prerelease: ${{ contains(steps.extract_release.outputs.VERSION, '-') }} + body: ${{ steps.extract_release.outputs.BODY }} + + - name: Notify Sentry.io about the release + run: | + npm i -g @sentry/cli + export SENTRY_AUTH_TOKEN=${{ secrets.SENTRY_AUTH_TOKEN }} + export SENTRY_URL=https://sentry.iobroker.net + export SENTRY_ORG=iobroker + export SENTRY_PROJECT=iobroker-web + export SENTRY_VERSION=iobroker.web@${{ steps.extract_release.outputs.VERSION }} + sentry-cli releases new $SENTRY_VERSION + sentry-cli releases set-commits $SENTRY_VERSION --auto + sentry-cli releases finalize $SENTRY_VERSION + + # Add the following line BEFORE finalize if sourcemap uploads are needed + # sentry-cli releases files $SENTRY_VERSION upload-sourcemaps build/