Skip to content

Fix CI on the master branch #988

Fix CI on the master branch

Fix CI on the master branch #988

Workflow file for this run

name: Test for vscode-rdbg
on:
push:
branches:
- master
pull_request:
branches:
- master
env:
# The file path is inconsistent when setting a relative path in VS Code tests.
# As a workaround, an absolute path is configured.
# https://github.com/microsoft/vscode-test/issues/17
LAUNCHABLE_TEST_REPORTS: ${{ format('{0}-{1}', github.workspace, 'launchable-test-reports.xml') }}
# GITHUB_PULL_REQUEST_URL are used for commenting test reports in Launchable Github App.
# https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/link.py#L42
GITHUB_PULL_REQUEST_URL: ${{ github.event.pull_request.html_url }}
# The following envs are necessary in Launchable tokenless authentication.
# https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/authentication.py#L20
LAUNCHABLE_ORGANIZATION: "ruby"
LAUNCHABLE_WORKSPACE: "vscode-rdbg"
# https://github.com/launchableinc/cli/blob/v1.80.1/launchable/utils/authentication.py#L71
GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
jobs:
test:
strategy:
matrix:
os: [macos-latest, ubuntu-latest, windows-latest]
ruby-version: ['head']
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
# Set fetch-depth: 0 so that Launchable can receive commits information.
fetch-depth: 0
# Launchable requires Python and Java
# https://www.launchableinc.com/docs/resources/cli-reference/
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Set up JDK 1.8
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
- name: Setup Launchable
run: |
pip install launchable
launchable verify
launchable record build --name "${{ env.GITHUB_PR_HEAD_SHA }}"
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: 16.x
- name: Install debug.gem
run: |
gem install debug
rdbg -v
- run: npm ci
- run: xvfb-run -a npm test
if: runner.os == 'Linux'
# VS code overrides The PATH environment variable:
# https://github.com/microsoft/vscode/blob/1.73.0/src/vs/server/node/extensionHostConnection.ts#L59
# Thus, when we execute ruby command like `ruby target.rb`, the `ruby` path may be wrong as follows
#
# The PATH environment variable before running VS Code:
# /Users/runner/work/vscode-rdbg/vscode-rdbg/node_modules/.bin:/Users/runner/work/vscode-rdbg/node_modules/ ... /bin:/Users/runner/hostedtoolcache/Ruby/3.1.2/ ...
#
# The PATH environment variable after running VS Code:
# /usr/local/lib/ruby/gems/3.0.0/bin:/usr/local/opt/[email protected]/ ... /Users/runner/work/vscode-rdbg/vscode-rdbg/node_modules/.bin:/Users/runner/work/vscode-rdbg/node_modules/
#
# The RUBY_DEBUG_TEST_PATH environment variable is for setting correct ruby path when testing.
- run: echo "RUBY_DEBUG_TEST_PATH=`which ruby`" >> $GITHUB_ENV
if: runner.os == 'macOS'
- run: npm test
if: runner.os != 'Linux'
- name: Record tests with Launchable
run: launchable record tests --flavor os=${{ matrix.os }} --flavor test=integration_test file ${{ env.LAUNCHABLE_TEST_REPORTS }}
if: always()
dependabot:
needs: test
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' && github.actor == 'dependabot[bot]' }}
permissions:
contents: write
pull-requests: write
steps:
- name: Dependabot metadata
id: metadata
uses: dependabot/fetch-metadata@v2
with:
github-token: "${{ secrets.GITHUB_TOKEN }}"
- name: Enable auto-merge for Dependabot PRs
if: ${{ steps.metadata.outputs.update-type != 'version-update:semver-major' }}
run : |
gh pr review --approve "$PR_URL"
gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}