Skip failure on task to install XCTestHTMLReport and only publish result to artifact when the task succeeded #8490
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
name: Microsoft Teams Library JS CI | |
# Controls when the workflow will run | |
on: | |
# Triggers the workflow on push or pull request events against main | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4.1.1 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4.0.2 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- uses: pnpm/action-setup@v3 | |
name: Install pnpm | |
id: pnpm-install | |
with: | |
version: 9.0.6 | |
run_install: false | |
- name: Get pnpm store directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build TeamsJS | |
run: pnpm build | |
- name: Run Unit Tests | |
run: pnpm test | |
- name: Check for lint errors | |
run: pnpm lint | |
- name: Upload Unit Test Results | |
if: always() | |
uses: actions/upload-artifact@v4.3.1 | |
with: | |
name: Unit Test Results (Jest ${{ matrix.node-version }}) | |
path: packages/*/test-results/unit/unit-tests-report.xml | |
publish-test-results: | |
name: 'Publish Unit Tests Results' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
checks: write | |
pull-requests: write | |
if: always() | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4.1.2 | |
with: | |
path: artifacts | |
- name: Publish Unit Test Results | |
uses: EnricoMi/publish-unit-test-result-action@v2 | |
with: | |
files: artifacts/**/*.xml | |
comment_mode: off |