Skip to content

fix: only allow a single app instance to run #1102

fix: only allow a single app instance to run

fix: only allow a single app instance to run #1102

Workflow file for this run

name: CI
on:
push:
branches: [main]
pull_request:
# By default, a workflow only runs when a pull_request's activity type is
# opened, synchronize, or reopened. Adding ready_for_review here ensures
# that CI runs when a PR is marked as not a draft, since we skip CI when a
# PR is draft
types: [opened, synchronize, reopened, ready_for_review]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != github.event.repository.default_branch }}
jobs:
checks:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js
id: setup-node
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
- name: Update npm version
uses: ./.github/update-npm-version
- name: Install deps
run: npm ci
- name: Check Electron node version
shell: bash
env:
EXPECTED_NODE_VERSION: ${{ steps.setup-node.outputs.node-version }}
run: |
electron_node_version=$(ELECTRON_RUN_AS_NODE=true npx electron -e 'console.log(process.versions.node);')
# Version string from setup-node is prefixed with "v"
if [[ "v$electron_node_version" == "$EXPECTED_NODE_VERSION" ]]
then
echo "✅ Electron node version matches expected ($electron_node_version)"
else
echo "⛔️ Electron node version ($electron_node_version) does not match expected ($EXPECTED_NODE_VERSION)"
exit 1
fi
- name: Build translations
run: node --run intl
- name: Run checks
run: node --run checks
test:
timeout-minutes: 10
strategy:
fail-fast: false
matrix:
os:
['ubuntu-latest', 'macos-latest', 'macos-15-intel', 'windows-latest']
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
- name: Update npm version
uses: ./.github/update-npm-version
- name: Install deps
run: npm ci
- name: Build translations
run: node --run intl
- name: Run type checks
run: node --run types
- name: Run tests
run: node --run test
test-e2e:
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
os:
[
{ name: 'linux', image: 'ubuntu-latest' },
{ name: 'macos', image: 'macos-latest' },
{ name: 'macos-intel', image: 'macos-15-intel' },
{ name: 'windows', image: 'windows-latest' },
]
runs-on: ${{ matrix.os.image }}
steps:
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- name: Use Node.js
uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0
with:
node-version-file: '.nvmrc'
- name: Update npm version
uses: ./.github/update-npm-version
- name: Install deps
run: npm ci
- name: Build translations
run: node --run intl
- name: Create packaged app
env:
APP_TYPE: 'internal'
COMAPEO_TEST: 'true'
SENTRY_DSN: ${{ vars.COMAPEO_SENTRY_DSN }}
VITE_FEATURE_TEST_DATA_UI: 'true'
### Uncomment the following if sourcemap uploads are needed for improved debugging
# SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
# SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
# SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
run: node --run forge:package
- name: Run e2e tests
if: ${{ matrix.os.name != 'linux'}}
run: node --run test-e2e
# NOTE: Addresses issue with app not launching (https://github.com/microsoft/playwright/issues/34251#issuecomment-2580645333)
- name: Run e2e tests (Linux)
if: ${{ matrix.os.name == 'linux'}}
run: |
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
xvfb-run --auto-servernum --server-args="-screen 0 1280x960x24" -- node --run test-e2e
- name: Upload Playwright report
if: ${{ !cancelled() }}
uses: actions/upload-artifact@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f # v7.0.0
with:
name: playwright-report-${{ matrix.os.name }}-${{ github.sha }}
path: tests-e2e/playwright-report/
overwrite: true
retention-days: 30