mirror of
https://github.com/4ian/GDevelop.git
synced 2025-10-15 10:19:04 +00:00
251 lines
10 KiB
YAML
251 lines
10 KiB
YAML
# CircleCI configuration to build GDevelop app running
|
|
# on the Electron runtime (newIDE/electron-app) for macOS and Linux.
|
|
# For Windows, see the appveyor.yml file.
|
|
|
|
# This also builds GDevelop.js and store it on a S3 so it can be used to run
|
|
# GDevelop without building it from scratch.
|
|
|
|
# Note that these CircleCI builds/tests are not launched on Pull Requests from forks,
|
|
# to avoid sharing secrets.
|
|
|
|
version: 2.1
|
|
orbs:
|
|
aws-cli: circleci/aws-cli@2.0.6
|
|
macos: circleci/macos@2.5.1 # For Rosetta (see below)
|
|
node: circleci/node@5.2.0 # For a recent npm version (see below)
|
|
jobs:
|
|
# Build the **entire** app for macOS.
|
|
build-macos:
|
|
macos:
|
|
xcode: 14.2.0
|
|
resource_class: macos.m1.large.gen1
|
|
steps:
|
|
- checkout
|
|
# Install Rosetta for AWS CLI and disable TSO to speed up S3 uploads (https://support.circleci.com/hc/en-us/articles/19334402064027-Troubleshooting-slow-uploads-to-S3-for-jobs-using-an-m1-macOS-resource-class)
|
|
- macos/install-rosetta
|
|
- run: sudo sysctl net.inet.tcp.tso=0
|
|
|
|
# Install a recent version of npm to workaround a notarization issue because of a symlink made by npm: https://github.com/electron-userland/electron-builder/issues/7755
|
|
# Node.js v20.14.0 comes with npm v10.7.0.
|
|
- node/install:
|
|
node-version: "20.14.0"
|
|
|
|
# System dependencies (for Emscripten and upload)
|
|
- run:
|
|
name: Install dependencies for Emscripten
|
|
command: brew install cmake
|
|
|
|
- run:
|
|
name: Install dependencies for AWS S3 upload
|
|
command: curl "https://awscli.amazonaws.com/AWSCLIV2.pkg" -o "AWSCLIV2.pkg" && sudo installer -pkg AWSCLIV2.pkg -target /
|
|
|
|
- run:
|
|
name: Install Emscripten (for GDevelop.js)
|
|
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
|
|
|
|
# GDevelop.js dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- gd-macos-nodejs-dependencies-{{ checksum "newIDE/app/package.json" }}-{{ checksum "newIDE/electron-app/package.json" }}-{{ checksum "GDevelop.js/package.json" }}
|
|
# fallback to using the latest cache if no exact match is found
|
|
- gd-macos-nodejs-dependencies---
|
|
|
|
- run:
|
|
name: Install GDevelop.js dependencies
|
|
command: cd GDevelop.js && npm install && cd ..
|
|
|
|
# Build GDevelop.js (and run tests to ensure it works)
|
|
- run:
|
|
name: Build GDevelop.js
|
|
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test && cd ..
|
|
|
|
# GDevelop IDE dependencies (after building GDevelop.js to avoid downloading a pre-built version)
|
|
- run:
|
|
name: Install GDevelop IDE dependencies
|
|
command: cd newIDE/app && npm install && cd ../electron-app && npm install
|
|
|
|
- save_cache:
|
|
paths:
|
|
- newIDE/electron-app/node_modules
|
|
- newIDE/app/node_modules
|
|
- GDevelop.js/node_modules
|
|
key: gd-macos-nodejs-dependencies-{{ checksum "newIDE/app/package.json" }}-{{ checksum "newIDE/electron-app/package.json" }}-{{ checksum "GDevelop.js/package.json" }}
|
|
|
|
# Build GDevelop IDE (seems like we need to allow Node.js to use more space than usual)
|
|
# Note: Code signing is done using CSC_LINK (see https://www.electron.build/code-signing).
|
|
# To test signing the code in the CI, add "export CSC_FOR_PULL_REQUEST=true && " before the command.
|
|
- run:
|
|
name: Build GDevelop IDE
|
|
command: export CSC_FOR_PULL_REQUEST=true && export NODE_OPTIONS="--max-old-space-size=7168" && cd newIDE/electron-app && CI=false npm run build -- --mac --publish=never
|
|
|
|
- run:
|
|
name: Clean dist folder to keep only installers/binaries.
|
|
command: rm -rf "newIDE/electron-app/dist/mac-universal/GDevelop 5.app"
|
|
|
|
# Upload artifacts (CircleCI)
|
|
- store_artifacts:
|
|
path: newIDE/electron-app/dist
|
|
|
|
# Upload artifacts (AWS)
|
|
- run:
|
|
name: Deploy to S3 (specific commit)
|
|
command: export PATH=~/.local/bin:$PATH && aws s3 sync newIDE/electron-app/dist s3://gdevelop-releases/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/
|
|
- run:
|
|
name: Deploy to S3 (latest)
|
|
command: export PATH=~/.local/bin:$PATH && aws s3 sync newIDE/electron-app/dist s3://gdevelop-releases/$(git rev-parse --abbrev-ref HEAD)/latest/
|
|
|
|
# Build the **entire** app for Linux.
|
|
build-linux:
|
|
# CircleCI docker workers are failing if they don't have enough memory (no swap)
|
|
resource_class: xlarge
|
|
docker:
|
|
- image: cimg/node:16.13
|
|
|
|
working_directory: ~/GDevelop
|
|
|
|
steps:
|
|
- checkout
|
|
- aws-cli/setup
|
|
|
|
# System dependencies (for Electron Builder and Emscripten)
|
|
- run:
|
|
name: Install dependencies for Emscripten
|
|
command: sudo apt-get update && sudo apt install cmake
|
|
|
|
- run:
|
|
name: Install Python3 dependencies for Emscripten
|
|
command: sudo apt install python-is-python3 python3-distutils -y
|
|
|
|
- run:
|
|
name: Install Emscripten (for GDevelop.js)
|
|
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
|
|
|
|
- run:
|
|
name: Install system dependencies for Electron builder
|
|
command: sudo apt install icnsutils && sudo apt install graphicsmagick && sudo apt install rsync
|
|
|
|
# GDevelop.js dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- gd-linux-nodejs-dependencies-{{ checksum "newIDE/app/package.json" }}-{{ checksum "newIDE/electron-app/package.json" }}-{{ checksum "GDevelop.js/package.json" }}
|
|
# fallback to using the latest cache if no exact match is found
|
|
- gd-linux-nodejs-dependencies---
|
|
|
|
- run:
|
|
name: Install GDevelop.js dependencies and build it
|
|
command: cd GDevelop.js && npm install && cd ..
|
|
|
|
# Build GDevelop.js (and run tests to ensure it works)
|
|
- run:
|
|
name: Build GDevelop.js
|
|
# Use "--runInBand" as it's faster and avoid deadlocks on CircleCI Linux machines (probably because limited in processes number).
|
|
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test -- --runInBand && cd ..
|
|
|
|
# GDevelop IDE dependencies (after building GDevelop.js to avoid downloading a pre-built version)
|
|
- run:
|
|
name: Install GDevelop IDE dependencies
|
|
command: cd newIDE/app && npm install && cd ../electron-app && npm install
|
|
|
|
- save_cache:
|
|
paths:
|
|
- newIDE/electron-app/node_modules
|
|
- newIDE/app/node_modules
|
|
- GDevelop.js/node_modules
|
|
key: gd-linux-nodejs-dependencies-{{ checksum "newIDE/app/package.json" }}-{{ checksum "newIDE/electron-app/package.json" }}-{{ checksum "GDevelop.js/package.json" }}
|
|
|
|
# Build GDevelop IDE (seems like we need to allow Node.js to use more space than usual)
|
|
- run:
|
|
name: Build GDevelop IDE
|
|
command: export NODE_OPTIONS="--max-old-space-size=7168" && cd newIDE/electron-app && npm run build -- --linux --publish=never
|
|
|
|
- run:
|
|
name: Clean dist folder to keep only installers/binaries.
|
|
command: rm -rf newIDE/electron-app/dist/linux-unpacked && rm -rf newIDE/electron-app/dist/linux-arm64-unpacked
|
|
|
|
# Upload artifacts (CircleCI)
|
|
- store_artifacts:
|
|
path: newIDE/electron-app/dist
|
|
|
|
# Upload artifacts (AWS)
|
|
- run:
|
|
name: Deploy to S3 (specific commit)
|
|
command: aws s3 sync newIDE/electron-app/dist s3://gdevelop-releases/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/
|
|
- run:
|
|
name: Deploy to S3 (latest)
|
|
command: aws s3 sync newIDE/electron-app/dist s3://gdevelop-releases/$(git rev-parse --abbrev-ref HEAD)/latest/
|
|
|
|
# Build the WebAssembly library only (so that it's cached on a S3 and easy to re-use).
|
|
build-gdevelop_js-wasm-only:
|
|
docker:
|
|
- image: cimg/node:16.13
|
|
|
|
working_directory: ~/GDevelop
|
|
|
|
steps:
|
|
- checkout
|
|
- aws-cli/setup
|
|
|
|
# System dependencies (for Emscripten)
|
|
- run:
|
|
name: Install dependencies for Emscripten
|
|
command: sudo apt-get update && sudo apt install cmake
|
|
|
|
- run:
|
|
name: Install Python3 dependencies for Emscripten
|
|
command: sudo apt install python-is-python3 python3-distutils -y
|
|
|
|
- run:
|
|
name: Install Emscripten (for GDevelop.js)
|
|
command: git clone https://github.com/juj/emsdk.git && cd emsdk && ./emsdk install 3.1.21 && ./emsdk activate 3.1.21 && cd ..
|
|
|
|
# GDevelop.js dependencies
|
|
- restore_cache:
|
|
keys:
|
|
- gdevelop.js-linux-nodejs-dependencies-{{ checksum "GDevelop.js/package-lock.json" }}
|
|
# fallback to using the latest cache if no exact match is found
|
|
- gdevelop.js-linux-nodejs-dependencies-
|
|
|
|
- run:
|
|
name: Install GDevelop.js dependencies and build it
|
|
command: cd GDevelop.js && npm install && cd ..
|
|
|
|
# Build GDevelop.js (and run tests to ensure it works)
|
|
- run:
|
|
name: Build GDevelop.js
|
|
# Use "--runInBand" as it's faster and avoid deadlocks on CircleCI Linux machines (probably because limited in processes number).
|
|
command: cd GDevelop.js && source ../emsdk/emsdk_env.sh && npm run build && npm test -- --runInBand && cd ..
|
|
|
|
- save_cache:
|
|
paths:
|
|
- GDevelop.js/node_modules
|
|
key: gdevelop.js-linux-nodejs-dependencies-{{ checksum "GDevelop.js/package-lock.json" }}
|
|
|
|
# Upload artifacts (CircleCI)
|
|
- store_artifacts:
|
|
path: Binaries/embuild/GDevelop.js
|
|
|
|
# Upload artifacts (AWS)
|
|
- run:
|
|
name: Deploy to S3 (specific commit)
|
|
command: aws s3 sync Binaries/embuild/GDevelop.js s3://gdevelop-gdevelop.js/$(git rev-parse --abbrev-ref HEAD)/commit/$(git rev-parse HEAD)/
|
|
- run:
|
|
name: Deploy to S3 (latest)
|
|
command: aws s3 sync Binaries/embuild/GDevelop.js s3://gdevelop-gdevelop.js/$(git rev-parse --abbrev-ref HEAD)/latest/
|
|
|
|
workflows:
|
|
builds:
|
|
jobs:
|
|
- build-gdevelop_js-wasm-only
|
|
- build-macos:
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- /experimental-build.*/
|
|
- build-linux:
|
|
filters:
|
|
branches:
|
|
only:
|
|
- master
|
|
- /experimental-build.*/
|