Skip to content

Commit

Permalink
Allow to link utils package during Main build of Camel tooling projects
Browse files Browse the repository at this point in the history
  • Loading branch information
pospisilf committed Feb 21, 2024
1 parent f6e0949 commit 4e929bc
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 2 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,51 @@ concurrency:
cancel-in-progress: true

jobs:
init:
if: always()
runs-on: ubuntu-latest
name: Utils fork check
env:
USER: "${{ github.actor }}"
BRANCH: "${{ github.head_ref }}"
TOKEN: "${{ secrets.GITHUB_TOKEN }}"
outputs:
branch_exists: ${{ steps.checkBranch.outputs.exists }}

steps:
- name: Print GitHub Variables
run: |
echo "GitHub Repository: $GITHUB_REPOSITORY"
echo "GitHub Actor: $GITHUB_ACTOR"
echo "GitHub SHA: $GITHUB_SHA"
echo "GitHub Ref: $GITHUB_REF"
echo "GitHub Head Ref: $GITHUB_HEAD_REF"
echo "GitHub Base Ref: $GITHUB_BASE_REF"
echo "GitHub Run ID: $GITHUB_RUN_ID"
echo "GitHub Run Number: $GITHUB_RUN_NUMBER"
echo "GitHub Event Name: $GITHUB_EVENT_NAME"
echo "GitHub Event Path: $GITHUB_EVENT_PATH"
echo "USER: $USER"
echo "BRANCH: $BRANCH"
- 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:
Expand All @@ -24,13 +69,21 @@ jobs:
CODE_VERSION: ${{ matrix.version }}
CODE_TYPE: ${{ matrix.type }}
TEST_RESOURCES: test-resources
USER: "${{ github.actor }}"
BRANCH: "${{ github.head_ref }}"

runs-on: ${{ matrix.os }}
needs: [ init ]
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Clone utils repo
if: ${{needs.init.outputs.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
Expand Down Expand Up @@ -80,6 +133,12 @@ jobs:
if: matrix.os != 'ubuntu-latest'
run: npm test

- name: Link utils to camel-lsp-client-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'
Expand Down
4 changes: 3 additions & 1 deletion src/ui-test/tests/01_lsp.extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ import {
until,
VSBrowser,
ViewControl,
WebDriver
WebDriver,
DefaultWait
} from 'vscode-uitests-tooling';
import * as pjson from '../../../package.json';

Expand Down Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/ui-test/uitest_runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ async function main(): Promise<void> {
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,
Expand Down

0 comments on commit 4e929bc

Please sign in to comment.