summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-x.github/workflows/ci.generate.ts21
-rw-r--r--.github/workflows/ci.yml20
-rw-r--r--cli/tools/upgrade.rs77
3 files changed, 71 insertions, 47 deletions
diff --git a/.github/workflows/ci.generate.ts b/.github/workflows/ci.generate.ts
index 6d9997eff..03c9a09ae 100755
--- a/.github/workflows/ci.generate.ts
+++ b/.github/workflows/ci.generate.ts
@@ -747,31 +747,18 @@ const ci = {
"Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-x86_64-pc-windows-msvc.zip",
},
{
- name: "Upload canary to dl.deno.land (unix)",
+ name: "Upload canary to dl.deno.land",
if: [
- "runner.os != 'Windows' &&",
"matrix.job == 'test' &&",
"matrix.profile == 'release' &&",
"github.repository == 'denoland/deno' &&",
"github.ref == 'refs/heads/main'",
].join("\n"),
- run:
+ run: [
'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
- },
- {
- name: "Upload canary to dl.deno.land (windows)",
- if: [
- "runner.os == 'Windows' &&",
- "matrix.job == 'test' &&",
- "matrix.profile == 'release' &&",
- "github.repository == 'denoland/deno' &&",
- "github.ref == 'refs/heads/main'",
+ "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',
].join("\n"),
- env: {
- CLOUDSDK_PYTHON: "${{env.pythonLocation}}\\python.exe",
- },
- run:
- 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/',
},
{
name: "Autobahn testsuite",
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b2d9265a1..bcd5fd2d6 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -437,24 +437,16 @@ jobs:
github.repository == 'denoland/deno')
shell: pwsh
run: Compress-Archive -CompressionLevel Optimal -Force -Path target/release/deno.exe -DestinationPath target/release/deno-x86_64-pc-windows-msvc.zip
- - name: Upload canary to dl.deno.land (unix)
+ - name: Upload canary to dl.deno.land
if: |-
- !(matrix.skip) && (runner.os != 'Windows' &&
- matrix.job == 'test' &&
- matrix.profile == 'release' &&
- github.repository == 'denoland/deno' &&
- github.ref == 'refs/heads/main')
- run: 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/'
- - name: Upload canary to dl.deno.land (windows)
- if: |-
- !(matrix.skip) && (runner.os == 'Windows' &&
- matrix.job == 'test' &&
+ !(matrix.skip) && (matrix.job == 'test' &&
matrix.profile == 'release' &&
github.repository == 'denoland/deno' &&
github.ref == 'refs/heads/main')
- env:
- CLOUDSDK_PYTHON: '${{env.pythonLocation}}\python.exe'
- run: 'gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/'
+ run: |-
+ gsutil -h "Cache-Control: public, max-age=3600" cp ./target/release/*.zip gs://dl.deno.land/canary/$(git rev-parse HEAD)/
+ 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
- name: Autobahn testsuite
if: |-
!(matrix.skip) && (matrix.job == 'test' && matrix.profile == 'release' &&
diff --git a/cli/tools/upgrade.rs b/cli/tools/upgrade.rs
index 20d9fb643..70141f571 100644
--- a/cli/tools/upgrade.rs
+++ b/cli/tools/upgrade.rs
@@ -483,12 +483,6 @@ pub async fn upgrade(
};
let download_url = if upgrade_flags.canary {
- // NOTE(bartlomieju): to keep clippy happy on M1 macs.
- #[allow(clippy::eq_op)]
- if env!("TARGET") == "aarch64-apple-darwin" {
- bail!("Canary builds are not available for M1/M2");
- }
-
format!(
"https://dl.deno.land/canary/{}/{}",
install_version, *ARCHIVE_NAME
@@ -502,7 +496,7 @@ pub async fn upgrade(
let archive_data = download_package(client, &download_url)
.await
- .with_context(|| format!("Failed downloading {download_url}"))?;
+ .with_context(|| format!("Failed downloading {download_url}. The version you requested may not have been built for the current architechture."))?;
log::info!("Deno is upgrading to version {}", &install_version);
@@ -568,7 +562,7 @@ async fn get_latest_version(
release_kind: UpgradeReleaseKind,
check_kind: UpgradeCheckKind,
) -> Result<String, AnyError> {
- let url = get_url(release_kind, check_kind);
+ let url = get_url(release_kind, env!("TARGET"), check_kind);
let text = client.download_text(url).await?;
Ok(normalize_version_from_server(release_kind, &text))
}
@@ -586,11 +580,14 @@ fn normalize_version_from_server(
fn get_url(
release_kind: UpgradeReleaseKind,
+ target_tuple: &str,
check_kind: UpgradeCheckKind,
) -> String {
let file_name = match release_kind {
- UpgradeReleaseKind::Stable => "release-latest.txt",
- UpgradeReleaseKind::Canary => "canary-latest.txt",
+ UpgradeReleaseKind::Stable => Cow::Borrowed("release-latest.txt"),
+ UpgradeReleaseKind::Canary => {
+ Cow::Owned(format!("canary-{target_tuple}-latest.txt"))
+ }
};
let query_param = match check_kind {
UpgradeCheckKind::Execution => "",
@@ -1024,19 +1021,67 @@ mod test {
#[test]
fn test_get_url() {
assert_eq!(
- get_url(UpgradeReleaseKind::Canary, UpgradeCheckKind::Execution),
- "https://dl.deno.land/canary-latest.txt"
+ get_url(
+ UpgradeReleaseKind::Canary,
+ "aarch64-apple-darwin",
+ UpgradeCheckKind::Execution
+ ),
+ "https://dl.deno.land/canary-aarch64-apple-darwin-latest.txt"
);
assert_eq!(
- get_url(UpgradeReleaseKind::Canary, UpgradeCheckKind::Lsp),
- "https://dl.deno.land/canary-latest.txt?lsp"
+ get_url(
+ UpgradeReleaseKind::Canary,
+ "aarch64-apple-darwin",
+ UpgradeCheckKind::Lsp
+ ),
+ "https://dl.deno.land/canary-aarch64-apple-darwin-latest.txt?lsp"
+ );
+ assert_eq!(
+ get_url(
+ UpgradeReleaseKind::Canary,
+ "x86_64-pc-windows-msvc",
+ UpgradeCheckKind::Execution
+ ),
+ "https://dl.deno.land/canary-x86_64-pc-windows-msvc-latest.txt"
+ );
+ assert_eq!(
+ get_url(
+ UpgradeReleaseKind::Canary,
+ "x86_64-pc-windows-msvc",
+ UpgradeCheckKind::Lsp
+ ),
+ "https://dl.deno.land/canary-x86_64-pc-windows-msvc-latest.txt?lsp"
);
assert_eq!(
- get_url(UpgradeReleaseKind::Stable, UpgradeCheckKind::Execution),
+ get_url(
+ UpgradeReleaseKind::Stable,
+ "aarch64-apple-darwin",
+ UpgradeCheckKind::Execution
+ ),
+ "https://dl.deno.land/release-latest.txt"
+ );
+ assert_eq!(
+ get_url(
+ UpgradeReleaseKind::Stable,
+ "aarch64-apple-darwin",
+ UpgradeCheckKind::Lsp
+ ),
+ "https://dl.deno.land/release-latest.txt?lsp"
+ );
+ assert_eq!(
+ get_url(
+ UpgradeReleaseKind::Stable,
+ "x86_64-pc-windows-msvc",
+ UpgradeCheckKind::Execution
+ ),
"https://dl.deno.land/release-latest.txt"
);
assert_eq!(
- get_url(UpgradeReleaseKind::Stable, UpgradeCheckKind::Lsp),
+ get_url(
+ UpgradeReleaseKind::Stable,
+ "x86_64-pc-windows-msvc",
+ UpgradeCheckKind::Lsp
+ ),
"https://dl.deno.land/release-latest.txt?lsp"
);
}