Skip to content

Commit

Permalink
ci(github): connect tests for T3T1
Browse files Browse the repository at this point in the history
  • Loading branch information
karliatto committed Apr 19, 2024
1 parent a8ac4b9 commit e2659e8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/connect-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ jobs:
test-pattern: ${{ matrix.pattern }}
methods: ${{ matrix.methods }}
tests-firmware: ${{ matrix.firmware }}
test-description: ${{ matrix.name }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set-matrix.outputs.dailyMatrix) }}
Expand All @@ -107,22 +108,24 @@ jobs:
test-pattern: ${{ matrix.pattern }}
methods: ${{ matrix.methods }}
tests-firmware: ${{ matrix.firmware }}
test-description: ${{ matrix.name }}-${{ matrix.firmware }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set-matrix.outputs.legacyCanaryFirmwareMatrix) }}

connect-other-devices:
needs: [build, set-matrix]
if: github.event_name == 'schedule' && github.repository == 'trezor/trezor-suite'
name: other-devices-${{ matrix.name }}
name: other-devices-${{ matrix.name }}-${{ matrix.model }}
uses: ./.github/workflows/template-connect-test-params.yml
with:
test-pattern: ${{ matrix.pattern }}
methods: ${{ matrix.methods }}
tests-firmware: ${{ matrix.firmware }}
test-firmware-model: "R"
test-firmware-model: ${{ matrix.model }}
node-environment: ${{ matrix.node-environment }}
web-environment: ${{ matrix.web-environment }}
test-description: ${{ matrix.name }}-${{ matrix.firmware }}-${{ matrix.model }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.set-matrix.outputs.otherDevicesMatrix) }}
9 changes: 7 additions & 2 deletions .github/workflows/template-connect-test-params.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,15 @@ on:
type: "boolean"
required: false
default: true
test-description:
description: "A description to make test title more descriptive (example: 2-latest-R)"
type: "string"
required: false
default: ""

jobs:
node:
name: node
name: "node-${{ inputs.test-description }}"
runs-on: ubuntu-latest
if: ${{ inputs.node-environment }}
steps:
Expand All @@ -51,7 +56,7 @@ jobs:
- run: './docker/docker-connect-test.sh node -p "${{ inputs.test-pattern }}" -f "${{ inputs.tests-firmware }}" -i ${{ inputs.methods }} -m ${{ inputs.test-firmware-model}}'

web:
name: web
name: "web-${{ inputs.test-description }}"
runs-on: ubuntu-latest
if: ${{ inputs.web-environment }}
steps:
Expand Down
11 changes: 9 additions & 2 deletions ci/scripts/connect-test-matrix-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const legacyCanaryFirmware = {

const otherDevices = {
firmwares: ['2-latest'],
models: ['R', 'T3T1'],
tests: [
{
name: 'api',
Expand Down Expand Up @@ -147,8 +148,14 @@ const otherDevices = {
],
};

const prepareTest = ({ firmwares, tests }) => {
return tests.flatMap(test => firmwares.map(firmware => ({ firmware, ...test })));
const prepareTest = ({ firmwares, tests, models }) => {
const withFirmwares = tests.flatMap(test => firmwares.map(firmware => ({ firmware, ...test })));

if (models && models.length > 0) {
return withFirmwares.flatMap(test => models.map(model => ({ model, ...test })));
} else {
return withFirmwares;
}
};

const testData = {
Expand Down

0 comments on commit e2659e8

Please sign in to comment.