Skip to content

TEST@main

TEST@main #54

Workflow file for this run

name: TEST
run-name: 'TEST@${{github.ref_name}}'
on:
workflow_call:
push:
branches:
- main
paths:
- '*'
- src/**
- '!**.md'
- '!.github/renovate.json5'
concurrency:
group: test-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
test:
name: Test & build
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
node-version: [20.x]
steps:
- uses: mato533/cicd-actions/setup-pnpm@main
with:
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
- name: Type check
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run typecheck
- name: Run the test
working-directory: packages/electron-typed-ipc-bridge
run: pnpm run test
- name: Build
id: build
shell: bash
working-directory: packages/electron-typed-ipc-bridge
run: |
pnpm run build
TAR_INFO="$(pnpm pack --json)"
TAR_NAME="$(jq -r .filename <<<"${TAR_INFO}")"
ls -l "${TAR_NAME}"
RESULT="tar-name=${TAR_NAME}"
echo "${RESULT}" >>"${GITHUB_OUTPUT}"
echo "${RESULT}"
- name: Setup playground
env:
TAR_NAME: ${{ steps.build.outputs.tar-name }}
working-directory: packages/sample-app
shell: bash
run: |
pnpm add "../electron-typed-ipc-bridge/${TAR_NAME}"
- name: Type check
working-directory: packages/sample-app
run: pnpm run typecheck
- name: Build (Windows)
if: runner.os == 'Windows'
working-directory: packages/sample-app
run: pnpm build:win
- name: Test (E2E) on Windows
if: runner.os == 'Windows'
working-directory: packages/sample-app
run: pnpm test:e2e
- name: Build (Linux)
if: runner.os == 'Linux'
working-directory: packages/sample-app
run: pnpm build:linux
- name: Test (E2E) on Linux
if: runner.os == 'Linux'
working-directory: packages/sample-app
run: |
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
export DBUS_SESSION_BUS_ADDRESS="unix:path=${XDG_RUNTIME_DIR}/bus"
dbus-daemon --session --address=${DBUS_SESSION_BUS_ADDRESS} --nofork --nopidfile --syslog-only &
xvfb-run -a pnpm test:e2e
coverage:
name: Report Coverage
runs-on: ubuntu-latest
if: ${{ success() || failure() }}
needs:
- test
permissions:
contents: read
pull-requests: write
steps:
- name: Setup node environments
uses: mato533/cicd-actions/setup-pnpm@main
with:
cache: 'pnpm'
- name: Run tests with coverage
id: test
env:
TEST_RESULT: 'coverage/junit.xml'
working-directory: packages/electron-typed-ipc-bridge
run: |
pnpm exec vitest run --coverage \
--coverage.reportOnFailure \
--coverage.reporter=json-summary \
--coverage.reporter=json \
--coverage.reporter=clover \
--reporter=default \
--reporter=junit \
--outputFile="coverage/junit.xml"
- name: Upload coverage report to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: packages/electron-typed-ipc-bridge/coverage/coverage-final.json
verbose: true
- name: Upload test results to Codecov
uses: codecov/test-results-action@v1
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: packages/electron-typed-ipc-bridge/coverage/junit.xml
verbose: true
- name: Upload coverage report to the code climate
uses: paambaati/codeclimate-action@v9
if: ${{ github.event_name == 'push' }}
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: packages/electron-typed-ipc-bridge/coverage/clover.xml:clover
- name: Write coverage report to pull request
if: ${{ github.event_name == 'pull_request' }}
uses: davelosert/vitest-coverage-report-action@v2
with:
working-directory: packages/electron-typed-ipc-bridge/