Utils connection pipeline start #105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main CI | ||
on: | ||
push: | ||
branches: [ main, utils ] | ||
pull_request: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }} | ||
cancel-in-progress: true | ||
jobs: | ||
main: | ||
strategy: | ||
matrix: | ||
os: [ ubuntu-latest, macos-13, windows-latest ] | ||
version: [ "1.82.3", max ] # [ "x.x.x" | latest | max ] | ||
type: [ stable ] # [ stable | insider ] | ||
fail-fast: false | ||
env: | ||
CODE_VERSION: ${{ matrix.version }} | ||
CODE_TYPE: ${{ matrix.type }} | ||
TEST_RESOURCES: test-resources | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: View PR author | ||
run: echo "This PR is opened by ${{ github.event.pull_request.user.login }} ." | ||
- name: View PR author2 | ||
run: echo " ${{github.ref_name}}" | ||
- name: View PR author3 | ||
run: echo "${{github.event.pull_request.base.ref}}" | ||
- name: Check for UTILS branch in Fork | ||
run: | | ||
USER_FORK="https://github.com/${{ github.event.pull_request.user.login }}/vscode-uitests-tooling.git" | ||
BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | ||
echo $USER_FORK | ||
echo $BRANCH_NAME | ||
# - name: Check for UTILS branch in Fork | ||
# id: check-branch | ||
# run: | | ||
# echo "neco" | ||
# USER_FORK="https://github.com/${{ github.event.pull_request.user.login }}/utils.git" | ||
# BRANCH_NAME="${{ github.event.pull_request.head.ref }}" | ||
# BRANCH_EXISTS=$(curl -s -o /dev/null -w '%{http_code}' "$USER_FORK/branches/$BRANCH_NAME" -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}") | ||
# if [ $BRANCH_EXISTS -eq 200 ]; then | ||
# echo "UTILS_FORK_BRANCH_EXISTS=true" >> $GITHUB_ENV | ||
# echo "USER_FORK=$USER_FORK" >> $GITHUB_ENV | ||
# else | ||
# echo "UTILS_FORK_BRANCH_EXISTS=false" >> $GITHUB_ENV | ||
- name: Early exit | ||
run: | | ||
gh run cancel ${{ github.run_id }} | ||
gh run watch ${{ github.run_id }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
- 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/npm-get-version-action@v1.3.1 | ||
- 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@v4 | ||
if: matrix.os == 'ubuntu-latest' && matrix.version == 'max' | ||
with: | ||
name: sbom | ||
path: manifest.json | ||
- name: Store Camel Language Server log | ||
uses: actions/upload-artifact@v4 | ||
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@v4 | ||
if: failure() | ||
with: | ||
name: ${{ matrix.os }}-${{ matrix.version }}-test-logs | ||
path: .vscode-test/logs/* | ||
- name: Store UI test log | ||
uses: actions/upload-artifact@v4 | ||
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@v4 | ||
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 |