2023-01-10 19:16:11 -05:00
# ! / u s r / b i n / e n v - S d e n o r u n - - a l l o w - w r i t e = . - - l o c k = . / t o o l s / d e n o . l o c k . j s o n
2024-01-01 14:58:21 -05:00
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
2024-04-10 17:26:35 -04:00
import { stringify } from "jsr:@std/yaml@^0.221/stringify" ;
2023-01-10 19:16:11 -05:00
2023-05-30 17:09:07 -04:00
// Bump this number when you want to purge the cache.
// Note: the tools/release/01_bump_crate_versions.ts script will update this version
// automatically via regex, so ensure that this line maintains this format.
2024-11-28 12:00:24 -05:00
const cacheVersion = 28 ;
2023-05-30 17:09:07 -04:00
2024-11-01 06:43:02 -04:00
const ubuntuX86Runner = "ubuntu-24.04" ;
const ubuntuX86XlRunner = "ubuntu-24.04-xl" ;
2024-02-07 11:06:33 -05:00
const ubuntuARMRunner = "ubicloud-standard-16-arm" ;
2024-01-31 08:59:47 -05:00
const windowsX86Runner = "windows-2022" ;
const windowsX86XlRunner = "windows-2022-xl" ;
2024-04-02 17:46:05 -04:00
const macosX86Runner = "macos-13" ;
2024-01-31 08:59:47 -05:00
const macosArmRunner = "macos-14" ;
2024-11-04 18:56:09 -05:00
const selfHostedMacosArmRunner = "self-hosted" ;
2024-01-31 08:59:47 -05:00
const Runners = {
linuxX86 : {
os : "linux" ,
arch : "x86_64" ,
runner : ubuntuX86Runner ,
} ,
linuxX86Xl : {
os : "linux" ,
arch : "x86_64" ,
runner :
` \ ${ { github . repository == 'denoland/deno' && '${ubuntuX86XlRunner}' || '${ubuntuX86Runner}' } } ` ,
} ,
2024-02-07 11:06:33 -05:00
linuxArm : {
os : "linux" ,
arch : "aarch64" ,
runner : ubuntuARMRunner ,
} ,
2024-01-31 08:59:47 -05:00
macosX86 : {
os : "macos" ,
arch : "x86_64" ,
runner : macosX86Runner ,
} ,
macosArm : {
os : "macos" ,
arch : "aarch64" ,
2024-11-04 18:56:09 -05:00
runner :
` \ ${ { github . repository == 'denoland/deno' && startsWith ( github . ref , 'refs/tags/' ) && '${selfHostedMacosArmRunner}' || '${macosArmRunner}' } } ` ,
2024-01-31 08:59:47 -05:00
} ,
windowsX86 : {
os : "windows" ,
arch : "x86_64" ,
runner : windowsX86Runner ,
} ,
windowsX86Xl : {
os : "windows" ,
arch : "x86_64" ,
runner :
` \ ${ { github . repository == 'denoland/deno' && '${windowsX86XlRunner}' || '${windowsX86Runner}' } } ` ,
} ,
} as const ;
2023-04-13 05:44:39 -04:00
2023-03-16 13:42:31 -04:00
const prCacheKeyPrefix =
2024-01-31 08:59:47 -05:00
` ${ cacheVersion } -cargo-target- \ ${ { matrix . os } }- \ ${ { matrix . arch } }- \ ${ { matrix . profile } }- \ ${ { matrix . job } }- ` ;
2023-01-11 08:23:08 -05:00
2023-06-29 17:25:48 -04:00
// Note that you may need to add more version to the `apt-get remove` line below if you change this
2024-11-01 06:43:02 -04:00
const llvmVersion = 19 ;
2023-01-12 21:35:25 -05:00
const installPkgsCommand =
2024-04-12 11:10:07 -04:00
` sudo apt-get install --no-install-recommends clang- ${ llvmVersion } lld- ${ llvmVersion } clang-tools- ${ llvmVersion } clang-format- ${ llvmVersion } clang-tidy- ${ llvmVersion } ` ;
2023-01-11 08:23:08 -05:00
const sysRootStep = {
name : "Set up incremental LTO and sysroot build" ,
2024-02-07 18:17:21 -05:00
run : ` # Setting up sysroot
export DEBIAN_FRONTEND = noninteractive
# Avoid running man - db triggers , which sometimes takes several minutes
2023-01-11 08:23:08 -05:00
# to complete .
2024-02-07 18:17:21 -05:00
sudo apt - get - qq remove -- purge - y man - db > / d e v / n u l l 2 > / d e v / n u l l
2023-06-08 11:16:24 -04:00
# Remove older clang before we install
2024-02-07 18:17:21 -05:00
sudo apt - get - qq remove \
2024-11-01 06:43:02 -04:00
'clang-12*' 'clang-13*' 'clang-14*' 'clang-15*' 'clang-16*' 'clang-17*' 'clang-18*' 'llvm-12*' 'llvm-13*' 'llvm-14*' 'llvm-15*' 'llvm-16*' 'lld-12*' 'lld-13*' 'lld-14*' 'lld-15*' 'lld-16*' 'lld-17*' 'lld-18*' > / d e v / n u l l 2 > / d e v / n u l l
2023-01-11 08:23:08 -05:00
2023-06-29 17:25:48 -04:00
# Install clang - XXX , lld - XXX , and debootstrap .
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${llvmVersion} main" |
sudo dd of = / e t c / a p t / s o u r c e s . l i s t . d / l l v m - t o o l c h a i n - j a m m y - $ { l l v m V e r s i o n } . l i s t
2023-01-11 08:23:08 -05:00
curl https : //apt.llvm.org/llvm-snapshot.gpg.key |
gpg -- dearmor |
sudo dd of = / e t c / a p t / t r u s t e d . g p g . d / l l v m - s n a p s h o t . g p g
sudo apt - get update
2023-01-12 21:35:25 -05:00
# this was unreliable sometimes , so try again if it fails
$ { installPkgsCommand } || echo 'Failed. Trying again.' && sudo apt - get clean && sudo apt - get update && $ { installPkgsCommand }
2023-06-08 11:16:24 -04:00
# Fix alternatives
2024-02-07 21:54:21 -05:00
( yes '' | sudo update - alternatives -- force -- all ) > / d e v / n u l l 2 > / d e v / n u l l | | t r u e
2023-01-11 08:23:08 -05:00
2024-02-07 18:17:21 -05:00
echo "Decompressing sysroot..."
2024-11-01 06:43:02 -04:00
wget - q https : //github.com/denoland/deno_sysroot_build/releases/download/sysroot-20241030/sysroot-\`uname -m\`.tar.xz -O /tmp/sysroot.tar.xz
2024-02-07 18:17:21 -05:00
cd /
xzcat / tmp / sysroot . tar . xz | sudo tar - x
2023-01-11 08:23:08 -05:00
sudo mount -- rbind / dev / sysroot / dev
sudo mount -- rbind / sys / sysroot / sys
sudo mount -- rbind / home / sysroot / home
sudo mount - t proc / proc / sysroot / proc
2024-02-07 18:17:21 -05:00
cd
2023-01-11 08:23:08 -05:00
2024-05-15 11:18:17 -04:00
echo "Done."
2023-03-14 12:42:33 -04:00
2023-01-11 08:23:08 -05:00
# Configure the build environment . Both Rust and Clang will produce
# llvm bitcode only , so we can use lld ' s incremental LTO support .
2024-05-15 11:18:17 -04:00
# Load the sysroot ' s env vars
echo "sysroot env:"
cat / sysroot / . env
. / sysroot / . env
# Important notes :
# 1 . - ldl seems to be required to avoid a failure in FFI tests . This flag seems
# to be in the Rust default flags in the smoketest , so uncertain why we need
# to be explicit here .
# 2 . RUSTFLAGS and RUSTDOCFLAGS must be specified , otherwise the doctests fail
# to build because the object formats are not compatible .
echo "
2023-01-11 08:23:08 -05:00
CARGO_PROFILE_BENCH_INCREMENTAL = false
CARGO_PROFILE_BENCH_LTO = false
CARGO_PROFILE_RELEASE_INCREMENTAL = false
CARGO_PROFILE_RELEASE_LTO = false
RUSTFLAGS << __1
- C linker - plugin - lto = true
2023-06-29 17:25:48 -04:00
- C linker = clang - $ { llvmVersion }
- C link - arg = - fuse - ld = lld - $ { llvmVersion }
2023-03-14 12:42:33 -04:00
- C link - arg = - ldl
2023-01-11 08:23:08 -05:00
- C link - arg = - Wl , -- allow - shlib - undefined
- C link - arg = - Wl , -- thinlto - cache - dir = $ ( pwd ) / target / release / lto - cache
- C link - arg = - Wl , -- thinlto - cache - policy , cache_size_bytes = 700 m
2023-06-09 07:52:51 -04:00
-- cfg tokio_unstable
2024-05-15 11:18:17 -04:00
$RUSTFLAGS
2023-01-11 08:23:08 -05:00
__1
RUSTDOCFLAGS << __1
- C linker - plugin - lto = true
2023-06-29 17:25:48 -04:00
- C linker = clang - $ { llvmVersion }
- C link - arg = - fuse - ld = lld - $ { llvmVersion }
2023-03-14 12:42:33 -04:00
- C link - arg = - ldl
2023-01-11 08:23:08 -05:00
- C link - arg = - Wl , -- allow - shlib - undefined
- C link - arg = - Wl , -- thinlto - cache - dir = $ ( pwd ) / target / release / lto - cache
- C link - arg = - Wl , -- thinlto - cache - policy , cache_size_bytes = 700 m
2024-05-15 11:18:17 -04:00
-- cfg tokio_unstable
$RUSTFLAGS
2023-01-11 08:23:08 -05:00
__1
2024-04-12 11:10:07 -04:00
CC = / u s r / b i n / c l a n g - $ { l l v m V e r s i o n }
2024-05-15 11:18:17 -04:00
CFLAGS = - flto = thin $CFLAGS
" > $GITHUB_ENV ` ,
2023-01-11 08:23:08 -05:00
} ;
2023-08-19 00:26:12 -04:00
const installBenchTools = "./tools/install_prebuilt.js wrk hyperfine" ;
2023-04-08 09:27:21 -04:00
const cloneRepoStep = [ {
name : "Configure git" ,
run : [
"git config --global core.symlinks true" ,
"git config --global fetch.parallel 32" ,
] . join ( "\n" ) ,
} , {
name : "Clone repository" ,
2024-02-06 16:47:44 -05:00
uses : "actions/checkout@v4" ,
2023-04-08 09:27:21 -04:00
with : {
// Use depth > 1, because sometimes we need to rebuild main and if
// other commits have landed it will become impossible to rebuild if
// the checkout is too shallow.
2024-09-19 09:54:59 -04:00
"fetch-depth" : 5 ,
2023-04-08 09:27:21 -04:00
submodules : false ,
} ,
} ] ;
2023-01-11 08:23:08 -05:00
const submoduleStep = ( submodule : string ) = > ( {
name : ` Clone submodule ${ submodule } ` ,
run : ` git submodule update --init --recursive --depth=1 -- ${ submodule } ` ,
} ) ;
const installRustStep = {
2023-03-09 17:01:41 -05:00
uses : "dsherret/rust-toolchain-file@v1" ,
2023-01-11 08:23:08 -05:00
} ;
const installPythonSteps = [ {
name : "Install Python" ,
2024-02-08 13:03:36 -05:00
uses : "actions/setup-python@v5" ,
2023-01-26 06:22:32 -05:00
with : { "python-version" : 3.11 } ,
2023-01-11 08:23:08 -05:00
} , {
name : "Remove unused versions of Python" ,
2024-01-31 08:59:47 -05:00
if : "matrix.os == 'windows'" ,
2023-01-11 13:44:11 -05:00
shell : "pwsh" ,
2023-01-11 08:23:08 -05:00
run : [
'$env:PATH -split ";" |' ,
' Where-Object { Test-Path "$_\\python.exe" } |' ,
" Select-Object -Skip 1 |" ,
' ForEach-Object { Move-Item "$_" "$_.disabled" }' ,
] . join ( "\n" ) ,
} ] ;
const installNodeStep = {
name : "Install Node" ,
2024-02-08 13:03:36 -05:00
uses : "actions/setup-node@v4" ,
2023-01-11 18:30:38 -05:00
with : { "node-version" : 18 } ,
2023-01-11 08:23:08 -05:00
} ;
const installDenoStep = {
name : "Install Deno" ,
2024-10-22 11:24:27 -04:00
uses : "denoland/setup-deno@v2" ,
2023-01-11 08:23:08 -05:00
with : { "deno-version" : "v1.x" } ,
} ;
2023-01-12 10:19:35 -05:00
const authenticateWithGoogleCloud = {
name : "Authenticate with Google Cloud" ,
2024-03-20 13:40:29 -04:00
uses : "google-github-actions/auth@v2" ,
2023-01-12 10:19:35 -05:00
with : {
"project_id" : "denoland" ,
"credentials_json" : "${{ secrets.GCP_SA_KEY }}" ,
"export_environment_variables" : true ,
"create_credentials_file" : true ,
} ,
} ;
2023-01-11 19:49:18 -05:00
function skipJobsIfPrAndMarkedSkip (
steps : Record < string , unknown > [ ] ,
) : Record < string , unknown > [ ] {
// GitHub does not make skipping a specific matrix element easy
// so just apply this condition to all the steps.
// https://stackoverflow.com/questions/65384420/how-to-make-a-github-action-matrix-element-conditional
return steps . map ( ( s ) = >
2023-01-12 12:07:37 -05:00
withCondition (
2023-01-11 19:49:18 -05:00
s ,
2023-11-19 18:11:20 -05:00
"!(matrix.skip)" ,
2023-01-11 19:49:18 -05:00
)
) ;
}
2023-04-08 09:27:21 -04:00
function onlyIfDraftPr (
steps : Record < string , unknown > [ ] ,
) : Record < string , unknown > [ ] {
return steps . map ( ( s ) = >
withCondition (
s ,
"github.event.pull_request.draft == true" ,
)
) ;
}
2023-01-12 12:07:37 -05:00
function withCondition (
2023-01-11 19:49:18 -05:00
step : Record < string , unknown > ,
condition : string ,
) : Record < string , unknown > {
return {
. . . step ,
if : "if" in step ? ` ${ condition } && ( ${ step . if } ) ` : condition ,
} ;
}
2023-04-13 05:44:39 -04:00
function removeSurroundingExpression ( text : string ) {
if ( text . startsWith ( "${{" ) ) {
return text . replace ( /^\${{/ , "" ) . replace ( /}}$/ , "" ) . trim ( ) ;
} else {
return ` ' ${ text } ' ` ;
}
}
function handleMatrixItems ( items : {
skip_pr? : string | true ;
2023-11-19 18:11:20 -05:00
skip? : string ;
2024-01-31 08:59:47 -05:00
os : "linux" | "macos" | "windows" ;
arch : "x86_64" | "aarch64" ;
runner : string ;
2023-04-13 05:44:39 -04:00
profile? : string ;
job? : string ;
use_sysroot? : boolean ;
wpt? : string ;
} [ ] ) {
return items . map ( ( item ) = > {
2023-11-19 18:11:20 -05:00
// use a free "ubuntu" runner on jobs that are skipped
// skip_pr is shorthand for skip = github.event_name == 'pull_request'.
2023-04-13 05:44:39 -04:00
if ( item . skip_pr != null ) {
2023-11-19 18:11:20 -05:00
if ( item . skip_pr === true ) {
item . skip = "${{ github.event_name == 'pull_request' }}" ;
} else if ( typeof item . skip_pr === "string" ) {
item . skip = "${{ github.event_name == 'pull_request' && " +
removeSurroundingExpression ( item . skip_pr . toString ( ) ) + " }}" ;
2023-04-13 05:44:39 -04:00
}
2023-11-19 18:11:20 -05:00
delete item . skip_pr ;
}
if ( typeof item . skip === "string" ) {
2024-01-31 08:59:47 -05:00
let runner =
2023-11-23 17:30:26 -05:00
"${{ (!contains(github.event.pull_request.labels.*.name, 'ci-full') && (" ;
2024-01-31 08:59:47 -05:00
runner += removeSurroundingExpression ( item . skip . toString ( ) ) + ")) && " ;
runner += ` ' ${ ubuntuX86Runner } ' || ${
removeSurroundingExpression ( item . runner )
2023-04-13 05:44:39 -04:00
} } } ` ;
// deno-lint-ignore no-explicit-any
2024-01-31 08:59:47 -05:00
( item as any ) . runner = runner ;
2023-11-23 17:30:26 -05:00
item . skip =
"${{ !contains(github.event.pull_request.labels.*.name, 'ci-full') && (" +
removeSurroundingExpression ( item . skip . toString ( ) ) + ") }}" ;
2023-04-13 05:44:39 -04:00
}
2023-11-19 18:11:20 -05:00
2024-01-31 08:59:47 -05:00
return { . . . item } ;
2023-04-13 05:44:39 -04:00
} ) ;
}
2023-01-10 19:16:11 -05:00
const ci = {
name : "ci" ,
2024-03-01 11:11:32 -05:00
permissions : {
contents : "write" ,
} ,
2023-01-11 13:44:11 -05:00
on : {
push : {
branches : [ "main" ] ,
tags : [ "*" ] ,
} ,
pull_request : {
types : [
"opened" ,
"reopened" ,
"synchronize" ,
// need to re-run the action when converting from draft because
// draft PRs will not necessarily run all the steps
"ready_for_review" ,
] ,
} ,
} ,
2023-01-10 19:16:11 -05:00
concurrency : {
group :
2023-01-12 15:45:41 -05:00
"${{ github.workflow }}-${{ !contains(github.event.pull_request.labels.*.name, 'ci-test-flaky') && github.head_ref || github.run_id }}" ,
2023-01-10 19:16:11 -05:00
"cancel-in-progress" : true ,
} ,
jobs : {
2023-04-08 09:27:21 -04:00
// The pre_build step is used to skip running the CI on draft PRs and to not even
// start the build job. This can be overridden by adding [ci] to the commit title
pre_build : {
name : "pre-build" ,
"runs-on" : "ubuntu-latest" ,
outputs : {
skip_build : "${{ steps.check.outputs.skip_build }}" ,
} ,
steps : onlyIfDraftPr ( [
. . . cloneRepoStep ,
{
id : "check" ,
2024-06-04 20:51:27 -04:00
if : "!contains(github.event.pull_request.labels.*.name, 'ci-draft')" ,
2023-04-08 09:27:21 -04:00
run : [
"GIT_MESSAGE=$(git log --format=%s -n 1 ${{github.event.after}})" ,
"echo Commit message: $GIT_MESSAGE" ,
2024-06-04 20:51:27 -04:00
"echo $GIT_MESSAGE | grep '\\[ci\\]' || (echo 'Exiting due to draft PR. Commit with [ci] to bypass or add the ci-draft label.' ; echo 'skip_build=true' >> $GITHUB_OUTPUT)" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
} ,
] ) ,
} ,
2023-01-10 19:16:11 -05:00
build : {
2023-04-13 05:44:39 -04:00
name :
2024-01-31 08:59:47 -05:00
"${{ matrix.job }} ${{ matrix.profile }} ${{ matrix.os }}-${{ matrix.arch }}" ,
2023-04-08 09:27:21 -04:00
needs : [ "pre_build" ] ,
if : "${{ needs.pre_build.outputs.skip_build != 'true' }}" ,
2024-01-31 08:59:47 -05:00
"runs-on" : "${{ matrix.runner }}" ,
2024-09-19 20:05:20 -04:00
"timeout-minutes" : 180 ,
2023-03-24 12:00:47 -04:00
defaults : {
run : {
2023-04-08 09:27:21 -04:00
// GH actions does not fail fast by default on
// Windows, so we set bash as the default shell
2023-03-24 12:00:47 -04:00
shell : "bash" ,
} ,
} ,
2023-01-10 19:16:11 -05:00
strategy : {
matrix : {
2023-04-13 05:44:39 -04:00
include : handleMatrixItems ( [ {
2024-01-31 08:59:47 -05:00
. . . Runners . macosX86 ,
2023-04-13 05:44:39 -04:00
job : "test" ,
profile : "debug" ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . macosX86 ,
2023-04-13 05:44:39 -04:00
job : "test" ,
profile : "release" ,
skip_pr : true ,
2023-11-19 18:11:20 -05:00
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . macosArm ,
job : "test" ,
profile : "debug" ,
} , {
2024-09-28 16:57:01 -04:00
. . . Runners . macosArm ,
2023-11-19 18:11:20 -05:00
job : "test" ,
profile : "release" ,
2024-01-31 08:59:47 -05:00
skip_pr : true ,
2023-04-13 05:44:39 -04:00
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . windowsX86 ,
2023-04-13 05:44:39 -04:00
job : "test" ,
profile : "debug" ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . windowsX86Xl ,
2023-04-13 05:44:39 -04:00
job : "test" ,
profile : "release" ,
skip_pr : true ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . linuxX86Xl ,
2023-04-13 05:44:39 -04:00
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/') }}" ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . linuxX86Xl ,
2023-04-13 05:44:39 -04:00
job : "bench" ,
profile : "release" ,
use_sysroot : true ,
skip_pr :
"${{ !contains(github.event.pull_request.labels.*.name, 'ci-bench') }}" ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . linuxX86 ,
2023-04-13 05:44:39 -04:00
job : "test" ,
profile : "debug" ,
use_sysroot : true ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . linuxX86 ,
2023-04-13 05:44:39 -04:00
job : "lint" ,
profile : "debug" ,
2024-02-07 11:06:33 -05:00
} , {
2024-02-08 13:51:37 -05:00
. . . Runners . linuxArm ,
job : "test" ,
profile : "debug" ,
} , {
. . . Runners . linuxArm ,
job : "test" ,
profile : "release" ,
use_sysroot : true ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . macosX86 ,
2023-08-01 16:08:41 -04:00
job : "lint" ,
profile : "debug" ,
} , {
2024-01-31 08:59:47 -05:00
. . . Runners . windowsX86 ,
2023-08-01 16:08:41 -04:00
job : "lint" ,
profile : "debug" ,
2023-04-13 05:44:39 -04:00
} ] ) ,
2023-01-10 19:16:11 -05:00
} ,
// 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
// e.g. a flaky test.
// Don't fast-fail on tag build because publishing binaries shouldn't be
// prevented if any of the stages fail (which can be a false negative).
"fail-fast" :
"${{ github.event_name == 'pull_request' || (github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')) }}" ,
} ,
env : {
CARGO_TERM_COLOR : "always" ,
RUST_BACKTRACE : "full" ,
2024-01-09 18:20:52 -05:00
// disable anyhow's library backtrace
RUST_LIB_BACKTRACE : 0 ,
2023-01-10 19:16:11 -05:00
} ,
2023-01-11 19:49:18 -05:00
steps : skipJobsIfPrAndMarkedSkip ( [
2023-04-08 09:27:21 -04:00
. . . cloneRepoStep ,
2024-02-13 11:22:49 -05:00
submoduleStep ( "./tests/util/std" ) ,
2023-01-10 19:16:11 -05:00
{
2024-02-15 22:32:28 -05:00
. . . submoduleStep ( "./tests/wpt/suite" ) ,
2023-04-08 09:27:21 -04:00
if : "matrix.wpt" ,
} ,
2023-05-15 08:22:53 -04:00
{
2024-04-02 18:24:55 -04:00
. . . submoduleStep ( "./tests/node_compat/runner/suite" ) ,
2024-01-31 08:59:47 -05:00
if : "matrix.job == 'lint' && matrix.os == 'linux'" ,
2023-05-15 08:22:53 -04:00
} ,
2024-04-16 17:13:48 -04:00
{
. . . submoduleStep ( "./cli/bench/testdata/lsp_benchdata" ) ,
if : "matrix.job == 'bench'" ,
} ,
2023-04-08 09:27:21 -04:00
{
name : "Create source tarballs (release, linux)" ,
if : [
2024-01-31 08:59:47 -05:00
"matrix.os == 'linux' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.profile == 'release' &&" ,
"matrix.job == 'test' &&" ,
"github.repository == 'denoland/deno' &&" ,
"startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
2023-01-10 19:16:11 -05:00
run : [
2023-04-08 09:27:21 -04:00
"mkdir -p target/release" ,
'tar --exclude=".git*" --exclude=target --exclude=third_party/prebuilt \\' ,
" -czvf target/release/deno_src.tar.gz -C .. deno" ,
] . join ( "\n" ) ,
} ,
installRustStep ,
{
2023-08-20 11:43:50 -04:00
if :
"matrix.job == 'lint' || matrix.job == 'test' || matrix.job == 'bench'" ,
2023-04-08 09:27:21 -04:00
. . . installDenoStep ,
} ,
. . . installPythonSteps . map ( ( s ) = >
2024-02-07 11:06:33 -05:00
withCondition (
s ,
"matrix.job != 'lint' && (matrix.os != 'linux' || matrix.arch != 'aarch64')" ,
)
2023-04-08 09:27:21 -04:00
) ,
{
2024-05-06 21:06:01 -04:00
if : "matrix.job == 'bench' || matrix.job == 'test'" ,
2023-04-08 09:27:21 -04:00
. . . installNodeStep ,
} ,
{
if : [
"matrix.profile == 'release' &&" ,
"matrix.job == 'test' &&" ,
"github.repository == 'denoland/deno' &&" ,
"(github.ref == 'refs/heads/main' ||" ,
"startsWith(github.ref, 'refs/tags/'))" ,
2023-01-10 19:16:11 -05:00
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
. . . authenticateWithGoogleCloud ,
2023-01-10 19:16:11 -05:00
} ,
{
2023-04-08 09:27:21 -04:00
name : "Setup gcloud (unix)" ,
if : [
2024-01-31 10:09:17 -05:00
"matrix.os != 'windows' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.profile == 'release' &&" ,
"matrix.job == 'test' &&" ,
"github.repository == 'denoland/deno' &&" ,
"(github.ref == 'refs/heads/main' ||" ,
"startsWith(github.ref, 'refs/tags/'))" ,
] . join ( "\n" ) ,
2024-03-20 13:40:29 -04:00
uses : "google-github-actions/setup-gcloud@v2" ,
2023-01-10 19:16:11 -05:00
with : {
2023-04-08 09:27:21 -04:00
project_id : "denoland" ,
2023-01-10 19:16:11 -05:00
} ,
} ,
2023-04-08 09:27:21 -04:00
{
name : "Setup gcloud (windows)" ,
if : [
2024-01-31 08:59:47 -05:00
"matrix.os == 'windows' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.profile == 'release' &&" ,
"matrix.job == 'test' &&" ,
"github.repository == 'denoland/deno' &&" ,
"(github.ref == 'refs/heads/main' ||" ,
"startsWith(github.ref, 'refs/tags/'))" ,
] . join ( "\n" ) ,
2024-03-20 13:40:29 -04:00
uses : "google-github-actions/setup-gcloud@v2" ,
2023-04-08 09:27:21 -04:00
env : {
CLOUDSDK_PYTHON : "${{env.pythonLocation}}\\python.exe" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
with : {
project_id : "denoland" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "Configure canary build" ,
if : [
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"github.ref == 'refs/heads/main'" ,
] . join ( "\n" ) ,
run : 'echo "DENO_CANARY=true" >> $GITHUB_ENV' ,
} ,
{
if : "matrix.use_sysroot" ,
. . . sysRootStep ,
} ,
2024-04-03 20:02:57 -04:00
{
name : "Remove macOS cURL --ipv4 flag" ,
run : [
// cURL's --ipv4 flag is busted for now
"curl --version" ,
"which curl" ,
"cat /etc/hosts" ,
"rm ~/.curlrc || true" ,
] . join ( "\n" ) ,
if : ` matrix.os == 'macos' ` ,
} ,
2023-11-19 18:11:20 -05:00
{
2024-01-31 08:59:47 -05:00
name : "Install macOS aarch64 lld" ,
2023-11-19 18:11:20 -05:00
run : [
"./tools/install_prebuilt.js ld64.lld" ,
] . join ( "\n" ) ,
2024-01-31 08:59:47 -05:00
if : ` matrix.os == 'macos' && matrix.arch == 'aarch64' ` ,
2023-11-19 18:11:20 -05:00
} ,
2023-11-23 17:30:26 -05:00
{
name : "Install rust-codesign" ,
run : [
"./tools/install_prebuilt.js rcodesign" ,
"echo $GITHUB_WORKSPACE/third_party/prebuilt/mac >> $GITHUB_PATH" ,
] . join ( "\n" ) ,
2024-01-31 08:59:47 -05:00
if : ` matrix.os == 'macos' ` ,
2023-11-23 17:30:26 -05:00
} ,
2023-04-08 09:27:21 -04:00
{
name : "Log versions" ,
run : [
2024-02-08 13:51:37 -05:00
"echo '*** Python'" ,
"command -v python && python --version || echo 'No python found or bad executable'" ,
"echo '*** Rust'" ,
"command -v rustc && rustc --version || echo 'No rustc found or bad executable'" ,
"echo '*** Cargo'" ,
"command -v cargo && cargo --version || echo 'No cargo found or bad executable'" ,
"echo '*** Deno'" ,
"command -v deno && deno --version || echo 'No deno found or bad executable'" ,
"echo '*** Node'" ,
"command -v node && node --version || echo 'No node found or bad executable'" ,
"echo '*** Installed packages'" ,
"command -v dpkg && dpkg -l || echo 'No dpkg found or bad executable'" ,
] . join ( "\n" ) ,
} ,
{
name : "Install benchmark tools" ,
if : "matrix.job == 'bench'" ,
run : [
installBenchTools ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
} ,
{
name : "Cache Cargo home" ,
2024-02-06 16:47:44 -05:00
uses : "actions/cache@v4" ,
2023-04-08 09:27:21 -04:00
with : {
// See https://doc.rust-lang.org/cargo/guide/cargo-home.html#caching-the-cargo-home-in-ci
2023-06-12 17:59:34 -04:00
// Note that with the new sparse registry format, we no longer have to cache a `.git` dir
2023-04-08 09:27:21 -04:00
path : [
"~/.cargo/registry/index" ,
"~/.cargo/registry/cache" ,
2023-01-12 19:56:19 -05:00
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
key :
2024-01-31 08:59:47 -05:00
` ${ cacheVersion } -cargo-home- \ ${ { matrix . os } }- \ ${ { matrix . arch } }- \ ${ { hashFiles ( 'Cargo.lock' ) } } ` ,
2023-06-12 17:59:34 -04:00
// We will try to restore from the closest cargo-home we can find
2024-01-31 08:59:47 -05:00
"restore-keys" :
` ${ cacheVersion } -cargo-home- \ ${ { matrix . os } }- \ ${ { matrix . arch } } ` ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
} ,
{
// Restore cache from the latest 'main' branch build.
name : "Restore cache build output (PR)" ,
2024-02-08 13:03:36 -05:00
uses : "actions/cache/restore@v4" ,
2023-04-08 09:27:21 -04:00
if :
"github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')" ,
with : {
path : [
"./target" ,
"!./target/*/gn_out" ,
2024-07-15 12:56:51 -04:00
"!./target/*/gn_root" ,
2023-04-08 09:27:21 -04:00
"!./target/*/*.zip" ,
"!./target/*/*.tar.gz" ,
2023-01-11 13:44:11 -05:00
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
key : "never_saved" ,
"restore-keys" : prCacheKeyPrefix ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "Apply and update mtime cache" ,
if : "!startsWith(github.ref, 'refs/tags/')" ,
uses : "./.github/mtime_cache" ,
with : {
"cache-path" : "./target" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "test_format.js" ,
2024-01-31 08:59:47 -05:00
if : "matrix.job == 'lint' && matrix.os == 'linux'" ,
2023-04-08 09:27:21 -04:00
run :
2024-09-09 21:10:20 -04:00
"deno run --allow-write --allow-read --allow-run --allow-net ./tools/format.js --check" ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "Lint PR title" ,
2023-08-01 16:08:41 -04:00
if :
2024-01-31 08:59:47 -05:00
"matrix.job == 'lint' && github.event_name == 'pull_request' && matrix.os == 'linux'" ,
2023-04-08 09:27:21 -04:00
env : {
PR_TITLE : "${{ github.event.pull_request.title }}" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
run : 'deno run ./tools/verify_pr_title.js "$PR_TITLE"' ,
} ,
{
name : "lint.js" ,
if : "matrix.job == 'lint'" ,
run :
2024-09-09 21:10:20 -04:00
"deno run --allow-write --allow-read --allow-run --allow-net ./tools/lint.js" ,
2023-04-08 09:27:21 -04:00
} ,
2024-04-26 12:04:29 -04:00
{
name : "jsdoc_checker.js" ,
if : "matrix.job == 'lint'" ,
run :
"deno run --allow-read --allow-env --allow-sys ./tools/jsdoc_checker.js" ,
} ,
2023-05-15 08:22:53 -04:00
{
name : "node_compat/setup.ts --check" ,
2024-01-31 08:59:47 -05:00
if : "matrix.job == 'lint' && matrix.os == 'linux'" ,
2023-05-15 08:22:53 -04:00
run :
2024-04-02 18:24:55 -04:00
"deno run --allow-write --allow-read --allow-run=git ./tests/node_compat/runner/setup.ts --check" ,
2023-05-15 08:22:53 -04:00
} ,
2023-04-08 09:27:21 -04:00
{
name : "Build debug" ,
if : "matrix.job == 'test' && matrix.profile == 'debug'" ,
2023-06-07 17:57:36 -04:00
run : [
// output fs space before and after building
"df -h" ,
"cargo build --locked --all-targets" ,
"df -h" ,
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
env : { CARGO_PROFILE_DEV_DEBUG : 0 } ,
} ,
2024-06-12 13:02:54 -04:00
// Uncomment for remote debugging
// {
// name: "Setup tmate session",
// if: [
// "(matrix.job == 'test' || matrix.job == 'bench') &&",
// "matrix.profile == 'release' && (matrix.use_sysroot ||",
// "github.repository == 'denoland/deno')",
// ].join("\n"),
// uses: "mxschmitt/action-tmate@v3",
// },
2023-04-08 09:27:21 -04:00
{
name : "Build release" ,
if : [
"(matrix.job == 'test' || matrix.job == 'bench') &&" ,
"matrix.profile == 'release' && (matrix.use_sysroot ||" ,
2023-11-19 18:11:20 -05:00
"github.repository == 'denoland/deno')" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
2023-06-07 22:04:07 -04:00
run : [
// output fs space before and after building
"df -h" ,
"cargo build --release --locked --all-targets" ,
"df -h" ,
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
} ,
2024-05-15 11:18:17 -04:00
{
// Run a minimal check to ensure that binary is not corrupted, regardless
// of our build mode
name : "Check deno binary" ,
if : "matrix.job == 'test'" ,
run :
'target/${{ matrix.profile }}/deno eval "console.log(1+2)" | grep 3' ,
env : {
NO_COLOR : 1 ,
} ,
} ,
{
// Verify that the binary actually works in the Ubuntu-16.04 sysroot.
name : "Check deno binary (in sysroot)" ,
if : "matrix.job == 'test' && matrix.use_sysroot" ,
run :
'sudo chroot /sysroot "$(pwd)/target/${{ matrix.profile }}/deno" --version' ,
} ,
2023-04-08 09:27:21 -04:00
{
name : "Upload PR artifact (linux)" ,
if : [
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' && (matrix.use_sysroot ||" ,
"(github.repository == 'denoland/deno' &&" ,
"(github.ref == 'refs/heads/main' ||" ,
"startsWith(github.ref, 'refs/tags/'))))" ,
] . join ( "\n" ) ,
2024-02-07 18:17:21 -05:00
uses : "actions/upload-artifact@v4" ,
2023-04-08 09:27:21 -04:00
with : {
2024-02-07 18:17:21 -05:00
name :
"deno-${{ matrix.os }}-${{ matrix.arch }}-${{ github.event.number }}" ,
2023-04-08 09:27:21 -04:00
path : "target/release/deno" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "Pre-release (linux)" ,
if : [
2024-01-31 08:59:47 -05:00
"matrix.os == 'linux' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno'" ,
] . join ( "\n" ) ,
run : [
"cd target/release" ,
2024-01-31 08:59:47 -05:00
"zip -r deno-${{ matrix.arch }}-unknown-linux-gnu.zip deno" ,
2024-10-14 08:46:26 -04:00
"shasum -a 256 deno-${{ matrix.arch }}-unknown-linux-gnu.zip > deno-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum" ,
2024-02-21 07:15:50 -05:00
"strip denort" ,
2024-02-13 11:22:30 -05:00
"zip -r denort-${{ matrix.arch }}-unknown-linux-gnu.zip denort" ,
2024-10-14 08:46:26 -04:00
"shasum -a 256 denort-${{ matrix.arch }}-unknown-linux-gnu.zip > denort-${{ matrix.arch }}-unknown-linux-gnu.zip.sha256sum" ,
2023-04-08 09:27:21 -04:00
"./deno types > lib.deno.d.ts" ,
] . join ( "\n" ) ,
} ,
{
2024-01-31 08:59:47 -05:00
name : "Pre-release (mac)" ,
2023-04-08 09:27:21 -04:00
if : [
2024-01-31 08:59:47 -05:00
` matrix.os == 'macos' && ` ,
2023-04-08 09:27:21 -04:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
2023-11-19 18:11:20 -05:00
"github.repository == 'denoland/deno'" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
2023-11-23 17:30:26 -05:00
env : {
"APPLE_CODESIGN_KEY" : "${{ secrets.APPLE_CODESIGN_KEY }}" ,
"APPLE_CODESIGN_PASSWORD" : "${{ secrets.APPLE_CODESIGN_PASSWORD }}" ,
} ,
2023-04-08 09:27:21 -04:00
run : [
2023-11-23 17:30:26 -05:00
'echo "Key is $(echo $APPLE_CODESIGN_KEY | base64 -d | wc -c) bytes"' ,
"rcodesign sign target/release/deno " +
"--code-signature-flags=runtime " +
'--p12-password="$APPLE_CODESIGN_PASSWORD" ' +
"--p12-file=<(echo $APPLE_CODESIGN_KEY | base64 -d) " +
"--entitlements-xml-file=cli/entitlements.plist" ,
2023-04-08 09:27:21 -04:00
"cd target/release" ,
2024-01-31 08:59:47 -05:00
"zip -r deno-${{ matrix.arch }}-apple-darwin.zip deno" ,
2024-10-14 08:46:26 -04:00
"shasum -a 256 deno-${{ matrix.arch }}-apple-darwin.zip > deno-${{ matrix.arch }}-apple-darwin.zip.sha256sum" ,
2024-02-21 07:15:50 -05:00
"strip denort" ,
2024-02-13 11:22:30 -05:00
"zip -r denort-${{ matrix.arch }}-apple-darwin.zip denort" ,
2024-10-14 08:46:26 -04:00
"shasum -a 256 denort-${{ matrix.arch }}-apple-darwin.zip > denort-${{ matrix.arch }}-apple-darwin.zip.sha256sum" ,
2023-11-19 18:11:20 -05:00
]
. join ( "\n" ) ,
} ,
2023-04-08 09:27:21 -04:00
{
name : "Pre-release (windows)" ,
if : [
2024-01-31 08:59:47 -05:00
"matrix.os == 'windows' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
2023-11-19 18:11:20 -05:00
"github.repository == 'denoland/deno'" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
shell : "pwsh" ,
2024-02-13 11:22:30 -05:00
run : [
2024-01-31 08:59:47 -05:00
"Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip" ,
2024-10-14 08:46:26 -04:00
"Get-FileHash target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/deno-${{ matrix.arch }}-pc-windows-msvc.zip.sha256sum" ,
2024-02-13 11:22:30 -05:00
"Compress-Archive -CompressionLevel Optimal -Force -Path target/release/denort.exe -DestinationPath target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip" ,
2024-10-14 08:46:26 -04:00
"Get-FileHash target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip -Algorithm SHA256 | Format-List > target/release/denort-${{ matrix.arch }}-pc-windows-msvc.zip.sha256sum" ,
2024-02-13 11:22:30 -05:00
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
} ,
{
2024-01-30 14:50:54 -05:00
name : "Upload canary to dl.deno.land" ,
2023-04-08 09:27:21 -04:00
if : [
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"github.ref == 'refs/heads/main'" ,
] . join ( "\n" ) ,
2024-01-30 14:50:54 -05:00
run : [
2023-04-08 09:27:21 -04:00
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/' ,
2024-09-30 11:44:42 -04:00
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/canary/$(git rev-parse HEAD)/' ,
2024-09-19 09:54:59 -04:00
"echo ${{ github.sha }} > canary-latest.txt" ,
'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-$(rustc -vV | sed -n "s|host: ||p")-latest.txt' ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
} ,
2023-05-01 08:37:32 -04:00
{
name : "Autobahn testsuite" ,
if : [
2024-02-07 11:06:33 -05:00
"(matrix.os == 'linux' && matrix.arch != 'aarch64') &&" ,
2024-01-31 08:59:47 -05:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"!startsWith(github.ref, 'refs/tags/')" ,
2023-05-01 08:37:32 -04:00
] . join ( "\n" ) ,
run :
2024-09-09 21:10:20 -04:00
"target/release/deno run -A --config tests/config/deno.json ext/websocket/autobahn/fuzzingclient.js" ,
2023-05-01 08:37:32 -04:00
} ,
2023-04-08 09:27:21 -04:00
{
2024-01-31 08:59:47 -05:00
name : "Test (full, debug)" ,
2023-04-08 09:27:21 -04:00
if : [
2024-01-31 08:59:47 -05:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'debug' &&" ,
"!startsWith(github.ref, 'refs/tags/') &&" ,
// Run full tests only on Linux.
"matrix.os == 'linux'" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
run : "cargo test --locked" ,
env : { CARGO_PROFILE_DEV_DEBUG : 0 } ,
} ,
{
2024-01-31 08:59:47 -05:00
name : "Test (fast, debug)" ,
2023-04-08 09:27:21 -04:00
if : [
2024-01-31 08:59:47 -05:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'debug' &&" ,
"(startsWith(github.ref, 'refs/tags/') || matrix.os != 'linux')" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
run : [
// Run unit then integration tests. Skip doc tests here
// since they are sometimes very slow on Mac.
"cargo test --locked --lib" ,
2024-02-09 15:33:05 -05:00
"cargo test --locked --tests" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
env : { CARGO_PROFILE_DEV_DEBUG : 0 } ,
} ,
{
2024-01-31 08:59:47 -05:00
name : "Test (release)" ,
2023-04-08 09:27:21 -04:00
if : [
2024-01-31 08:59:47 -05:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
2023-04-08 09:27:21 -04:00
"(matrix.use_sysroot || (" ,
"github.repository == 'denoland/deno' &&" ,
2023-11-19 18:11:20 -05:00
"!startsWith(github.ref, 'refs/tags/')))" ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
run : "cargo test --release --locked" ,
} ,
{
name : "Configure hosts file for WPT" ,
if : "matrix.wpt" ,
run : "./wpt make-hosts-file | sudo tee -a /etc/hosts" ,
2024-02-15 22:32:28 -05:00
"working-directory" : "tests/wpt/suite/" ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "Run web platform tests (debug)" ,
if : "matrix.wpt && matrix.profile == 'debug'" ,
env : {
DENO_BIN : "./target/debug/deno" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
run : [
2024-09-09 21:10:20 -04:00
"deno run -A --lock=tools/deno.lock.json --config tests/config/deno.json\\" ,
2024-03-06 16:59:30 -05:00
" ./tests/wpt/wpt.ts setup" ,
2024-09-09 21:10:20 -04:00
"deno run -A --lock=tools/deno.lock.json --config tests/config/deno.json\\" ,
2024-03-06 16:59:30 -05:00
' ./tests/wpt/wpt.ts run --quiet --binary="$DENO_BIN"' ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
} ,
{
name : "Run web platform tests (release)" ,
if : "matrix.wpt && matrix.profile == 'release'" ,
env : {
DENO_BIN : "./target/release/deno" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
run : [
2024-09-09 21:10:20 -04:00
"deno run -A --lock=tools/deno.lock.json --config tests/config/deno.json\\" ,
2024-03-06 16:59:30 -05:00
" ./tests/wpt/wpt.ts setup" ,
2024-09-09 21:10:20 -04:00
"deno run -A --lock=tools/deno.lock.json --config tests/config/deno.json\\" ,
2024-05-01 11:15:29 -04:00
" ./tests/wpt/wpt.ts run --quiet --release \\" ,
2023-04-08 09:27:21 -04:00
' --binary="$DENO_BIN" \\' ,
" --json=wpt.json \\" ,
" --wptreport=wptreport.json" ,
] . join ( "\n" ) ,
} ,
{
name : "Upload wpt results to dl.deno.land" ,
"continue-on-error" : true ,
if : [
"matrix.wpt &&" ,
2024-01-31 08:59:47 -05:00
"matrix.os == 'linux' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
run : [
"gzip ./wptreport.json" ,
'gsutil -h "Cache-Control: public, max-age=3600" cp ./wpt.json gs://dl.deno.land/wpt/$(git rev-parse HEAD).json' ,
'gsutil -h "Cache-Control: public, max-age=3600" cp ./wptreport.json.gz gs://dl.deno.land/wpt/$(git rev-parse HEAD)-wptreport.json.gz' ,
"echo $(git rev-parse HEAD) > wpt-latest.txt" ,
'gsutil -h "Cache-Control: no-cache" cp wpt-latest.txt gs://dl.deno.land/wpt-latest.txt' ,
] . join ( "\n" ) ,
} ,
{
name : "Upload wpt results to wpt.fyi" ,
"continue-on-error" : true ,
if : [
"matrix.wpt &&" ,
2024-01-31 08:59:47 -05:00
"matrix.os == 'linux' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
env : {
WPT_FYI_USER : "deno" ,
WPT_FYI_PW : "${{ secrets.WPT_FYI_PW }}" ,
GITHUB_TOKEN : "${{ secrets.DENOBOT_PAT }}" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
run : [
"./target/release/deno run --allow-all --lock=tools/deno.lock.json \\" ,
" ./tools/upload_wptfyi.js $(git rev-parse HEAD) --ghstatus" ,
] . join ( "\n" ) ,
} ,
{
name : "Run benchmarks" ,
if : "matrix.job == 'bench' && !startsWith(github.ref, 'refs/tags/')" ,
run : "cargo bench --locked" ,
} ,
{
name : "Post Benchmarks" ,
if : [
"matrix.job == 'bench' &&" ,
"github.repository == 'denoland/deno' &&" ,
"github.ref == 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
env : {
DENOBOT_PAT : "${{ secrets.DENOBOT_PAT }}" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
run : [
"git clone --depth 1 --branch gh-pages \\" ,
" https://${DENOBOT_PAT}@github.com/denoland/benchmark_data.git \\" ,
" gh-pages" ,
2024-09-09 21:10:20 -04:00
"./target/release/deno run --allow-all ./tools/build_benchmark_jsons.js --release" ,
2023-04-08 09:27:21 -04:00
"cd gh-pages" ,
'git config user.email "propelml@gmail.com"' ,
'git config user.name "denobot"' ,
"git add ." ,
'git commit --message "Update benchmarks"' ,
"git push origin gh-pages" ,
] . join ( "\n" ) ,
} ,
{
name : "Build product size info" ,
if :
"matrix.job != 'lint' && matrix.profile != 'debug' && github.repository == 'denoland/deno' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/'))" ,
run : [
'du -hd1 "./target/${{ matrix.profile }}"' ,
'du -ha "./target/${{ matrix.profile }}/deno"' ,
2024-02-13 11:22:30 -05:00
'du -ha "./target/${{ matrix.profile }}/denort"' ,
2023-04-08 09:27:21 -04:00
] . join ( "\n" ) ,
} ,
{
name : "Worker info" ,
if : "matrix.job == 'bench'" ,
run : [
"cat /proc/cpuinfo" ,
"cat /proc/meminfo" ,
] . join ( "\n" ) ,
} ,
{
name : "Upload release to dl.deno.land (unix)" ,
if : [
2024-01-31 08:59:47 -05:00
"matrix.os != 'windows' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
2024-09-30 11:44:42 -04:00
run : [
2023-04-08 09:27:21 -04:00
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/release/${GITHUB_REF#refs/*/}/' ,
2024-09-30 11:44:42 -04:00
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/release/${GITHUB_REF#refs/*/}/' ,
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "Upload release to dl.deno.land (windows)" ,
if : [
2024-01-31 08:59:47 -05:00
"matrix.os == 'windows' &&" ,
2023-04-08 09:27:21 -04:00
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
env : {
CLOUDSDK_PYTHON : "${{env.pythonLocation}}\\python.exe" ,
2023-01-11 13:44:11 -05:00
} ,
2024-09-30 11:44:42 -04:00
run : [
2023-04-08 09:27:21 -04:00
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/release/${GITHUB_REF#refs/*/}/' ,
2024-09-30 11:44:42 -04:00
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.sha256sum gs://dl.deno.land/release/${GITHUB_REF#refs/*/}/' ,
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
} ,
{
name : "Create release notes" ,
if : [
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
run : [
"export PATH=$PATH:$(pwd)/target/release" ,
"./tools/release/05_create_release_notes.ts" ,
] . join ( "\n" ) ,
} ,
{
name : "Upload release to GitHub" ,
uses : "softprops/action-gh-release@v0.1.15" ,
if : [
"matrix.job == 'test' &&" ,
"matrix.profile == 'release' &&" ,
"github.repository == 'denoland/deno' &&" ,
"startsWith(github.ref, 'refs/tags/')" ,
] . join ( "\n" ) ,
env : {
GITHUB_TOKEN : "${{ secrets.GITHUB_TOKEN }}" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
with : {
files : [
"target/release/deno-x86_64-pc-windows-msvc.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/deno-x86_64-pc-windows-msvc.zip.sha256sum" ,
2024-02-13 11:22:30 -05:00
"target/release/denort-x86_64-pc-windows-msvc.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/denort-x86_64-pc-windows-msvc.zip.sha256sum" ,
2023-04-08 09:27:21 -04:00
"target/release/deno-x86_64-unknown-linux-gnu.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/deno-x86_64-unknown-linux-gnu.zip.sha256sum" ,
2024-02-13 11:22:30 -05:00
"target/release/denort-x86_64-unknown-linux-gnu.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/denort-x86_64-unknown-linux-gnu.zip.sha256sum" ,
2023-04-08 09:27:21 -04:00
"target/release/deno-x86_64-apple-darwin.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/deno-x86_64-apple-darwin.zip.sha256sum" ,
2024-02-13 11:22:30 -05:00
"target/release/denort-x86_64-apple-darwin.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/denort-x86_64-apple-darwin.zip.sha256sum" ,
2024-02-08 13:51:37 -05:00
"target/release/deno-aarch64-unknown-linux-gnu.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/deno-aarch64-unknown-linux-gnu.zip.sha256sum" ,
2024-02-13 11:22:30 -05:00
"target/release/denort-aarch64-unknown-linux-gnu.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/denort-aarch64-unknown-linux-gnu.zip.sha256sum" ,
2023-11-19 18:11:20 -05:00
"target/release/deno-aarch64-apple-darwin.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/deno-aarch64-apple-darwin.zip.sha256sum" ,
2024-02-13 11:22:30 -05:00
"target/release/denort-aarch64-apple-darwin.zip" ,
2024-10-14 08:46:26 -04:00
"target/release/denort-aarch64-apple-darwin.zip.sha256sum" ,
2023-04-08 09:27:21 -04:00
"target/release/deno_src.tar.gz" ,
"target/release/lib.deno.d.ts" ,
2023-01-11 13:44:11 -05:00
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
body_path : "target/release/release-notes.md" ,
draft : true ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
} ,
{
// In main branch, always create a fresh cache
name : "Save cache build output (main)" ,
2024-02-06 16:47:44 -05:00
uses : "actions/cache/save@v4" ,
2023-04-08 09:27:21 -04:00
if :
2024-01-31 12:32:37 -05:00
"(matrix.job == 'test' || matrix.job == 'lint') && github.ref == 'refs/heads/main'" ,
2023-04-08 09:27:21 -04:00
with : {
path : [
"./target" ,
"!./target/*/gn_out" ,
"!./target/*/*.zip" ,
2024-09-30 11:44:42 -04:00
"!./target/*/*.sha256sum" ,
2023-04-08 09:27:21 -04:00
"!./target/*/*.tar.gz" ,
2023-01-11 13:44:11 -05:00
] . join ( "\n" ) ,
2023-04-08 09:27:21 -04:00
key : prCacheKeyPrefix + "${{ github.sha }}" ,
2023-01-11 13:44:11 -05:00
} ,
2023-04-08 09:27:21 -04:00
} ,
2023-01-11 19:49:18 -05:00
] ) ,
2023-01-10 19:16:11 -05:00
} ,
"publish-canary" : {
name : "publish canary" ,
2024-01-31 08:59:47 -05:00
"runs-on" : ubuntuX86Runner ,
2023-01-10 19:16:11 -05:00
needs : [ "build" ] ,
if :
"github.repository == 'denoland/deno' && github.ref == 'refs/heads/main'" ,
2023-01-12 10:19:35 -05:00
steps : [
authenticateWithGoogleCloud ,
{
name : "Setup gcloud" ,
2024-03-20 13:40:29 -04:00
uses : "google-github-actions/setup-gcloud@v2" ,
2023-01-12 10:19:35 -05:00
with : {
project_id : "denoland" ,
} ,
} ,
{
name : "Upload canary version file to dl.deno.land" ,
run : [
2024-09-19 09:54:59 -04:00
"echo ${{ github.sha }} > canary-latest.txt" ,
'gsutil -h "Cache-Control: no-cache" cp canary-latest.txt gs://dl.deno.land/canary-latest.txt' ,
2023-01-12 10:19:35 -05:00
] . join ( "\n" ) ,
2023-01-10 19:16:11 -05:00
} ,
2023-01-12 10:19:35 -05:00
] ,
2023-01-10 19:16:11 -05:00
} ,
} ,
} ;
2024-03-01 11:11:32 -05:00
export function generate() {
let finalText = ` # GENERATED BY ./ci.generate.ts -- DO NOT DIRECTLY EDIT \ n \ n ` ;
2024-04-10 17:26:35 -04:00
finalText += stringify ( ci , {
2024-03-01 11:11:32 -05:00
noRefs : true ,
lineWidth : 10_000 ,
noCompatMode : true ,
} ) ;
return finalText ;
}
export const CI_YML_URL = new URL ( "./ci.yml" , import . meta . url ) ;
2023-01-10 19:16:11 -05:00
2024-03-01 11:11:32 -05:00
if ( import . meta . main ) {
Deno . writeTextFileSync ( CI_YML_URL , generate ( ) ) ;
}