From dd20a11dad066440bc0b18cd82e16740ebbc4342 Mon Sep 17 00:00:00 2001 From: Cedric van Putten Date: Thu, 31 Aug 2023 14:28:23 +0200 Subject: [PATCH] refactor: move xvfb to a separate action --- .github/actions/test-vscode/action.yml | 25 +++++++++++++++++++++++++ .github/workflows/test.yml | 20 ++++++++------------ 2 files changed, 33 insertions(+), 12 deletions(-) create mode 100644 .github/actions/test-vscode/action.yml diff --git a/.github/actions/test-vscode/action.yml b/.github/actions/test-vscode/action.yml new file mode 100644 index 00000000..40524f62 --- /dev/null +++ b/.github/actions/test-vscode/action.yml @@ -0,0 +1,25 @@ +name: Test VS Code +description: Run the integration tests within VS Code + +inputs: + command: + description: The test command to execute with xvfb-run + required: true + type: string + +runs: + using: composite + steps: + - name: 🧪 Test on Linux + if: ${{ runner.os == 'Linux' }} + run: xvfb-run -a ${{ inputs.command }} + shell: bash + env: + # Unset wrong Electron setting, + # see: https://github.com/microsoft/vscode-test/issues/127 + DBUS_SESSION_BUS_ADDRESS: null + + - name: 🧪 Test on MacOS/Windows + if: ${{ runner.os != 'Linux' }} + run: ${{ inputs.command }} + shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bb018cd6..7726f082 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -33,7 +33,7 @@ jobs: - name: 🏗 Setup project uses: ./.github/actions/setup-project - - name: ✅ Test scripts + - name: 🧪 Test scripts run: npm run test:scripts bundled: @@ -64,9 +64,10 @@ jobs: npm install --no-package-lock --ignore-scripts - name: 🧪 Test project - run: xvfb-run -a npm run test:vscode + uses: ./.github/actions/test-vscode + with: + command: npm run test:vscode env: - DBUS_SESSION_BUS_ADDRESS: null VSCODE_VERSION: stable vscode: @@ -100,12 +101,7 @@ jobs: : vscode core.exportVariable('VSCODE_VERSION', target) - - name: 🧪 Test project (Linux) - if: ${{ runner.os == 'Linux' }} - run: xvfb-run -a npm run test:vscode - env: - DBUS_SESSION_BUS_ADDRESS: null - - - name: 🧪 Test project (MacOS/Windows) - if: ${{ runner.os != 'Linux' }} - run: npm run test:vscode + - name: 🧪 Test project + uses: ./.github/actions/test-vscode + with: + command: npm run test:vscode