Don't strip nightly releases

This commit is contained in:
Aleksey Kladov 2020-04-08 11:47:40 +02:00
parent d89c189ad1
commit ffb7ea678b
5 changed files with 21 additions and 24 deletions

View file

@ -50,11 +50,11 @@ jobs:
- name: Dist - name: Dist
if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release' if: matrix.os == 'ubuntu-latest' && github.ref == 'refs/heads/release'
run: cargo xtask dist --client --version 0.2.$GITHUB_RUN_NUMBER --tag $(date --iso --utc) run: cargo xtask dist --client 0.2.$GITHUB_RUN_NUMBER
- name: Dist - name: Dist
if: matrix.os == 'ubuntu-latest' && github.ref != 'refs/heads/release' if: matrix.os == 'ubuntu-latest' && github.ref != 'refs/heads/release'
run: cargo xtask dist --client --version 0.3.$GITHUB_RUN_NUMBER-nightly --tag nightly run: cargo xtask dist --nightly --client 0.3.$GITHUB_RUN_NUMBER-nightly
- name: Dist - name: Dist
if: matrix.os != 'ubuntu-latest' if: matrix.os != 'ubuntu-latest'

View file

@ -3,24 +3,21 @@ use std::path::PathBuf;
use anyhow::Result; use anyhow::Result;
use crate::{ use crate::{
not_bash::{fs2, pushd, rm_rf, run}, not_bash::{date_iso, fs2, pushd, rm_rf, run},
project_root, project_root,
}; };
pub struct ClientOpts {
pub version: String,
pub release_tag: String,
}
pub fn run_dist(client_opts: Option<ClientOpts>) -> Result<()> { pub fn run_dist(nightly: bool, client_version: Option<String>) -> Result<()> {
let dist = project_root().join("dist"); let dist = project_root().join("dist");
rm_rf(&dist)?; rm_rf(&dist)?;
fs2::create_dir_all(&dist)?; fs2::create_dir_all(&dist)?;
if let Some(ClientOpts { version, release_tag }) = client_opts { if let Some(version) = client_version {
let release_tag = if nightly { "nightly".to_string() } else { date_iso()? };
dist_client(&version, &release_tag)?; dist_client(&version, &release_tag)?;
} }
dist_server()?; dist_server(nightly)?;
Ok(()) Ok(())
} }
@ -50,7 +47,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> {
Ok(()) Ok(())
} }
fn dist_server() -> Result<()> { fn dist_server(nightly: bool) -> Result<()> {
if cfg!(target_os = "linux") { if cfg!(target_os = "linux") {
std::env::set_var("CC", "clang"); std::env::set_var("CC", "clang");
run!( run!(
@ -60,7 +57,9 @@ fn dist_server() -> Result<()> {
// We'd want to add, but that requires setting the right linker somehow // We'd want to add, but that requires setting the right linker somehow
// --features=jemalloc // --features=jemalloc
)?; )?;
run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?; if !nightly {
run!("strip ./target/x86_64-unknown-linux-musl/release/rust-analyzer")?;
}
} else { } else {
run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?; run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?;
} }

View file

@ -21,7 +21,7 @@ use walkdir::{DirEntry, WalkDir};
use crate::{ use crate::{
codegen::Mode, codegen::Mode,
not_bash::{fs2, pushd, rm_rf, run}, not_bash::{date_iso, fs2, pushd, rm_rf, run},
}; };
pub use anyhow::Result; pub use anyhow::Result;
@ -180,7 +180,7 @@ pub fn run_release(dry_run: bool) -> Result<()> {
let website_root = project_root().join("../rust-analyzer.github.io"); let website_root = project_root().join("../rust-analyzer.github.io");
let changelog_dir = website_root.join("./thisweek/_posts"); let changelog_dir = website_root.join("./thisweek/_posts");
let today = run!("date --iso")?; let today = date_iso()?;
let commit = run!("git rev-parse HEAD")?; let commit = run!("git rev-parse HEAD")?;
let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count(); let changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();

View file

@ -13,7 +13,7 @@ use std::env;
use pico_args::Arguments; use pico_args::Arguments;
use xtask::{ use xtask::{
codegen::{self, Mode}, codegen::{self, Mode},
dist::{run_dist, ClientOpts}, dist::run_dist,
install::{ClientOpt, InstallCmd, ServerOpt}, install::{ClientOpt, InstallCmd, ServerOpt},
not_bash::pushd, not_bash::pushd,
pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt, pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt,
@ -103,16 +103,10 @@ FLAGS:
run_release(dry_run) run_release(dry_run)
} }
"dist" => { "dist" => {
let client_opts = if args.contains("--client") { let nightly = args.contains("--nightly");
Some(ClientOpts { let client_version: Option<String> = args.opt_value_from_str("--client")?;
version: args.value_from_str("--version")?,
release_tag: args.value_from_str("--tag")?,
})
} else {
None
};
args.finish()?; args.finish()?;
run_dist(client_opts) run_dist(nightly, client_version)
} }
_ => { _ => {
eprintln!( eprintln!(

View file

@ -94,6 +94,10 @@ pub fn run_process(cmd: String, echo: bool) -> Result<String> {
run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd)) run_process_inner(&cmd, echo).with_context(|| format!("process `{}` failed", cmd))
} }
pub fn date_iso() -> Result<String> {
run!("date --iso --utc")
}
fn run_process_inner(cmd: &str, echo: bool) -> Result<String> { fn run_process_inner(cmd: &str, echo: bool) -> Result<String> {
let mut args = shelx(cmd); let mut args = shelx(cmd);
let binary = args.remove(0); let binary = args.remove(0);