Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
283 changes: 203 additions & 80 deletions .github/workflows/run-tests-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
unit-tests:
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: [self-hosted, vscode-vcast, Linux]
runs-on: ubuntu-24.04
env:
ENABLE_ATG_FEATURE: TRUE
LM_LICENSE_FILE: /vcast/vector-license.lic
Expand All @@ -41,8 +41,11 @@ jobs:
R2T_RELEASE_URL_WIN: ${{ github.event.inputs.r2t-release-url-win || '' }}

container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting
options: --user vcast_user --mount type=bind,source=${{ vars.VCAST_RELEASES_PATH }},target=/vcast
image: ghcr.io/vectorgrp/vscode_ubuntu24_ci:with_vcast
options: --user vcast_user
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

strategy:
fail-fast: false # ⬅ allow all matrix versions to run even if one fails
Expand Down Expand Up @@ -98,11 +101,61 @@ jobs:
echo "Error: autoreq-win.tar.gz not found."
exit 1
fi

# extract linux distribution
tar -xf autoreq-linux.tar.gz > /dev/null && rm autoreq-linux.tar.gz
mv distribution /tmp/linux_distribution

# Preferred location: $HOME/reqs2tests/resources/distribution
HOME_TARGET="$HOME/reqs2tests/resources/distribution"
WORKSPACE_TARGET="$GITHUB_WORKSPACE/resources/distribution"

# Try to create and copy into $HOME target; if that fails, fallback to workspace
if mkdir -p "$HOME_TARGET" 2>/dev/null && cp -r /tmp/linux_distribution/* "$HOME_TARGET/"; then
REQS_PATH="$HOME_TARGET"
echo "Copied reqs2tests distribution to HOME target: $REQS_PATH"
else
echo "Could not use HOME target ($HOME_TARGET). Falling back to GITHUB_WORKSPACE."
mkdir -p "$WORKSPACE_TARGET"
cp -r /tmp/linux_distribution/* "$WORKSPACE_TARGET/"
REQS_PATH="$WORKSPACE_TARGET"
echo "Copied reqs2tests distribution to workspace target: $REQS_PATH"
fi

# Export the distribution folder path (this will be available to subsequent steps)
echo "REQS2TESTS_RESOURCES=$REQS_PATH/bin" >> $GITHUB_ENV
echo "REQS2TESTS_RESOURCES set to: $REQS_PATH/bin"

# Debug listing of the distribution folder
echo "Listing REQS2TESTS_RESOURCES contents: $REQS_PATH"
if command -v tree >/dev/null 2>&1; then
tree -a "$REQS_PATH" || ls -laR "$REQS_PATH"
else
ls -laR "$REQS_PATH"
fi

# extract windows distribution for other uses (kept in /tmp)
tar -xf autoreq-win.tar.gz > /dev/null && rm autoreq-win.tar.gz
mv distribution /tmp/win_distribution

TARGET_DIR="$GITHUB_WORKSPACE/tests/internal/e2e/test"
echo "Listing all files and directories under: $TARGET_DIR"
if [ -d "$TARGET_DIR" ]; then
echo "----------------------------------------"
# Show a tree-like listing if available (nicer output)
if command -v tree >/dev/null 2>&1; then
tree -a "$TARGET_DIR"
else
ls -laR "$TARGET_DIR"
fi
echo "----------------------------------------"
else
echo "Directory not found: $TARGET_DIR"
echo "Listing parent directories for context:"
ls -la "$(dirname "$TARGET_DIR")" || true
fi


- name: Vcast activation
run: |
RELEASE_DIR=/vcast/${{ matrix.vcast }}
Expand Down Expand Up @@ -147,7 +200,7 @@ jobs:
run: |
curl -Os https://uploader.codecov.io/v0.7.1/linux/codecov
chmod +x codecov
./codecov -f ./coverage/coverage-final.json -F Unit -n vscode-vcast-unittests -t ${{ secrets.CODECOV_TOKEN }} -C ${{ github.sha }} -r ${{ github.repository }} -U ${http_proxy} >> out.txt
./codecov -f ./coverage/coverage-final.json -F Unit -n vscode-vcast-unittests -t ${{ secrets.CODECOV_TOKEN }} -C ${{ github.sha }} -r ${{ github.repository }} >> out.txt
cat out.txt | tail -n 1 | awk -F "'info'] " '{print $2}' | python3 -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)"
Expand Down Expand Up @@ -281,11 +334,14 @@ jobs:
generate-e2e-matrix:
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: [self-hosted, vscode-vcast, Linux]
runs-on: ubuntu-24.04

container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting
image: ghcr.io/vectorgrp/vscode_ubuntu24_ci:with_vcast
options: --user vcast_user
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

outputs:
version_group_matrix: ${{ steps.set-matrix.outputs.matrix }}
Expand Down Expand Up @@ -324,11 +380,14 @@ jobs:
needs: [generate-e2e-matrix, build-downloadable-vsix]
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: [self-hosted, vscode-vcast, Linux]
runs-on: ubuntu-24.04

container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting
options: --user vcast_user --mount type=bind,source=${{ vars.VCAST_RELEASES_PATH }},target=/vcast
image: ghcr.io/vectorgrp/vscode_ubuntu24_ci:with_vcast
options: --user vcast_user
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

strategy:
# ⬅ let all groups run even if one fails
Expand Down Expand Up @@ -454,7 +513,6 @@ jobs:
fi



- name: Package with VSCE
run: |
# Build a normal .vsix WITHOUT including the reqs2tests resources (we copied them to $GITHUB_WORKSPACE/resources)
Expand Down Expand Up @@ -522,20 +580,26 @@ jobs:
content=$([ -s ./tests/internal/e2e/gh_e2e_summary.md ] && cat ./tests/internal/e2e/gh_e2e_summary.md || echo 'Not available')
echo "${content}" >> $GITHUB_STEP_SUMMARY

COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S)
ARTIFACTORY_URL="https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev/vscode-gh1/${{ github.ref_name }}/$COMMIT_DATE-${{ github.sha }}/tests-results"
count=`ls -1 tests/internal/e2e/*.png 2>/dev/null | wc -l`
if [ $count != 0 ] ; then
cd tests/internal/e2e
tar -cvzf e2e_vcast${{ matrix.version }}_${{ matrix.group }}_screenshots.tar.gz *.png > /dev/null
URL="$ARTIFACTORY_URL/e2e_vcast${{ matrix.version }}_${{ matrix.group }}_screenshots/"
curl -H "X-Explode-Archive: true" -H "X-JFrog-Art-Api:${{ secrets.ARTIFACTORY_TOKEN }}" -X PUT $URL -T e2e_vcast${{ matrix.version }}_${{ matrix.group }}_screenshots.tar.gz
cd ../../..
echo "[Screenshots]($URL)" >> $GITHUB_STEP_SUMMARY
if compgen -G "tests/internal/e2e/*.png" > /dev/null; then
mkdir e2e_vcast${{ matrix.version }}_${{ matrix.group }}_screenshots
mv tests/internal/e2e/*.png e2e_vcast${{ matrix.version }}_${{ matrix.group }}_screenshots/
echo "SCREENSHOTS_FOLDER=e2e_vcast${{ matrix.version }}_${{ matrix.group }}_screenshots" >> $GITHUB_ENV
echo "HAS_SCREENSHOTS=true" >> $GITHUB_ENV
else
echo "No PNG files found, skipping screenshot folder creation"
echo "HAS_SCREENSHOTS=false" >> $GITHUB_ENV
fi
shell: bash

- name: Upload screenshots artifact
if: always() && env.HAS_SCREENSHOTS == 'true'
uses: actions/upload-artifact@v4
with:
name: ${{ env.SCREENSHOTS_FOLDER }}
path: ${{ env.SCREENSHOTS_FOLDER }}

- name: Save dependencies - node
if: steps.cache-dependencies-restore-node.outputs.cache-hit != 'true'
if: always() && steps.cache-dependencies-restore-node.outputs.cache-hit != 'true'
uses: actions/cache/save@v4
with:
path: |
Expand All @@ -553,11 +617,14 @@ jobs:
black:
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: [self-hosted, vscode-vcast, Linux]
runs-on: ubuntu-24.04

container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting
options: --user vcast_user
container:
image: ghcr.io/vectorgrp/vscode_ubuntu24_ci:with_vcast
options: --user vcast_user
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

steps:
- name: Check out repository
Expand All @@ -576,35 +643,41 @@ jobs:
if: failure()
uses: actions/checkout@v4

- name: Run black
shell: bash
run: |
/home/vcast_user/.venv/bin/python -m black . --check --extend-exclude '/(.*venv.*)/' > output.log 2>&1; echo $? > exitcode.txt
- name: Summary
shell: bash
if: always()
run: |
echo "### Black output" >> $GITHUB_STEP_SUMMARY
{
echo '```'
cat output.log
echo '```'
} >> $GITHUB_STEP_SUMMARY
- name: Exit with code
shell: bash
if: always()
run: |
if [ -f exitcode.txt ]; then
exit $(cat exitcode.txt)
fi
prettier:
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: [ self-hosted, vscode-vcast]
- name: Run black
shell: bash
run: |
/home/vcast_user/.venv/bin/python -m black . --check --extend-exclude '/(.*venv.*)/' > output.log 2>&1; echo $? > exitcode.txt

container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting
- name: Summary
shell: bash
if: always()
run: |
echo "### Black output" >> $GITHUB_STEP_SUMMARY
{
echo '```'
cat output.log
echo '```'
} >> $GITHUB_STEP_SUMMARY

- name: Exit with code
shell: bash
if: always()
run: |
if [ -f exitcode.txt ]; then
exit $(cat exitcode.txt)
fi

prettier:
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: ubuntu-24.04

container:
image: ghcr.io/vectorgrp/vscode_ubuntu24_ci:with_vcast
options: --user vcast_user
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GHCR_TOKEN }}

steps:
- name: Check out repository
Expand All @@ -623,32 +696,35 @@ jobs:
if: failure()
uses: actions/checkout@v4

- name: Run prettier
shell: bash
run: |
npm install prettier@$(node -pe "require('./package').devDependencies.prettier")
npx prettier -c . > output.log 2>&1; echo $? > exitcode.txt
- name: Summary
shell: bash
if: always()
run: |
echo "### Prettier output" >> $GITHUB_STEP_SUMMARY
{
echo '```'
cat output.log
echo '```'
} >> $GITHUB_STEP_SUMMARY
- name: Exit with code
shell: bash
if: always()
run: |
if [ -f exitcode.txt ]; then
exit $(cat exitcode.txt)
fi
xo:
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: [ self-hosted, vscode-vcast]
- name: Run prettier
shell: bash
run: |
npm install prettier@$(node -pe "require('./package').devDependencies.prettier")
npx prettier -c . > output.log 2>&1; echo $? > exitcode.txt

- name: Summary
shell: bash
if: always()
run: |
echo "### Prettier output" >> $GITHUB_STEP_SUMMARY
{
echo '```'
cat output.log
echo '```'
} >> $GITHUB_STEP_SUMMARY

- name: Exit with code
shell: bash
if: always()
run: |
if [ -f exitcode.txt ]; then
exit $(cat exitcode.txt)
fi

xo:
if: github.event.pull_request.draft == false
permissions: write-all
runs-on: ubuntu-24.04

container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting
Expand Down Expand Up @@ -691,5 +767,52 @@ jobs:
if: always()
run: |
if [ -f exitcode.txt ]; then
exit $(cat exitcode.txt)
fi
exit $(cat exitcode.txt)
fi

publish-extension:
permissions: write-all
runs-on: [self-hosted, vscode-vcast, Linux]
container:
image: rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting
options: --user vcast_user --mount type=bind,source=${{ vars.VCAST_RELEASES_PATH }},target=/vcast
needs: unit-tests
steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Restore cached dependencies
uses: actions/cache/restore@v4
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: Package extension and list VSIX
run: |
npm run package
echo "VSIX contents:"
npx vsce ls
VSIX_FILE=$(find . -maxdepth 2 -name "*.vsix" | head -n 1)
if [ -z "$VSIX_FILE" ]; then
echo "Error: vsix not found"
exit 1
fi
echo "VSIX_FILE=$VSIX_FILE" >> $GITHUB_ENV

- name: Upload VSIX
run: |
if [ -z "${VSIX_FILE}" ]; then
echo "VSIX_FILE environment variable not set"
exit 1
fi
COMMIT_DATE=$(git log -1 --format=%cd --date=format:%Y-%m-%dT%H:%M:%S)
ARTIFACTORY_URL="https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev/vscode-gh1/${{ github.ref_name }}/$COMMIT_DATE-${{ github.sha }}/artifacts"
BASENAME=$(basename "${VSIX_FILE}")
URL="$ARTIFACTORY_URL/$BASENAME"
curl -H "X-JFrog-Art-Api:${{ secrets.ARTIFACTORY_TOKEN }}" -X PUT $URL -T "${VSIX_FILE}"
echo "### VSIX Extension" >> $GITHUB_STEP_SUMMARY
echo "[Download extension (.vsix)]($URL)" >> $GITHUB_STEP_SUMMARY
Loading
Loading