forge/.circleci/config.yml

190 строки
5.2 KiB
YAML

version: 2.1
orbs:
node: electronjs/node@2.3.1
executors:
linux-medium-plus:
docker:
- image: cimg/base:stable
resource_class: medium+
commands:
install:
steps:
- run: git config --global core.autocrlf input
- node/install:
node-version: '18.20.3'
- checkout
run-lint-and-build:
steps:
- node/install-packages
- run:
name: 'Lint codebase'
command: |
yarn lint
yarn syncpack
- run:
name: 'Build Electron Forge'
command: |
yarn build
run-fast-tests:
steps:
- node/install-packages:
with-cache: false
- attach_workspace:
at: .
- run:
name: 'Run fast tests'
command: |
yarn test:fast
run-slow-tests:
steps:
- node/install-packages:
with-cache: false
- attach_workspace:
at: .
- run:
name: 'Run slow tests'
command: |
echo $(circleci tests glob "packages/**/*_spec_slow.ts")
TEST_GLOB=$(circleci tests glob "packages/**/*_spec_slow.ts" | circleci tests split --split-by=timings)
yarn test $TEST_GLOB
jobs:
lint-and-build:
executor: node/linux
steps:
- install
- run-lint-and-build
- persist_to_workspace:
root: .
paths:
- packages/*/*/dist/*
fast-tests:
parameters:
executor:
type: string
arch:
type: enum
enum: ['x64', 'arm64']
executor: << parameters.executor >>
steps:
- install
- when:
condition:
equal: [node/windows, << parameters.executor >>]
steps:
- run:
name: Windows Setup
shell: bash
command: |
pip install setuptools
cd 'C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script'
npm install node-gyp@9.4.0
- when:
condition:
equal: [node/linux, << parameters.executor >>]
steps:
- run:
name: Linux specific setup
command: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
xvfb \
libnss3 \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libgdk-pixbuf2.0-dev \
libgtk-3-0 \
libgbm1
sudo add-apt-repository -y ppa:alexlarsson/flatpak
- run-fast-tests
- store_test_results:
path: ./reports/
slow-tests:
parameters:
executor:
type: string
arch:
type: enum
enum: ['x64', 'arm64']
executor: << parameters.executor >>
parallelism: 2
steps:
- install
- when:
condition:
equal: [node/windows, << parameters.executor >>]
steps:
- run:
name: Windows Setup
shell: bash
command: |
pip install setuptools
choco install --no-progress -y wixtoolset --version=3.14.0
echo 'export PATH=$PATH:"/C/Program Files (x86)/WiX Toolset v3.14/bin"' >> "$BASH_ENV"
cd 'C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\run-script'
npm install node-gyp@9.4.0
- when:
condition:
equal: [linux-medium-plus, << parameters.executor >>]
steps:
- run:
name: Linux specific setup
command: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
xvfb \
libnss3 \
libasound2 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libgdk-pixbuf2.0-dev \
libgtk-3-0 \
libgbm1
- run-slow-tests
- run:
when: always # the report is generated on pass or fail
name: Make test report paths relative
command: |
if [ -e ./reports/out/test_output.xml ]; then
sed -i.bak 's/"[^"]*packages/"packages/' ./reports/out/test_output.xml
fi
- store_test_results:
path: ./reports/
workflows:
tests:
jobs:
- lint-and-build
- fast-tests:
requires:
- lint-and-build
matrix:
parameters:
executor: [node/windows, node/linux, node/macos]
arch: [x64, arm64]
exclude:
- executor: node/windows
arch: arm64
- executor: node/linux
arch: arm64
- slow-tests:
requires:
- lint-and-build
matrix:
parameters:
executor: [node/windows, linux-medium-plus, node/macos]
arch: [x64, arm64]
exclude:
- executor: node/windows
arch: arm64
- executor: linux-medium-plus
arch: arm64