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/**' - 'src-tauri/**' - 'web-app/**' - '!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 20.x uses: actions/setup-node@v3 with: node-version: 20 - name: Install dependencies run: | make config-yarn yarn yarn build:core - 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: macos-latest 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: Set IS_TEST environment variable run: | echo "IS_TEST=true" >> $GITHUB_ENV - name: 'Cleanup cache' continue-on-error: true run: | rm -rf ~/jan make clean - name: Get Commit Message for PR if: github.event_name == 'pull_request' run: | echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}})" >> $GITHUB_ENV - name: Get Commit Message for push event if: github.event_name == 'push' run: | echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}})" >> $GITHUB_ENV # - name: 'Config report portal' # run: | # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App macos" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}" - 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: macos-latest 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: 'Cleanup cache' continue-on-error: true run: | rm -rf ~/jan make clean - 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 - name: Install tauri-driver dependencies run: | cargo install tauri-driver --locked # 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: Get Commit Message for push event if: github.event_name == 'push' shell: bash run: | echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV # - name: 'Config report portal' # shell: bash # run: | # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows ${{ matrix.antivirus-tools }}" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}" - name: Linter and test shell: powershell run: | 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 == 'workflow_dispatch' runs-on: windows-latest steps: - name: Getting the repo uses: actions/checkout@v3 with: fetch-depth: 0 - uses: actions/cache@v4 # v4 with: path: | ~/.cargo/bin/ ~/.cargo/registry/index/ ~/.cargo/registry/cache/ ~/.cargo/git/db/ target/ key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}-${{ hashFiles('**/yarn.lock') }} - name: Installing node uses: actions/setup-node@v3 with: node-version: 20 - name: Install tauri-driver dependencies run: | cargo install tauri-driver --locked # 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: Get Commit Message for PR if: github.event_name == 'pull_request' shell: bash run: | echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV # - name: 'Config report portal' # shell: bash # run: | # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Windows" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}" - name: Install Prerequisites shell: 'powershell' # https://github.com/actions/runner-images/issues/9538 # https://github.com/microsoft/playwright/pull/30009/files # https://github.com/tauri-apps/wry/issues/1268 # Evergreen Bootstrapper # The Bootstrapper is a tiny installer that downloads # the Evergreen Runtime matching device architecture # and installs it locally. # https://developer.microsoft.com/en-us/microsoft-edge/webview2/consumer/?form=MA13LH run: | Invoke-WebRequest -Uri 'https://go.microsoft.com/fwlink/p/?LinkId=2124703' -OutFile 'setup.exe' Start-Process -FilePath setup.exe -Verb RunAs -Wait - 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: Install tauri-driver dependencies run: | cargo install tauri-driver --locked # 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: | 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: Install Tauri dependencies run: | sudo apt update sudo apt install -y libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev libfuse2 webkit2gtk-driver - name: Install tauri-driver dependencies run: | cargo install tauri-driver --locked - name: 'Cleanup cache' continue-on-error: true run: | rm -rf ~/jan make clean - name: Get Commit Message for PR if: github.event_name == 'pull_request' run: | echo "REPORT_PORTAL_DESCRIPTION=${{github.event.after}}" >> $GITHUB_ENV - name: Get Commit Message for push event if: github.event_name == 'push' run: | echo "REPORT_PORTAL_DESCRIPTION=${{github.sha}}" >> $GITHUB_ENV # - name: 'Config report portal' # shell: bash # run: | # make update-playwright-config REPORT_PORTAL_URL=${{ secrets.REPORT_PORTAL_URL }} REPORT_PORTAL_API_KEY=${{ secrets.REPORT_PORTAL_API_KEY }} REPORT_PORTAL_PROJECT_NAME=${{ secrets.REPORT_PORTAL_PROJECT_NAME }} REPORT_PORTAL_LAUNCH_NAME="Jan App Linux" REPORT_PORTAL_DESCRIPTION="${{env.REPORT_PORTAL_DESCRIPTION}}" - name: Linter and test run: | export DISPLAY=$(w -h | awk 'NR==1 {print $2}') echo -e "Display ID: $DISPLAY" make test - uses: actions/upload-artifact@v4 if: always() with: name: playwright-report path: electron/playwright-report/ retention-days: 2 # coverage-check: # runs-on: ubuntu-latest # needs: base_branch_cov # continue-on-error: true # 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: Install yarn # run: npm install -g yarn # - name: 'Cleanup cache' # continue-on-error: true # run: | # rm -rf ~/jan # make clean # - name: Download code coverage report from base branch # uses: actions/download-artifact@v4 # with: # name: ref-lcov.info # - name: Linter and test coverage # run: | # export DISPLAY=$(w -h | awk 'NR==1 {print $2}') # echo -e "Display ID: $DISPLAY" # 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: Install Tauri dependencies run: | sudo apt update sudo apt install -y libglib2.0-dev libatk1.0-dev libpango1.0-dev libgtk-3-dev libsoup-3.0-dev libwebkit2gtk-4.1-dev librsvg2-dev libfuse2 webkit2gtk-driver - name: Install tauri-driver dependencies run: | cargo install tauri-driver --locked - name: 'Cleanup cache' continue-on-error: true run: | rm -rf ~/jan make clean - name: Linter and test run: | export DISPLAY=$(w -h | awk 'NR==1 {print $2}') echo -e "Display ID: $DISPLAY" make test