Skip to content

Commit

Permalink
build: run on circle hosts for forks (#39865)
Browse files Browse the repository at this point in the history
Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Samuel Attard <samuel.r.attard@gmail.com>
  • Loading branch information
trop[bot] and MarshallOfSound committed Sep 14, 2023
1 parent a953199 commit 6132e80
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ jobs:
curl -fLSs https://raw.githubusercontent.com/CircleCI-Public/circleci-cli/master/install.sh | DESTDIR=$CIRCLECI_BINARY bash
node build.js
name: Pack config.yml
- run:
name: Set params
command: node .circleci/config/params.js
- continuation/continue:
configuration_path: .circleci/config-staging/built.yml
parameters: /tmp/pipeline-parameters.json
Expand Down
23 changes: 14 additions & 9 deletions .circleci/config/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ parameters:
type: enum
default: all
enum: ["all", "osx-x64", "osx-arm64", "mas-x64", "mas-arm64"]

large-linux-executor:
type: enum
default: electronjs/aks-linux-large
enum: ["electronjs/aks-linux-large", "2xlarge"]

# Executors
executors:
Expand All @@ -42,9 +47,9 @@ executors:
size:
description: "Docker executor size"
type: enum
# aks-linux-medium === 8 core (32 core host, shared with other builds)
# aks-linux-large === 32 core
enum: ["medium", "xlarge", "electronjs/aks-linux-medium", "electronjs/aks-linux-large"]
# 2xlarge should not be used directly, use the pipeline param instead
enum: ["medium", "xlarge", "electronjs/aks-linux-large", "2xlarge"]
docker:
- image: ghcr.io/electron/build:e6bebd08a51a0d78ec23e5b3fd7e7c0846412328
resource_class: << parameters.size >>
Expand Down Expand Up @@ -1589,7 +1594,7 @@ jobs:
linux-x64-testing:
executor:
name: linux-docker
size: electronjs/aks-linux-large
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-testing-build
Expand All @@ -1604,7 +1609,7 @@ jobs:
linux-x64-testing-asan:
executor:
name: linux-docker
size: electronjs/aks-linux-large
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-testing-build
Expand Down Expand Up @@ -1646,7 +1651,7 @@ jobs:
linux-x64-publish:
executor:
name: linux-docker
size: electronjs/aks-linux-large
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge-release
<<: *env-release-build
Expand All @@ -1668,7 +1673,7 @@ jobs:
linux-arm-testing:
executor:
name: linux-docker
size: electronjs/aks-linux-large
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-arm
Expand All @@ -1686,7 +1691,7 @@ jobs:
linux-arm-publish:
executor:
name: linux-docker
size: electronjs/aks-linux-large
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge-release
<<: *env-arm
Expand All @@ -1710,7 +1715,7 @@ jobs:
linux-arm64-testing:
executor:
name: linux-docker
size: electronjs/aks-linux-large
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-global
<<: *env-arm64
Expand Down Expand Up @@ -1739,7 +1744,7 @@ jobs:
linux-arm64-publish:
executor:
name: linux-docker
size: electronjs/aks-linux-large
size: << pipeline.parameters.large-linux-executor >>
environment:
<<: *env-linux-2xlarge-release
<<: *env-arm64
Expand Down
11 changes: 11 additions & 0 deletions .circleci/config/params.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
const fs = require('fs');

const PARAMS_PATH = '/tmp/pipeline-parameters.json';

const content = JSON.parse(fs.readFileSync(PARAMS_PATH, 'utf-8'));

// Choose resource class for linux hosts
const currentBranch = process.env.CIRCLE_BRANCH || '';
content['large-linux-executor'] = /^pull\/[0-9-]+$/.test(currentBranch) ? '2xlarge' : 'electronjs/aks-linux-large';

fs.writeFileSync(PARAMS_PATH, JSON.stringify(content));

0 comments on commit 6132e80

Please sign in to comment.