forge/.circleci/config.yml

172 строки
4.7 KiB
YAML
Исходник Обычный вид История

version: 2.1
orbs:
node: electronjs/node@2.2.1
commands:
install:
steps:
- run: git config --global core.autocrlf input
- node/install:
2023-07-06 00:55:10 +03:00
node-version: '18.15.0'
- 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/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: |
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: [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
- run-slow-tests
2023-08-31 00:52:38 +03:00
- 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|`pwd`/||g" ./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, node/linux, node/macos]
arch: [x64, arm64]
exclude:
- executor: node/windows
arch: arm64
- executor: node/linux
arch: arm64