Test on CI with unstable cg_clif features disabled

Part of #1084
This commit is contained in:
bjorn3 2021-12-03 13:16:34 +01:00
parent 8fa112b0d3
commit f296311925
3 changed files with 23 additions and 4 deletions

View File

@ -65,6 +65,12 @@ jobs:
git config --global user.name "User"
./y.rs prepare
- name: Build without unstable features
env:
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
# This is the config rust-lang/rust uses for builds
run: ./y.rs build --no-unstable-features
- name: Build
run: ./y.rs build --sysroot none

View File

@ -2,9 +2,17 @@ use std::env;
use std::path::{Path, PathBuf};
use std::process::Command;
pub(crate) fn build_backend(channel: &str, host_triple: &str) -> PathBuf {
pub(crate) fn build_backend(
channel: &str,
host_triple: &str,
use_unstable_features: bool,
) -> PathBuf {
let mut cmd = Command::new("cargo");
cmd.arg("build").arg("--target").arg(host_triple).arg("--features").arg("unstable-features");
cmd.arg("build").arg("--target").arg(host_triple);
if use_unstable_features {
cmd.arg("--features").arg("unstable-features");
}
match channel {
"debug" => {}

9
y.rs
View File

@ -43,7 +43,9 @@ mod utils;
fn usage() {
eprintln!("Usage:");
eprintln!(" ./y.rs prepare");
eprintln!(" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR]");
eprintln!(
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
);
}
macro_rules! arg_error {
@ -92,6 +94,7 @@ fn main() {
let mut target_dir = PathBuf::from("build");
let mut channel = "release";
let mut sysroot_kind = SysrootKind::Clif;
let mut use_unstable_features = true;
while let Some(arg) = args.next().as_deref() {
match arg {
"--target-dir" => {
@ -109,6 +112,7 @@ fn main() {
None => arg_error!("--sysroot requires argument"),
}
}
"--no-unstable-features" => use_unstable_features = false,
flag if flag.starts_with("-") => arg_error!("Unknown flag {}", flag),
arg => arg_error!("Unexpected argument {}", arg),
}
@ -141,7 +145,8 @@ fn main() {
process::exit(1);
}
let cg_clif_build_dir = build_backend::build_backend(channel, &host_triple);
let cg_clif_build_dir =
build_backend::build_backend(channel, &host_triple, use_unstable_features);
build_sysroot::build_sysroot(
channel,
sysroot_kind,