mirror of
https://github.com/denoland/deno.git
synced 2024-11-28 16:20:57 -05:00
ci: use non-XL runners more (#18675)
![image](https://user-images.githubusercontent.com/1609021/231593822-b9d7c9db-4416-4735-bd89-f28a260607f1.png) Non-xl runners are faster than the linux xl job, so let's use them for now Closes #17103
This commit is contained in:
parent
b3ff0eaee0
commit
dc37f414ee
2 changed files with 125 additions and 72 deletions
175
.github/workflows/ci.generate.ts
vendored
175
.github/workflows/ci.generate.ts
vendored
|
@ -2,14 +2,19 @@
|
|||
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
|
||||
import * as yaml from "https://deno.land/std@0.173.0/encoding/yaml.ts";
|
||||
|
||||
const windowsRunnerCondition =
|
||||
"github.repository == 'denoland/deno' && 'windows-2022-xl' || 'windows-2022'";
|
||||
const Runners = {
|
||||
linux:
|
||||
"${{ github.repository == 'denoland/deno' && 'ubuntu-22.04-xl' || 'ubuntu-22.04' }}",
|
||||
macos: "macos-12",
|
||||
windows: `\${{ ${windowsRunnerCondition} }}`,
|
||||
};
|
||||
const Runners = (() => {
|
||||
const ubuntuRunner = "ubuntu-22.04";
|
||||
const ubuntuXlRunner = "ubuntu-22.04-xl";
|
||||
|
||||
return {
|
||||
ubuntuXl:
|
||||
`\${{ github.repository == 'denoland/deno' && '${ubuntuXlRunner}' || '${ubuntuRunner}' }}`,
|
||||
ubuntu: ubuntuRunner,
|
||||
linux: ubuntuRunner,
|
||||
macos: "macos-12",
|
||||
windows: "windows-2022",
|
||||
};
|
||||
})();
|
||||
// bump the number at the start when you want to purge the cache
|
||||
const prCacheKeyPrefix =
|
||||
"18-cargo-target-${{ matrix.os }}-${{ matrix.profile }}-${{ matrix.job }}-";
|
||||
|
@ -184,6 +189,55 @@ function withCondition(
|
|||
};
|
||||
}
|
||||
|
||||
function removeSurroundingExpression(text: string) {
|
||||
if (text.startsWith("${{")) {
|
||||
return text.replace(/^\${{/, "").replace(/}}$/, "").trim();
|
||||
} else {
|
||||
return `'${text}'`;
|
||||
}
|
||||
}
|
||||
|
||||
function handleMatrixItems(items: {
|
||||
skip_pr?: string | true;
|
||||
os: string;
|
||||
profile?: string;
|
||||
job?: string;
|
||||
use_sysroot?: boolean;
|
||||
wpt?: string;
|
||||
}[]) {
|
||||
function getOsDisplayName(os: string) {
|
||||
if (os.includes("ubuntu")) {
|
||||
return "ubuntu-x86_64";
|
||||
} else if (os.includes("windows")) {
|
||||
return "windows-x86_64";
|
||||
} else if (os.includes("macos")) {
|
||||
return "macos-x86_64";
|
||||
} else {
|
||||
throw new Error(`Display name not found: ${os}`);
|
||||
}
|
||||
}
|
||||
|
||||
return items.map((item) => {
|
||||
// use a free "ubuntu" runner on jobs that are skipped on pull requests
|
||||
if (item.skip_pr != null) {
|
||||
let text = "${{ github.event_name == 'pull_request' && ";
|
||||
if (typeof item.skip_pr === "string") {
|
||||
text += removeSurroundingExpression(item.skip_pr.toString()) + " && ";
|
||||
}
|
||||
text += `'${Runners.ubuntu}' || ${
|
||||
removeSurroundingExpression(item.os)
|
||||
} }}`;
|
||||
|
||||
// deno-lint-ignore no-explicit-any
|
||||
(item as any).runner = text;
|
||||
}
|
||||
return {
|
||||
...item,
|
||||
os_display_name: getOsDisplayName(item.os),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const ci = {
|
||||
name: "ci",
|
||||
on: {
|
||||
|
@ -229,7 +283,8 @@ const ci = {
|
|||
]),
|
||||
},
|
||||
build: {
|
||||
name: "${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os }}",
|
||||
name:
|
||||
"${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os_display_name }}",
|
||||
needs: ["pre_build"],
|
||||
if: "${{ needs.pre_build.outputs.skip_build != 'true' }}",
|
||||
"runs-on": "${{ matrix.runner || matrix.os }}",
|
||||
|
@ -243,63 +298,51 @@ const ci = {
|
|||
},
|
||||
strategy: {
|
||||
matrix: {
|
||||
include: [
|
||||
{
|
||||
os: Runners.macos,
|
||||
job: "test",
|
||||
profile: "debug",
|
||||
},
|
||||
{
|
||||
os: Runners.macos,
|
||||
job: "test",
|
||||
profile: "release",
|
||||
skip_pr: true,
|
||||
},
|
||||
{
|
||||
os: Runners.windows,
|
||||
job: "test",
|
||||
profile: "debug",
|
||||
},
|
||||
{
|
||||
os: Runners.windows,
|
||||
// use a free runner on PRs since this will be skipped
|
||||
runner:
|
||||
`\${{ github.event_name == 'pull_request' && 'windows-2022' || (${windowsRunnerCondition}) }}`,
|
||||
job: "test",
|
||||
profile: "release",
|
||||
skip_pr: true,
|
||||
},
|
||||
{
|
||||
os: Runners.linux,
|
||||
job: "test",
|
||||
profile: "release",
|
||||
use_sysroot: true,
|
||||
// TODO(ry): Because CI is so slow on for OSX and Windows, we
|
||||
// currently run the Web Platform tests only on Linux.
|
||||
wpt: "${{ !startsWith(github.ref, 'refs/tags/') }}",
|
||||
},
|
||||
{
|
||||
os: Runners.linux,
|
||||
job: "bench",
|
||||
profile: "release",
|
||||
use_sysroot: true,
|
||||
skip_pr:
|
||||
"${{ !contains(github.event.pull_request.labels.*.name, 'ci-bench') }}",
|
||||
},
|
||||
{
|
||||
os: Runners.linux,
|
||||
job: "test",
|
||||
profile: "debug",
|
||||
use_sysroot: true,
|
||||
wpt:
|
||||
"${{ github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }}",
|
||||
},
|
||||
{
|
||||
os: Runners.linux,
|
||||
job: "lint",
|
||||
profile: "debug",
|
||||
},
|
||||
],
|
||||
include: handleMatrixItems([{
|
||||
os: Runners.macos,
|
||||
job: "test",
|
||||
profile: "debug",
|
||||
}, {
|
||||
os: Runners.macos,
|
||||
job: "test",
|
||||
profile: "release",
|
||||
skip_pr: true,
|
||||
}, {
|
||||
os: Runners.windows,
|
||||
job: "test",
|
||||
profile: "debug",
|
||||
}, {
|
||||
os: Runners.windows,
|
||||
job: "test",
|
||||
profile: "release",
|
||||
skip_pr: true,
|
||||
}, {
|
||||
os: Runners.ubuntuXl,
|
||||
job: "test",
|
||||
profile: "release",
|
||||
use_sysroot: true,
|
||||
// TODO(ry): Because CI is so slow on for OSX and Windows, we
|
||||
// currently run the Web Platform tests only on Linux.
|
||||
wpt: "${{ !startsWith(github.ref, 'refs/tags/') }}",
|
||||
}, {
|
||||
os: Runners.ubuntuXl,
|
||||
job: "bench",
|
||||
profile: "release",
|
||||
use_sysroot: true,
|
||||
skip_pr:
|
||||
"${{ !contains(github.event.pull_request.labels.*.name, 'ci-bench') }}",
|
||||
}, {
|
||||
os: Runners.ubuntu,
|
||||
job: "test",
|
||||
profile: "debug",
|
||||
use_sysroot: true,
|
||||
wpt:
|
||||
"${{ github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/') }}",
|
||||
}, {
|
||||
os: Runners.ubuntu,
|
||||
job: "lint",
|
||||
profile: "debug",
|
||||
}]),
|
||||
},
|
||||
// Always run main branch builds to completion. This allows the cache to
|
||||
// stay mostly up-to-date in situations where a single job fails due to
|
||||
|
|
22
.github/workflows/ci.yml
vendored
22
.github/workflows/ci.yml
vendored
|
@ -41,7 +41,7 @@ jobs:
|
|||
echo $GIT_MESSAGE | grep '\[ci\]' || (echo 'Exiting due to draft PR. Commit with [ci] to bypass.' ; echo 'skip_build=true' >> $GITHUB_OUTPUT)
|
||||
if: github.event.pull_request.draft == true
|
||||
build:
|
||||
name: '${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os }}'
|
||||
name: '${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os_display_name }}'
|
||||
needs:
|
||||
- pre_build
|
||||
if: '${{ needs.pre_build.outputs.skip_build != ''true'' }}'
|
||||
|
@ -56,36 +56,46 @@ jobs:
|
|||
- os: macos-12
|
||||
job: test
|
||||
profile: debug
|
||||
os_display_name: macos-x86_64
|
||||
- os: macos-12
|
||||
job: test
|
||||
profile: release
|
||||
skip_pr: true
|
||||
- os: '${{ github.repository == ''denoland/deno'' && ''windows-2022-xl'' || ''windows-2022'' }}'
|
||||
runner: '${{ github.event_name == ''pull_request'' && ''ubuntu-22.04'' || ''macos-12'' }}'
|
||||
os_display_name: macos-x86_64
|
||||
- os: windows-2022
|
||||
job: test
|
||||
profile: debug
|
||||
- os: '${{ github.repository == ''denoland/deno'' && ''windows-2022-xl'' || ''windows-2022'' }}'
|
||||
runner: '${{ github.event_name == ''pull_request'' && ''windows-2022'' || (github.repository == ''denoland/deno'' && ''windows-2022-xl'' || ''windows-2022'') }}'
|
||||
os_display_name: windows-x86_64
|
||||
- os: windows-2022
|
||||
job: test
|
||||
profile: release
|
||||
skip_pr: true
|
||||
runner: '${{ github.event_name == ''pull_request'' && ''ubuntu-22.04'' || ''windows-2022'' }}'
|
||||
os_display_name: windows-x86_64
|
||||
- os: '${{ github.repository == ''denoland/deno'' && ''ubuntu-22.04-xl'' || ''ubuntu-22.04'' }}'
|
||||
job: test
|
||||
profile: release
|
||||
use_sysroot: true
|
||||
wpt: '${{ !startsWith(github.ref, ''refs/tags/'') }}'
|
||||
os_display_name: ubuntu-x86_64
|
||||
- os: '${{ github.repository == ''denoland/deno'' && ''ubuntu-22.04-xl'' || ''ubuntu-22.04'' }}'
|
||||
job: bench
|
||||
profile: release
|
||||
use_sysroot: true
|
||||
skip_pr: '${{ !contains(github.event.pull_request.labels.*.name, ''ci-bench'') }}'
|
||||
- os: '${{ github.repository == ''denoland/deno'' && ''ubuntu-22.04-xl'' || ''ubuntu-22.04'' }}'
|
||||
runner: '${{ github.event_name == ''pull_request'' && !contains(github.event.pull_request.labels.*.name, ''ci-bench'') && ''ubuntu-22.04'' || github.repository == ''denoland/deno'' && ''ubuntu-22.04-xl'' || ''ubuntu-22.04'' }}'
|
||||
os_display_name: ubuntu-x86_64
|
||||
- os: ubuntu-22.04
|
||||
job: test
|
||||
profile: debug
|
||||
use_sysroot: true
|
||||
wpt: '${{ github.ref == ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'') }}'
|
||||
- os: '${{ github.repository == ''denoland/deno'' && ''ubuntu-22.04-xl'' || ''ubuntu-22.04'' }}'
|
||||
os_display_name: ubuntu-x86_64
|
||||
- os: ubuntu-22.04
|
||||
job: lint
|
||||
profile: debug
|
||||
os_display_name: ubuntu-x86_64
|
||||
fail-fast: '${{ github.event_name == ''pull_request'' || (github.ref != ''refs/heads/main'' && !startsWith(github.ref, ''refs/tags/'')) }}'
|
||||
env:
|
||||
CARGO_TERM_COLOR: always
|
||||
|
|
Loading…
Reference in a new issue