mirror of
https://github.com/gavvvr/obsidian-timecodes-plugin.git
synced 2026-07-22 12:00:24 +00:00
122 lines
3.8 KiB
YAML
122 lines
3.8 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- '**'
|
|
pull_request:
|
|
types: [opened, synchronize, reopened]
|
|
|
|
jobs:
|
|
Build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
WDIO_ALLURE_REPORTER: true
|
|
container:
|
|
image: ghcr.io/${{ github.repository }}/ci-runner:node-22-trixie-slim
|
|
outputs:
|
|
e2e_tests_outcome: ${{ steps.execute_e2e_tests.outcome }}
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 1
|
|
- name: Install pnpm
|
|
uses: pnpm/action-setup@v4
|
|
- name: Environment details
|
|
run: pnpm version
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Build
|
|
run: pnpm run build
|
|
- name: Test
|
|
run: pnpm run test:unit
|
|
- name: E2E tests
|
|
id: execute_e2e_tests
|
|
run: pnpm install && xvfb-run pnpm run test
|
|
continue-on-error: true
|
|
working-directory: e2e
|
|
- name: Upload Allure results
|
|
if: steps.execute_e2e_tests.outcome != 'skipped'
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: allure-results
|
|
path: e2e/out/allure-results/
|
|
|
|
- name: Upload unit-test coverage data
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: lcov-unit.info
|
|
path: out/coverage/lcov.info
|
|
- name: Upload E2E-test coverage data
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: lcov-e2e.info
|
|
path: e2e/out/coverage/lcov.info
|
|
|
|
- name: Failed E2E tests detected!
|
|
if: steps.execute_e2e_tests.outcome == 'failure'
|
|
run: exit 1
|
|
|
|
Publish-Allure-Report:
|
|
runs-on: ubuntu-latest
|
|
needs: Build
|
|
if: always() && needs.Build.outputs.e2e_tests_outcome != 'skipped'
|
|
env:
|
|
E2E_GH_PAGES_SUBFOLDER: e2e-tests-reports
|
|
steps:
|
|
- name: Download Allure results
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: allure-results
|
|
path: e2e/out/allure-results/
|
|
- name: Load test report history
|
|
uses: actions/checkout@v5
|
|
continue-on-error: true
|
|
with:
|
|
ref: gh-pages
|
|
path: gh-pages
|
|
- name: Build test report
|
|
uses: simple-elf/allure-report-action@v1.13
|
|
with:
|
|
allure_results: e2e/out/allure-results
|
|
subfolder: ${{ env.E2E_GH_PAGES_SUBFOLDER }}
|
|
gh_pages: gh-pages
|
|
allure_report: allure-report
|
|
allure_history: allure-history
|
|
- name: Publish test report
|
|
uses: peaceiris/actions-gh-pages@v4
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
publish_branch: gh-pages
|
|
publish_dir: allure-history
|
|
- name: Publish tests results link
|
|
uses: guibranco/github-status-action-v2@latest
|
|
with:
|
|
authToken: ${{secrets.GITHUB_TOKEN}}
|
|
context: 'E2E tests report'
|
|
description: ''
|
|
state: ${{ needs.Build.outputs.e2e_tests_outcome }}
|
|
sha: ${{ github.event.pull_request.head.sha || github.sha }}
|
|
target_url: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.E2E_GH_PAGES_SUBFOLDER }}/${{ github.run_number }}
|
|
|
|
SonarScan:
|
|
needs: Build
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
|
|
- name: Download unit-tests coverage data
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
name: lcov-unit.info
|
|
path: coverage/unit/
|
|
- name: Download E2E-tests coverage data
|
|
uses: actions/download-artifact@v5
|
|
with:
|
|
name: lcov-e2e.info
|
|
path: coverage/e2e/
|
|
- name: SonarQube Scan
|
|
uses: SonarSource/sonarqube-scan-action@v6
|
|
env:
|
|
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|