262 lines
6.7 KiB
YAML
262 lines
6.7 KiB
YAML
name: Test - Linter & Playwright
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
- dev
|
|
paths:
|
|
- 'electron/**'
|
|
- .github/workflows/jan-electron-linter-and-test.yml
|
|
- 'web/**'
|
|
- 'joi/**'
|
|
- 'package.json'
|
|
- 'node_modules/**'
|
|
- 'yarn.lock'
|
|
- 'core/**'
|
|
- 'extensions/**'
|
|
- '!README.md'
|
|
- 'Makefile'
|
|
|
|
pull_request:
|
|
branches:
|
|
- main
|
|
- dev
|
|
- release/**
|
|
paths:
|
|
- 'electron/**'
|
|
- .github/workflows/jan-electron-linter-and-test.yml
|
|
- 'web/**'
|
|
- 'joi/**'
|
|
- 'package.json'
|
|
- 'node_modules/**'
|
|
- 'yarn.lock'
|
|
- 'Makefile'
|
|
- 'extensions/**'
|
|
- 'core/**'
|
|
- '!README.md'
|
|
|
|
jobs:
|
|
base_branch_cov:
|
|
runs-on: ubuntu-latest
|
|
continue-on-error: true
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.base_ref }}
|
|
- name: Use Node.js v20.9.0
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: v20.9.0
|
|
|
|
- name: Install dependencies
|
|
run: |
|
|
yarn
|
|
yarn build:core
|
|
yarn build:joi
|
|
|
|
- name: Run test coverage
|
|
run: yarn test:coverage
|
|
|
|
- name: Upload code coverage for ref branch
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: ref-lcov.info
|
|
path: ./coverage/lcov.info
|
|
|
|
test-on-macos:
|
|
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
runs-on: ${{ matrix.runs-on }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runs-on: ['macos-latest', 'macos-13']
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Linter and test
|
|
run: |
|
|
make test
|
|
env:
|
|
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
|
|
|
|
test-on-macos-pr-target:
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
|
|
runs-on: ${{ matrix.runs-on }}
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
runs-on: ['macos-latest', 'macos-13']
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Linter and test
|
|
run: |
|
|
make test
|
|
env:
|
|
CSC_IDENTITY_AUTO_DISCOVERY: 'false'
|
|
|
|
test-on-windows:
|
|
if: github.event_name == 'push'
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
antivirus-tools: ['mcafee', 'default-windows-security', 'bit-defender']
|
|
runs-on: windows-desktop-${{ matrix.antivirus-tools }}
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
# Clean cache, continue on error
|
|
- name: 'Cleanup cache'
|
|
shell: powershell
|
|
continue-on-error: true
|
|
run: |
|
|
$path = "$Env:APPDATA\jan"
|
|
if (Test-Path $path) {
|
|
Remove-Item "\\?\$path" -Recurse -Force
|
|
} else {
|
|
Write-Output "Folder does not exist."
|
|
}
|
|
make clean
|
|
|
|
- name: Linter and test
|
|
shell: powershell
|
|
run: |
|
|
npm config set registry ${{ secrets.NPM_PROXY }} --global
|
|
yarn config set registry ${{ secrets.NPM_PROXY }} --global
|
|
make test
|
|
|
|
test-on-windows-pr:
|
|
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Linter and test
|
|
shell: powershell
|
|
run: |
|
|
make test
|
|
|
|
test-on-windows-pr-target:
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Linter and test
|
|
shell: powershell
|
|
run: |
|
|
make test
|
|
|
|
test-on-ubuntu:
|
|
runs-on: ubuntu-latest
|
|
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Linter and test
|
|
run: |
|
|
make test
|
|
|
|
coverage-check:
|
|
runs-on: ubuntu-latest
|
|
needs: base_branch_cov
|
|
if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) || github.event_name == 'push' || github.event_name == 'workflow_dispatch'
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Download code coverage report from base branch
|
|
uses: actions/download-artifact@v4
|
|
with:
|
|
name: ref-lcov.info
|
|
|
|
- name: Linter and test coverage
|
|
run: |
|
|
make lint
|
|
yarn build:test
|
|
yarn test:coverage
|
|
|
|
- name: Generate Code Coverage report
|
|
id: code-coverage
|
|
uses: barecheck/code-coverage-action@v1
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
lcov-file: './coverage/lcov.info'
|
|
base-lcov-file: './lcov.info'
|
|
send-summary-comment: true
|
|
show-annotations: 'warning'
|
|
|
|
test-on-ubuntu-pr-target:
|
|
runs-on: ubuntu-latest
|
|
if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository
|
|
steps:
|
|
- name: Getting the repo
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Installing node
|
|
uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 20
|
|
|
|
- name: Linter and test
|
|
run: |
|
|
make test
|