Skip to content

Commit

Permalink
Don't strip nightly releases
Browse files Browse the repository at this point in the history
  • Loading branch information
matklad committed Apr 8, 2020
1 parent d89c189 commit ffb7ea6
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ jobs:

- name: Dist
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
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
if: matrix.os != 'ubuntu-latest'
Expand Down
19 changes: 9 additions & 10 deletions xtask/src/dist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,21 @@ use std::path::PathBuf;
use anyhow::Result;

use crate::{
not_bash::{fs2, pushd, rm_rf, run},
not_bash::{date_iso, fs2, pushd, rm_rf, run},
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");
rm_rf(&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_server()?;
dist_server(nightly)?;
Ok(())
}

Expand Down Expand Up @@ -50,7 +47,7 @@ fn dist_client(version: &str, release_tag: &str) -> Result<()> {
Ok(())
}

fn dist_server() -> Result<()> {
fn dist_server(nightly: bool) -> Result<()> {
if cfg!(target_os = "linux") {
std::env::set_var("CC", "clang");
run!(
Expand All @@ -60,7 +57,9 @@ fn dist_server() -> Result<()> {
// We'd want to add, but that requires setting the right linker somehow
// --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 {
run!("cargo build --manifest-path ./crates/rust-analyzer/Cargo.toml --bin rust-analyzer --release")?;
}
Expand Down
4 changes: 2 additions & 2 deletions xtask/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use walkdir::{DirEntry, WalkDir};

use crate::{
codegen::Mode,
not_bash::{fs2, pushd, rm_rf, run},
not_bash::{date_iso, fs2, pushd, rm_rf, run},
};

pub use anyhow::Result;
Expand Down Expand Up @@ -180,7 +180,7 @@ pub fn run_release(dry_run: bool) -> Result<()> {
let website_root = project_root().join("../rust-analyzer.github.io");
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 changelog_n = fs2::read_dir(changelog_dir.as_path())?.count();

Expand Down
14 changes: 4 additions & 10 deletions xtask/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use std::env;
use pico_args::Arguments;
use xtask::{
codegen::{self, Mode},
dist::{run_dist, ClientOpts},
dist::run_dist,
install::{ClientOpt, InstallCmd, ServerOpt},
not_bash::pushd,
pre_commit, project_root, run_clippy, run_fuzzer, run_pre_cache, run_release, run_rustfmt,
Expand Down Expand Up @@ -103,16 +103,10 @@ FLAGS:
run_release(dry_run)
}
"dist" => {
let client_opts = if args.contains("--client") {
Some(ClientOpts {
version: args.value_from_str("--version")?,
release_tag: args.value_from_str("--tag")?,
})
} else {
None
};
let nightly = args.contains("--nightly");
let client_version: Option<String> = args.opt_value_from_str("--client")?;
args.finish()?;
run_dist(client_opts)
run_dist(nightly, client_version)
}
_ => {
eprintln!(
Expand Down
4 changes: 4 additions & 0 deletions xtask/src/not_bash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}

pub fn date_iso() -> Result<String> {
run!("date --iso --utc")
}

fn run_process_inner(cmd: &str, echo: bool) -> Result<String> {
let mut args = shelx(cmd);
let binary = args.remove(0);
Expand Down

0 comments on commit ffb7ea6

Please sign in to comment.