Skip to content

Improve logging in backup upload keys loop #15305

Improve logging in backup upload keys loop

Improve logging in backup upload keys loop #15305

Workflow file for this run

name: Tests
on:
pull_request: {}
merge_group:
types: [checks_requested]
push:
branches: [develop, master]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
ENABLE_COVERAGE: ${{ github.event_name != 'merge_group' }}
permissions: {} # No permissions required
jobs:
test:
name: "Vitest [${{ matrix.specs }}] (Node ${{ matrix.node == '*' && 'latest' || matrix.node }})"
runs-on: ubuntu-24.04
timeout-minutes: 10
strategy:
matrix:
specs: [integ, unit]
node: [lts, 22]
steps:
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
persist-credentials: false
- name: 🔨 Setup pnpm & node
uses: pnpm/setup@703c52620218391530e48b9e8870d5c0082e1b9b # v2.1.0
with:
runtime: node@${{ matrix.node }}
cache: true
install: true
- name: Run tests
run: pnpm test --coverage=${ENABLE_COVERAGE} ./spec/${{ matrix.specs }}
env:
SHARD: ${{ matrix.specs }}
- name: Move coverage files into place
if: env.ENABLE_COVERAGE == 'true'
run: mv coverage/lcov.info coverage/${NODE_VERSION}-${{ matrix.specs }}.lcov.info
env:
NODE_VERSION: ${{ matrix.node }}
- name: Upload Artifact
if: env.ENABLE_COVERAGE == 'true'
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7
with:
name: coverage-${{ matrix.specs }}-${{ matrix.node }}
path: |
coverage
!coverage/lcov-report
element-web:
name: Downstream test element-web
if: github.event_name == 'merge_group'
uses: element-hq/element-web/.github/workflows/tests.yml@develop # zizmor: ignore[unpinned-uses]
permissions:
contents: read
pull-requests: read
checks: write
statuses: write
with:
disable_coverage: true
matrix-js-sdk-sha: ${{ github.sha }}
complement-crypto:
name: "Run Complement Crypto tests"
if: github.event_name == 'merge_group'
permissions: read-all # zizmor: ignore[excessive-permissions]
uses: matrix-org/complement-crypto/.github/workflows/single_sdk_tests.yml@main # zizmor: ignore[unpinned-uses]
with:
use_js_sdk: "."
complete:
name: Tests
needs:
- test
- element-web
- complement-crypto
if: always()
runs-on: ubuntu-24.04
permissions:
contents: read
pull-requests: read
checks: write
statuses: write
steps:
- name: Skip SonarCloud in merge queue
if: github.event_name == 'merge_group' || inputs.disable_coverage == 'true'
uses: guibranco/github-status-action-v2@9bfa8773cdbdc6c185747fd43cd7faa9d7c32f09
with:
authToken: ${{ secrets.GITHUB_TOKEN }}
state: success
description: SonarCloud skipped
context: SonarCloud Code Analysis
sha: ${{ github.sha }}
target_url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Checkout code
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
if: needs.test.result == 'success' && env.ENABLE_COVERAGE == 'true'
with:
persist-credentials: false
fetch-depth: 0 # Full history, fastest for diff-cover
- name: Download coverage artifacts
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8
if: needs.test.result == 'success' && env.ENABLE_COVERAGE == 'true'
with:
pattern: coverage-*
path: coverage
- name: Diff Coverage
id: coverage
if: needs.test.result == 'success' && env.ENABLE_COVERAGE == 'true'
uses: Affanmir/diff-cover-action@a35ea05c1c458490473f6fc2233737e809678273 # v2.1.1
with:
compare-branch: origin/${{ github.base_ref || 'develop' }}
mode: coverage
coverage-files: coverage/*/*lcov.info
ignore-whitespace: true
show-uncovered: true
post-comment: false
create-annotations: true
annotation-type: warning
fail-on-threshold: ${{ contains(github.event.pull_request.labels.*.name, 'Z-Skip-Coverage') && 'false' || 'true' }}
fail-under: 80
- name: Check status of tests
if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
run: exit 1