diff --git a/.github/workflows/main.yaml b/.github/workflows/main.yaml index 76a65820b..9ed946ee2 100644 --- a/.github/workflows/main.yaml +++ b/.github/workflows/main.yaml @@ -2,7 +2,7 @@ name: Main CI on: push: - branches: [ main ] + branches: [ main, utils ] pull_request: branches: [ main ] workflow_dispatch: @@ -12,6 +12,36 @@ concurrency: cancel-in-progress: true jobs: + init: + if: always() + runs-on: ubuntu-latest + name: utils fork check + env: + USER: "${{ github.repository_owner }}" + BRANCH: "${{ github.ref_name }}" + TOKEN: "${{ secrets.GITHUB_TOKEN }}" + outputs: + branchExists: ${{ steps.checkBranch.outputs.exists }} + + steps: + - name: Check for branch in vscode-uitests-tooling + id: checkBranch + run: | + REPO_URL="https://api.github.com/repos/$USER/vscode-uitests-tooling/branches" + RESPONSE=$(curl -s -H "Authorization: Bearer $TOKEN" "$REPO_URL") + + if ([ $? -ne 0 ]); then + echo "exists=false" >> $GITHUB_OUTPUT + fi + + BRANCH_EXISTS=$(echo "$RESPONSE" | jq -r '.[] | select(.name=="'"$BRANCH"'") | .name') + + if [ "$BRANCH_EXISTS" == "$BRANCH" ]; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + main: strategy: matrix: @@ -24,13 +54,29 @@ jobs: CODE_VERSION: ${{ matrix.version }} CODE_TYPE: ${{ matrix.type }} TEST_RESOURCES: test-resources + USER: "${{ github.repository_owner }}" + BRANCH: "${{ github.ref_name }}" + TOKEN: "${{ secrets.GITHUB_TOKEN }}" + BRANCH_EXISTS: "${{needs.init.outputs.branchExists}}" runs-on: ${{ matrix.os }} + needs: [ init ] steps: + # - name: kill pipeline + # run: | + # echo ${{needs.init.outputs.branchExists}} + # KILLER = "${{github.event.pull_request.user.login}}? + # echo $KILLER + - name: Checkout Repository uses: actions/checkout@v4 with: fetch-depth: 0 + + - name: Clone utils repo + if: env.BRANCH_EXISTS == 'true' + run: | + git clone -b ${{ env.BRANCH }} https://github.com/${{ env.USER }}/vscode-uitests-tooling.git ../vscode-uitests-tooling - name: Set up JDK 17 uses: actions/setup-java@v4 @@ -80,6 +126,12 @@ jobs: if: matrix.os != 'ubuntu-latest' run: npm test + - name: Link utils to vscode + if: env.BRANCH_EXISTS == 'true' + run: | + npm run dev --prefix ../vscode-uitests-tooling + npm link ../vscode-uitests-tooling + - name: ui test (ubuntu) id: uiTest_Ubuntu if: matrix.os == 'ubuntu-latest' diff --git a/src/ui-test/tests/01_lsp.extension.test.ts b/src/ui-test/tests/01_lsp.extension.test.ts index 72335d13a..bad63e70b 100644 --- a/src/ui-test/tests/01_lsp.extension.test.ts +++ b/src/ui-test/tests/01_lsp.extension.test.ts @@ -37,7 +37,8 @@ import { until, VSBrowser, ViewControl, - WebDriver + WebDriver, + DefaultWait } from 'vscode-uitests-tooling'; import * as pjson from '../../../package.json'; @@ -74,6 +75,7 @@ describe('Language Support for Apache Camel extension', function () { }); it('Find extension', async function () { + await DefaultWait.sleep(1000); await driver.wait(async function () { item = await (await extensionsView.getContent().getSection('Installed') as ExtensionsViewSection).findItem(`@installed ${pjson.displayName}`); return item !== undefined; diff --git a/src/ui-test/uitest_runner.ts b/src/ui-test/uitest_runner.ts index 11317c8d7..55c16eca7 100644 --- a/src/ui-test/uitest_runner.ts +++ b/src/ui-test/uitest_runner.ts @@ -32,7 +32,7 @@ async function main(): Promise { await tester.setupAndRunTests( [ 'out/src/ui-test/tests/env/set.camel.version.js', - 'out/src/ui-test/tests/*.test.js', + 'out/src/ui-test/tests/01_lsp.extension.test.js', 'out/src/ui-test/tests/env/check.camel.version.js' ], process.env.CODE_VERSION,