diff --git a/.github/workflows/run-tests-workflow.yml b/.github/workflows/run-tests-workflow.yml index 434d3e26..6b1454d2 100644 --- a/.github/workflows/run-tests-workflow.yml +++ b/.github/workflows/run-tests-workflow.yml @@ -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 @@ -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 @@ -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 }} @@ -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)" @@ -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 }} @@ -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 @@ -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) @@ -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: | @@ -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 @@ -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 @@ -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 @@ -691,5 +767,52 @@ jobs: if: always() run: | if [ -f exitcode.txt ]; then - exit $(cat exitcode.txt) - fi \ No newline at end of file + 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 \ No newline at end of file diff --git a/docker/Ubuntu24-Dockerfile-CI-with-vcast b/docker/Ubuntu24-Dockerfile-CI-with-vcast new file mode 100644 index 00000000..8f42e4a8 --- /dev/null +++ b/docker/Ubuntu24-Dockerfile-CI-with-vcast @@ -0,0 +1,81 @@ +# ghcr.io/vectorgrp/vscode_ubuntu24_ci +FROM rds-vtc-docker-dev-local.vegistry.vg.vector.int/vcast/vscode_ubuntu24_ci:node_18_dynamic_mounting + +ARG USERNAME=vcast_user +ARG USER_UID=1001 # host runner UID on GitHub-hosted runners +ARG USER_GID=121 # common docker group GID on GH runners (sometimes 127) + +USER root +SHELL ["/bin/bash", "-lc"] + +# vcast +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/2021sp0.tar.gz /vcast/2021sp0.tar.gz +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/2023sp0.tar.gz /vcast/2023sp0.tar.gz +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/2024sp1.tar.gz /vcast/2024sp1.tar.gz +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/2024sp4.tar.gz /vcast/2024sp4.tar.gz +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/2024sp5.tar.gz /vcast/2024sp5.tar.gz +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/2025sp0.tar.gz /vcast/2025sp0.tar.gz +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/2025sp1.tar.gz /vcast/2025sp1.tar.gz +ADD https://artifactory.vi.vector.int:443/artifactory/rds-build-packages-generic-dev-local/vcast/vector-license.lic /vcast/vector-license.lic + +RUN set -eux; \ + if getent group "${USER_GID}" >/dev/null; then \ + groupmod -g "${USER_GID}" "${USERNAME}" || true; \ + else \ + groupmod -g "${USER_GID}" "${USERNAME}" || groupadd -g "${USER_GID}" "${USERNAME}"; \ + fi; \ + usermod -u "${USER_UID}" -g "${USER_GID}" "${USERNAME}"; \ + chown -R "${USER_UID}:${USER_GID}" "/home/${USERNAME}" + +RUN cd /vcast && \ + for f in *.tar.gz; do tar xf "$f"; done && rm *.tar.gz && \ + chown -R $(id -u $USERNAME):$(id -g $USERNAME) /vcast && \ + chown -R $(id -u $USERNAME):$(id -g $USERNAME) /__w + +# cleaning up proxy settings +RUN set -eux; \ + N_PREFIX_DEFAULT="/home/${USERNAME}/.n"; \ + NPM_GLOBAL_NPMRC="${N_PREFIX:-$N_PREFIX_DEFAULT}/etc/npmrc"; \ + for f in \ + "/etc/npmrc" \ + "/usr/local/etc/npmrc" \ + "$NPM_GLOBAL_NPMRC" \ + "/home/${USERNAME}/.npmrc" \ + "/home/${USERNAME}/.config/npm/npmrc"; do \ + if [ -f "$f" ]; then \ + sed -i -E '/^(proxy|https-proxy|noproxy|cafile|registry)\s*=/d' "$f"; \ + fi; \ + done + +RUN set -eux; \ + if [ -f "/home/${USERNAME}/.bashrc" ]; then \ + sed -i -E '/REQUESTS_CA_BUNDLE|http_proxy|https_proxy|HTTP_PROXY|HTTPS_PROXY|NO_PROXY/d' "/home/${USERNAME}/.bashrc"; \ + fi + +RUN set -eux; \ + chown root:root /etc/ssl/certs/ca-certificates.crt || true; \ + rm -f /etc/ssl/certs/ca-certificates.crt; \ + find /usr/local/share/ca-certificates -type f -iname 'vector_*.crt' -print -delete || true; \ + find /usr/local/share/ca-certificates/ -type f -iname '*.crt' -print -delete || true; \ + update-ca-certificates --fresh || true + +ENV NODE_EXTRA_CA_CERTS= \ + SSL_CERT_FILE= \ + REQUESTS_CA_BUNDLE= \ + SSL_CERT_DIR= \ + CA_BUNDLE_PATH= \ + CURL_CA_BUNDLE= \ + GLOBAL_AGENT_HTTP_PROXY= \ + http_proxy= \ + GLOBAL_AGENT_HTTPS_PROXY= \ + GLOBAL_AGENT_NO_PROXY= \ + HTTPS_PROXY= \ + https_proxy= \ + no_proxy= \ + HTTP_PROXY= + +RUN chown -R "${USERNAME}:${USERNAME}" "/home/${USERNAME}" || true + +USER ${USERNAME} + +SHELL ["/bin/bash", "--login", "-c"] \ No newline at end of file