From e9721410e9df54586845e70465652629c587596d Mon Sep 17 00:00:00 2001 From: hiento09 <136591877+hiento09@users.noreply.github.com> Date: Wed, 23 Oct 2024 11:04:06 +0700 Subject: [PATCH] Revert "ci: migrate to github hosted runner (#3838)" This reverts commit 3df98b87a3e436fc16c9b3fc3746b4b629be1d9a. --- .../jan-electron-linter-and-test.yml | 171 ++++++++++++++++-- electron/package.json | 5 +- 2 files changed, 156 insertions(+), 20 deletions(-) diff --git a/.github/workflows/jan-electron-linter-and-test.yml b/.github/workflows/jan-electron-linter-and-test.yml index 93d015ea8f..4e20d6c5f8 100644 --- a/.github/workflows/jan-electron-linter-and-test.yml +++ b/.github/workflows/jan-electron-linter-and-test.yml @@ -66,11 +66,7 @@ jobs: 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'] + runs-on: [self-hosted, macOS, macos-desktop] steps: - name: Getting the repo uses: actions/checkout@v3 @@ -82,19 +78,40 @@ jobs: with: node-version: 20 + - 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: | + npm config set registry ${{ secrets.NPM_PROXY }} --global + yarn config set registry ${{ secrets.NPM_PROXY }} --global make test env: CSC_IDENTITY_AUTO_DISCOVERY: 'false' + # TURBO_API: '${{ secrets.TURBO_API }}' + # TURBO_TEAM: 'macos' + # TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}' 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'] + runs-on: [self-hosted, macOS, macos-desktop] steps: - name: Getting the repo uses: actions/checkout@v3 @@ -106,8 +123,16 @@ jobs: with: node-version: 20 + - name: 'Cleanup cache' + continue-on-error: true + run: | + rm -rf ~/jan + make clean + - name: Linter and test run: | + npm config set registry https://registry.npmjs.org --global + yarn config set registry https://registry.npmjs.org --global make test env: CSC_IDENTITY_AUTO_DISCOVERY: 'false' @@ -143,16 +168,30 @@ jobs: } 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: | npm config set registry ${{ secrets.NPM_PROXY }} --global yarn config set registry ${{ secrets.NPM_PROXY }} --global make test - + # env: + # TURBO_API: '${{ secrets.TURBO_API }}' + # TURBO_TEAM: 'windows' + # TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}' 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 + if: (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) + runs-on: windows-desktop-default-windows-security steps: - name: Getting the repo uses: actions/checkout@v3 @@ -164,14 +203,44 @@ jobs: 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: 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: Linter and test shell: powershell run: | + npm config set registry ${{ secrets.NPM_PROXY }} --global + yarn config set registry ${{ secrets.NPM_PROXY }} --global make test + # env: + # TURBO_API: '${{ secrets.TURBO_API }}' + # TURBO_TEAM: 'windows' + # TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}' 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 + runs-on: windows-desktop-default-windows-security steps: - name: Getting the repo uses: actions/checkout@v3 @@ -183,13 +252,28 @@ jobs: 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 https://registry.npmjs.org --global + yarn config set registry https://registry.npmjs.org --global make test test-on-ubuntu: - runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, ubuntu-desktop] 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 @@ -202,12 +286,41 @@ jobs: with: node-version: 20 + - 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" + npm config set registry ${{ secrets.NPM_PROXY }} --global + yarn config set registry ${{ secrets.NPM_PROXY }} --global make test + # env: + # TURBO_API: '${{ secrets.TURBO_API }}' + # TURBO_TEAM: 'linux' + # TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}' coverage-check: - runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, ubuntu-desktop] 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: @@ -221,6 +334,12 @@ jobs: with: node-version: 20 + - 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: @@ -228,9 +347,17 @@ jobs: - name: Linter and test coverage run: | + export DISPLAY=$(w -h | awk 'NR==1 {print $2}') + echo -e "Display ID: $DISPLAY" + npm config set registry ${{ secrets.NPM_PROXY }} --global + yarn config set registry ${{ secrets.NPM_PROXY }} --global make lint yarn build:test yarn test:coverage + # env: + # TURBO_API: '${{ secrets.TURBO_API }}' + # TURBO_TEAM: 'linux' + # TURBO_TOKEN: '${{ secrets.TURBO_TOKEN }}' - name: Generate Code Coverage report id: code-coverage @@ -243,7 +370,7 @@ jobs: show-annotations: 'warning' test-on-ubuntu-pr-target: - runs-on: ubuntu-latest + runs-on: [self-hosted, Linux, ubuntu-desktop] if: github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name != github.repository steps: - name: Getting the repo @@ -256,6 +383,16 @@ jobs: with: node-version: 20 + - 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" + npm config set registry https://registry.npmjs.org --global + yarn config set registry https://registry.npmjs.org --global make test diff --git a/electron/package.json b/electron/package.json index ffec404270..feaee5e16d 100644 --- a/electron/package.json +++ b/electron/package.json @@ -77,7 +77,7 @@ }, "scripts": { "lint": "eslint . --ext \".js,.jsx,.ts,.tsx\"", - "test:e2e": "xvfb-maybe -- playwright test --workers=1", + "test:e2e": "playwright test --workers=1", "copy:assets": "rimraf --glob \"./pre-install/*.tgz\" && cpx \"../pre-install/*.tgz\" \"./pre-install\"", "dev": "yarn copy:assets && tsc -p . && electron .", "compile": "tsc -p .", @@ -128,8 +128,7 @@ "rimraf": "^5.0.5", "run-script-os": "^1.1.6", "typescript": "^5.3.3", - "@reportportal/agent-js-playwright": "^5.1.7", - "xvfb-maybe": "^0.2.1" + "@reportportal/agent-js-playwright": "^5.1.7" }, "installConfig": { "hoistingLimits": "workspaces"