Skip to content

Also no macos in automalic release workflow for now (#489) #717

Also no macos in automalic release workflow for now (#489)

Also no macos in automalic release workflow for now (#489) #717

# This workflow executed the chip tool tests against matter.js
name: Chip Tool tests
on:
schedule:
- cron: 0 2 * * * # Every day at 02:00
workflow_dispatch: # Manually on demand
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
merge_group:
# Cancel previous PR/branch runs when a new commit is pushed
concurrency:
group: ${{ github.ref }}-chip-tool-tests
cancel-in-progress: true
jobs:
head-commit-message:
name: get head commit message
runs-on: ubuntu-latest
outputs:
head-commit-message: ${{ steps.get_head_commit_message.outputs.headCommitMsg }}
steps:
- name: Get repo
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Print head git commit message
id: get_head_commit_message
run: echo "headCommitMsg=$(git show -s --format=%s)" >> $GITHUB_OUTPUT
# Find out what is needed to be done by this test workflow
chip-tests-needed:
needs: [head-commit-message]
if: github.repository == 'project-chip/matter.js'
runs-on: ubuntu-latest
outputs:
chip-changes: ${{ steps.changes.outputs.src }}
chip-tests-required: ${{ steps.check-trigger.outputs.chip-tests-required || steps.check-rebuild.outputs.chip-tests-required || steps.check-long-tests.outputs.chip-tests-required }}
chip-tool-rebuild: ${{ steps.check-rebuild.outputs.chip-tool-rebuild }}
chip-long-tests-required: ${{ steps.check-long-tests.outputs.chip-long-tests-required }}
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
src:
- "chip-testing/**"
- "packages/matter.js/src/**"
- "packages/matter-node.js/src/**"
- ".github/workflows/chip-tool-tests.yml"
- "package.json"
- "packages/**/package.json"
- uses: dorny/paths-filter@v2
id: changes-long-tests
with:
filters: |
src:
- "chip-testing/src/suites-long/**"
- if: ${{ github.event_name == 'schedule' || ((github.event_name == 'push' || github.event_name == 'pull_request') && steps.changes.outputs.src == 'true') || github.event_name == 'workflow_dispatch' || contains(needs.head-commit-message.outputs.head-commit-message, '[execute-chiptests]') == true }}
name: Chip Tool tests required to run?
id: check-trigger
run: echo "chip-tests-required=true" >> $GITHUB_OUTPUT
- if: ${{ contains(github.event.head_commit.message, '[rebuild-chip]') == true }}
name: Chip Tool rebuild required?
id: check-rebuild
run: |
echo "chip-tests-required=true" >> $GITHUB_OUTPUT
echo "chip-tool-rebuild=true" >> $GITHUB_OUTPUT
- name: Get Day of the week
run: echo "DOW=$(date +%u)" >> $GITHUB_ENV
- if: ${{ (env.DOW == 6 && github.event_name == 'schedule') || (github.event_name != 'schedule' && (steps.changes-long-tests.outputs.src == 'true' || contains(needs.head-commit-message.outputs.head-commit-message, '[execute-chiptests-long]') == true)) }}
name: Enable Long tests if needed
id: check-long-tests
run: |
echo "chip-tests-required=true" >> $GITHUB_OUTPUT
echo "chip-long-tests-required=true" >> $GITHUB_OUTPUT
# If we need to do anything make sure that chip binaries are build and environment can be set up
prepare-chip-build:
needs: [chip-tests-needed]
if: ${{ github.repository == 'project-chip/matter.js' && (needs.chip-tests-needed.outputs.chip-tool-rebuild == 'true' || needs.chip-tests-needed.outputs.chip-tests-required == 'true' || needs.chip-tests-needed.outputs.chip-changes == 'true' || needs.chip-tests-needed.outputs.chip-long-tests-required == 'true') }}
runs-on: ubuntu-latest
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- name: Prepare chip tests and rebuild chip-tool if needed
uses: ./.github/actions/prepare-chip-testing
with:
rebuild-chip-tool: ${{ needs.chip-tests-needed.outputs.chip-tool-rebuild }}
build-matter-js: "false"
# Execute the normal tests
chip-tests:
needs: [prepare-chip-build]
if: ${{ github.repository == 'project-chip/matter.js' && (needs.chip-tests-needed.outputs.chip-tool-rebuild == 'true' || needs.chip-tests-needed.outputs.chip-tests-required == 'true' || needs.chip-tests-needed.outputs.chip-changes == 'true' || needs.chip-tests-needed.outputs.chip-long-tests-required == 'true') }}
runs-on: ubuntu-latest
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- name: Initialize chip tests
uses: ./.github/actions/prepare-chip-testing
with:
rebuild-chip-tool: "false"
- name: Test execution
id: test-execution
shell: bash
run: |
cd chip-testing
npm run test-chip -- --all-logs
# Execute the long running tests (if needed)
chip-tests-long:
needs: [prepare-chip-build]
if: ${{ github.repository == 'project-chip/matter.js' && needs.chip-tests-needed.outputs.chip-long-tests-required == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Check out matter.js
uses: actions/checkout@v4
- name: Initialize chip tests
uses: ./.github/actions/prepare-chip-testing
with:
rebuild-chip-tool: 'false'
- name: Long Test execution
id: test-execution-long
shell: bash
run: |
cd chip-testing
LONG_TESTS_ONLY=1 npm run test-chip