Skip to content

Zbigor running tests #9

Zbigor running tests

Zbigor running tests #9

name: Vector Vscode Vcast Tests
run-name: ${{ github.actor }} running tests
on:
push:
branches:
- main
- gh_actions_for_tests # TODO
- wip_gh_actions_for_tests
pull_request:
release:
jobs:
unit-tests:
permissions: write-all
runs-on: [self-hosted, vscode-vcast]
container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vcast_base
options: --user vcast_user
steps:
- name: Start forward proxy
run: |
sudo /usr/sbin/squid
NEW_PROXY="http://$(hostname --ip-address):3128"
echo "HTTP_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "HTTPS_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "http_proxy=$NEW_PROXY" >> $GITHUB_ENV
echo "https_proxy=$NEW_PROXY" >> $GITHUB_ENV
echo "GLOBAL_AGENT_HTTP_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "GLOBAL_AGENT_HTTPS_PROXY=$NEW_PROXY" >> $GITHUB_ENV
- name: Check out repository
uses: actions/checkout@v3
# Run tests
- name: Restore cached dependencies
id: cache-dependencies-restore
uses: actions/cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('package.json') }}
- name: Install dependencies
if: steps.cache-dependencies-restore.outputs.cache-hit != 'true'
run: npm install
- name: Save dependencies
if: steps.cache-dependencies-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('package.json') }}
- name: Package with VSCE
run: vsce package
- name: Run unit tests
run: npm run gh-test | tee output.txt
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
check_name: "Unit Test results"
files: |
./test-output.xml
- name: Show coverage summary
run: |
echo "### Coverage summary - Unit tests" >> $GITHUB_STEP_SUMMARY
{
echo '```'
sed -n '/Coverage report from/,$p' output.txt
echo '```'
} >> $GITHUB_STEP_SUMMARY
- name: Upload coverage artifacts
if: always()
run: |
curl -Os https://uploader.codecov.io/v0.7.1/linux/codecov
chmod +x codecov
./codecov -f ./coverage/clover.xml -F Unit -n vscode-vcast-unittests -t ${{ secrets.CODECOV_TOKEN }} -C ${{ github.sha }} -r ${{ github.repository }} -U ${http_proxy} >> out.txt
cat out.txt | tail -n 1 | awk -F "'info'] " '{print $2}' | python -c 'import json,sys;obj=json.load(sys.stdin);print(obj.get("resultURL", ""))' > url.txt
title="Coverage report URL" && \
[ -z $(cat url.txt) ] && echo "::notice title=$title::URL not found" || echo "::notice title=$title::$(cat url.txt)"
# Upload artifacts
- name: Find VSIX File
if: always()
run: |
VSIX_FILE=$(ls /__w/vector-vscode-vcast/vector-vscode-vcast/*.vsix)
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_ENV
- name: Upload vectorcasttestexplorer artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: vectorcasttestexplorer
path: ${{ env.VSIX_FILE }}
- name: Upload coverage artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: coverage
path: ./coverage
# Upload release asset
- name: Upload release asset
if: github.event_name == 'release'
run: |
url="${{ github.event.release.upload_url }}" && \
export upload_url=${url%%\{*}?name=vectorcasttestexplorer-${{ github.event.release.tag_name }}.vsix && \
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-H "X-GitHub-Api-Version: 2022-11-28" \
-H "Content-Type: application/octet-stream" \
$upload_url \
--data-binary "@${{ env.VSIX_FILE }}"
e2e-tests-23:
permissions: write-all
runs-on: [ self-hosted, vscode-vcast ]
container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vcast_base
options: --user vcast_user -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:rw
steps:
- name: Start forward proxy
run: |
sudo /usr/sbin/squid
NEW_PROXY="http://$(hostname --ip-address):3128"
echo "HTTP_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "HTTPS_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "http_proxy=$NEW_PROXY" >> $GITHUB_ENV
echo "https_proxy=$NEW_PROXY" >> $GITHUB_ENV
echo "GLOBAL_AGENT_HTTP_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "GLOBAL_AGENT_HTTPS_PROXY=$NEW_PROXY" >> $GITHUB_ENV
- name: Check out repository
uses: actions/checkout@v3
- name: Restore cached dependencies
id: cache-dependencies-restore
uses: actions/cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('package.json') }}
- name: Install dependencies
if: steps.cache-dependencies-restore.outputs.cache-hit != 'true'
run: npm install
- name: Save dependencies
if: steps.cache-dependencies-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('package.json') }}
- name: Package with VSCE
run: vsce package
- name: Restore cached dependencies - node
id: cache-dependencies-restore-node
uses: actions/cache/restore@v3
with:
path: |
tests/internal/e2e/node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('tests/internal/e2e/package.json') }}
- name: Restore cached dependencies - vscode
id: cache-dependencies-restore-vscode
uses: actions/cache/restore@v3
with:
path: |
tests/internal/e2e/.wdio-vscode-service
key: ${{ runner.os }}-dependencies-webdriver-vscode
- name: Run tests
run: |
./tests/internal/e2e/run_e2e_tests.sh
- name: Publish e2e tests results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
check_name: "E2e Test results - Vcast 23"
files: |
./tests/internal/e2e/test_results/*.xml
- name: Uploading screenshots
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e_screenshots_23
path: ./tests/internal/e2e/*.png
- name: Show run summary
run: |
echo "### Run summary - Vcast 23" >> $GITHUB_STEP_SUMMARY
content=$([ -s ./tests/internal/e2e/gh_output.txt ] && cat ./tests/internal/e2e/gh_output.txt || echo 'Not available')
echo "${content}" >> $GITHUB_STEP_SUMMARY
- name: Save dependencies - node
if: steps.cache-dependencies-restore-node.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
tests/internal/e2e/node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('tests/internal/e2e/package.json') }}
- name: Save dependencies - vscode
if: always() && steps.cache-dependencies-restore-vscode.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
tests/internal/e2e/.wdio-vscode-service
key: ${{ runner.os }}-dependencies-webdriver-vscode
e2e-tests-24:
permissions: write-all
runs-on: [ self-hosted, vscode-vcast ]
container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vcast_base
options: --user vcast_user -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket:rw
steps:
- name: Start forward proxy
run: |
sudo /usr/sbin/squid
NEW_PROXY="http://$(hostname --ip-address):3128"
echo "HTTP_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "HTTPS_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "http_proxy=$NEW_PROXY" >> $GITHUB_ENV
echo "https_proxy=$NEW_PROXY" >> $GITHUB_ENV
echo "GLOBAL_AGENT_HTTP_PROXY=$NEW_PROXY" >> $GITHUB_ENV
echo "GLOBAL_AGENT_HTTPS_PROXY=$NEW_PROXY" >> $GITHUB_ENV
- name: Check out repository
uses: actions/checkout@v3
- name: Restore cached dependencies
id: cache-dependencies-restore
uses: actions/cache/restore@v3
with:
path: |
node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('package.json') }}
- name: Install dependencies
if: steps.cache-dependencies-restore.outputs.cache-hit != 'true'
run: npm install
- name: Save dependencies
if: steps.cache-dependencies-restore.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('package.json') }}
- name: Package with VSCE
run: vsce package
- name: Restore cached dependencies - node
id: cache-dependencies-restore-node
uses: actions/cache/restore@v3
with:
path: |
tests/internal/e2e/node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('tests/internal/e2e/package.json') }}
- name: Restore cached dependencies - vscode
id: cache-dependencies-restore-vscode
uses: actions/cache/restore@v3
with:
path: |
tests/internal/e2e/.wdio-vscode-service
key: ${{ runner.os }}-dependencies-webdriver-vscode
- name: Run tests
run: |
USE_VCAST_24=True ./tests/internal/e2e/run_e2e_tests.sh
- name: Publish e2e tests results
uses: EnricoMi/publish-unit-test-result-action/composite@v2
if: always()
with:
check_name: "E2e Test results - Vcast 24"
files: |
./tests/internal/e2e/test_results/*.xml
- name: Uploading screenshots
uses: actions/upload-artifact@v3
if: always()
with:
name: e2e_screenshots_24
path: ./tests/internal/e2e/*.png
- name: Show run summary
run: |
echo "### Run summary - Vcast 24" >> $GITHUB_STEP_SUMMARY
content=$([ -s ./tests/internal/e2e/gh_output.txt ] && cat ./tests/internal/e2e/gh_output.txt || echo 'Not available')
echo "${content}" >> $GITHUB_STEP_SUMMARY
- name: Save dependencies - node
if: steps.cache-dependencies-restore-node.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
tests/internal/e2e/node_modules
key: ${{ runner.os }}-dependencies-${{ hashFiles('tests/internal/e2e/package.json') }}
- name: Save dependencies - vscode
if: always() && steps.cache-dependencies-restore-vscode.outputs.cache-hit != 'true'
uses: actions/cache/save@v3
with:
path: |
tests/internal/e2e/.wdio-vscode-service
key: ${{ runner.os }}-dependencies-webdriver-vscode