Skip to content

Commit

Permalink
FUSETOOLS2-2201
Browse files Browse the repository at this point in the history
  • Loading branch information
pospisilf committed Dec 19, 2023
1 parent 33edbdf commit e5fd64f
Show file tree
Hide file tree
Showing 6 changed files with 956 additions and 2 deletions.
175 changes: 175 additions & 0 deletions .github/workflows/productized.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,175 @@
name: Productized CI

on:
push:
branches: [ main, FUSETOOLS2-2201 ]
pull_request:
branches: [ main ]
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true

jobs:
main:
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-13, windows-latest ]
version: [ max ] # [ "x.x.x" | latest | max ]
type: [ stable ] # [ stable | insider ]
camelversion: [ "4.0.0", "4.0.0.redhat-00031"]

env:
CODE_VERSION: ${{ matrix.version }}
CODE_TYPE: ${{ matrix.type }}
TEST_RESOURCES: test-resources
CAMEL_VERSION: ${{ matrix.camelversion }}

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

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"

- name: Test java
run: java --version

- name: Install JBang (ubuntu, macOS)
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-13'
run: |
curl -Ls https://sh.jbang.dev | bash -s - app setup
echo "$HOME/.jbang/bin" >> $GITHUB_PATH
- name: Install JBang (windows)
if: matrix.os == 'windows-latest'
run: choco install jbang

- name: Setup JBang (trusted sources)
run: jbang trust add https://github.com/apache/

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 18.15.x
cache: npm

- name: Setup vsce
run: |
npm install -g typescript @vscode/vsce
vsce --version
- name: npm-ci
run: npm ci

- name: npm-vscode:prepublish
run: npm run vscode:prepublish

- name: test (ubuntu)
id: test_Ubuntu
if: matrix.os == 'ubuntu-latest'
run: xvfb-run --auto-servernum npm test

- name: test (macos, windows)
if: matrix.os != 'ubuntu-latest'
run: npm test

- name: ui test (ubuntu)
id: uiTest_Ubuntu
if: matrix.os == 'ubuntu-latest'
run: xvfb-run --auto-servernum npm run ui-test

- name: ui test (macos, windows)
id: uiTest_MacOS_Windows
if: matrix.os != 'ubuntu-latest'
run: npm run ui-test

- name: vsce-package
run: vsce package

- name: get-npm-version
id: package-version
if: matrix.os == 'ubuntu-latest'
uses: martinbeentjes/[email protected]

- name: Generate SBOM
if: matrix.os == 'ubuntu-latest'
run: |
npm install --global @cyclonedx/cyclonedx-npm
cyclonedx-npm --omit dev --output-file node-sbom.json
wget https://github.com/CycloneDX/cyclonedx-cli/releases/download/v0.25.0/cyclonedx-linux-x64
chmod +x cyclonedx-linux-x64
./cyclonedx-linux-x64 merge --hierarchical --group com.github.camel-tooling --name vscode-apache-camel --version ${{ steps.package-version.outputs.current-version}} --input-files node-sbom.json camel-ls-sbom.json --output-file manifest.json
- name: Store SBOM
uses: actions/upload-artifact@v3
if: matrix.os == 'ubuntu-latest'
with:
name: sbom
path: manifest.json
- name: Store Camel Language Server log
uses: actions/upload-artifact@v3
if: failure() && matrix.os != 'windows-latest'
with:
name: ${{ matrix.os }}-${{ matrix.version }}-camel-lsp-log
path: |
/tmp/log-camel-lsp.log
/tmp/log-camel*.log.gz
- name: Store VS Code Logs
uses: actions/upload-artifact@v3
if: failure()
with:
name: ${{ matrix.os }}-${{ matrix.version }}-test-logs
path: .vscode-test/logs/*

- name: Store UI test log
uses: actions/upload-artifact@v3
if: |
(failure() || cancelled()) &&
(steps.uiTest_Ubuntu.outcome == 'failure' ||
steps.uiTest_MacOS_Windows.outcome == 'failure' ||
steps.uiTest_Ubuntu.outcome == 'cancelled' ||
steps.uiTest_MacOS_Windows.outcome == 'cancelled')
with:
name: ${{ matrix.os }}-${{ matrix.version }}-ui-test-logs
path: test-resources/settings/logs/*

- name: Store UI Test Screenshots
uses: actions/upload-artifact@v3
if: |
(failure() || cancelled()) &&
(steps.uiTest_Ubuntu.outcome == 'failure' ||
steps.uiTest_MacOS_Windows.outcome == 'failure' ||
steps.uiTest_Ubuntu.outcome == 'cancelled' ||
steps.uiTest_MacOS_Windows.outcome == 'cancelled')
with:
name: ${{ matrix.os }}-${{ matrix.version }}-ui-test-screenshots
path: test-resources/screenshots/*.png

check:
if: always()
runs-on: ubuntu-latest
name: Status Check
needs: [ main ]
steps:
- name: Test Matrix Result
run: |
echo result = ${{ needs.main.result }}
- name: Status Check - success
if: ${{ needs.main.result == 'success' }}
run: |
echo "All tests successfully completed!"
exit 0
- name: Status Check - failure
if: ${{ needs.main.result != 'success' }}
run: |
echo "Status Check failed!"
exit 1
72 changes: 72 additions & 0 deletions src/ui-test/tests/00_set.camel.version.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License", destination); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

//import { assert } from 'chai';
import {
CATALOG_VERSION_ID,
CATALOG_VERSION_UI,
RESOURCES,
closeEditor,
readUserSetting,
waitUntilExtensionIsActivated
} from '../utils/testUtils';
import {
ActivityBar,
before,
VSBrowser,
WebDriver,
TextSetting,
Workbench
} from 'vscode-uitests-tooling';
import * as pjson from '../../../package.json';
import { assert } from 'chai';

describe('set camel version', function () {
this.timeout(150000);

let driver: WebDriver;

before(async function () {
this.timeout(40000);
driver = VSBrowser.instance.driver;
await VSBrowser.instance.openResources(RESOURCES);
await VSBrowser.instance.waitForWorkbench();

await waitUntilExtensionIsActivated(driver, `${pjson.displayName}`);
await (await new ActivityBar().getViewControl('Explorer')).openView();
});

it('set and check value', async function () {

if(process.env.CAMEL_VERSION == null || process.env.CAMEL_VERSION.length == 0){ // no env variable set or is empty
this.skip();
}

// set version in ui
const settings = await new Workbench().openSettings();
const textSetting = await settings.findSetting(CATALOG_VERSION_UI, 'Camel') as TextSetting;
await textSetting.setValue(process.env.CAMEL_VERSION);
await closeEditor('Settings', true);

// wait until change is available in settings file
await driver.wait(async function () {
return readUserSetting(CATALOG_VERSION_ID) === (process.env.CAMEL_VERSION);
}, 15000, `Camel Version not set in time limit.`, 1500);

assert.equal(readUserSetting(CATALOG_VERSION_ID), process.env.CAMEL_VERSION)
});
});
13 changes: 11 additions & 2 deletions src/ui-test/tests/camel.settings.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
initXMLFileWithJBang,
JBANG_VERSION_ID,
killTerminal,
readUserSetting,
resetUserSettings,
RESOURCES,
setAdditionalComponents,
Expand Down Expand Up @@ -121,7 +122,15 @@ describe('User preferences', function () {

after(async function () {
await new EditorView().closeAllEditors();
resetUserSettings(CATALOG_VERSION_ID);
if(process.env.CAMEL_VERSION != null){
await setCamelCatalogVersion(process.env.CAMEL_VERSION);
await driver.wait(async function () {
return readUserSetting(CATALOG_VERSION_ID) === (process.env.CAMEL_VERSION);
}, 15000, `Camel Version not set in time limit.`, 1500);

} else {
resetUserSettings(CATALOG_VERSION_ID);
}
});

afterEach(async function () {
Expand Down Expand Up @@ -270,4 +279,4 @@ describe('User preferences', function () {
assert.equal(items.length, 0);
}
}
});
});
Loading

0 comments on commit e5fd64f

Please sign in to comment.