version: 2.1 executors: wine-chrome: working_directory: ~/mattermost-desktop docker: - image: electronuserland/builder:wine-chrome wine-mono: working_directory: ~/mattermost-desktop docker: - image: electronuserland/builder:wine-mono commands: update_image: description: "Update base image" parameters: apt_opts: type: string default: "" steps: - run: apt-get update && apt-get -y install << parameters.apt_opts >> - run: npm install jobs: check: executor: wine-chrome steps: - checkout - update_image: apt_opts: "--no-install-recommends" - restore_cache: key: lint-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }} - run: npm run lint:js-quiet - run: ELECTRON_DISABLE_SANDBOX=1 xvfb-run npm run test:app - run: mkdir -p /tmp/test-results - run: cp test-results.xml /tmp/test-results/ - store_test_results: path: /tmp/test-results - save_cache: key: lint-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }} paths: - "node_modules" - "src/node_modules" build: executor: wine-mono steps: - checkout - restore_cache: key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }} - restore_cache: key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }} - update_image: apt_opts: "--no-install-recommends jq icnsutils graphicsmagick tzdata" - run: npm run build - run: npm run package:windows - run: jq '.mac.target=["zip"]' electron-builder.json > /tmp/electron-builder.json && cp /tmp/electron-builder.json . - run: npm run package:mac - run: npm run package:linux - run: mkdir -p /tmp/artifacts - run: sh -x ./scripts/cp_artifacts.sh release /tmp/artifacts - save_cache: key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "package-lock.json" }} paths: - "node_modules" - "~/.cache/electron" - "~/.cache/electron-builder" - save_cache: key: npm-{{ arch }}-{{ .Branch }}-{{ checksum "src/package-lock.json" }} paths: - "src/node_modules" - store_artifacts: path: /tmp/artifacts/ destination: packages - run: ./node_modules/.bin/build-storybook -c src/.storybook -o storybook - store_artifacts: path: storybook/ destination: storybook workflows: version: 2 build_and_test: jobs: - check - build: requires: - check