Skip to content

Commit f296311

Browse files
committed
Test on CI with unstable cg_clif features disabled
Part of #1084
1 parent 8fa112b commit f296311

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

.github/workflows/main.yml

+6
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ jobs:
6565
git config --global user.name "User"
6666
./y.rs prepare
6767
68+
- name: Build without unstable features
69+
env:
70+
TARGET_TRIPLE: ${{ matrix.env.TARGET_TRIPLE }}
71+
# This is the config rust-lang/rust uses for builds
72+
run: ./y.rs build --no-unstable-features
73+
6874
- name: Build
6975
run: ./y.rs build --sysroot none
7076

build_system/build_backend.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ use std::env;
22
use std::path::{Path, PathBuf};
33
use std::process::Command;
44

5-
pub(crate) fn build_backend(channel: &str, host_triple: &str) -> PathBuf {
5+
pub(crate) fn build_backend(
6+
channel: &str,
7+
host_triple: &str,
8+
use_unstable_features: bool,
9+
) -> PathBuf {
610
let mut cmd = Command::new("cargo");
7-
cmd.arg("build").arg("--target").arg(host_triple).arg("--features").arg("unstable-features");
11+
cmd.arg("build").arg("--target").arg(host_triple);
12+
13+
if use_unstable_features {
14+
cmd.arg("--features").arg("unstable-features");
15+
}
816

917
match channel {
1018
"debug" => {}

y.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ mod utils;
4343
fn usage() {
4444
eprintln!("Usage:");
4545
eprintln!(" ./y.rs prepare");
46-
eprintln!(" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR]");
46+
eprintln!(
47+
" ./y.rs build [--debug] [--sysroot none|clif|llvm] [--target-dir DIR] [--no-unstable-features]"
48+
);
4749
}
4850

4951
macro_rules! arg_error {
@@ -92,6 +94,7 @@ fn main() {
9294
let mut target_dir = PathBuf::from("build");
9395
let mut channel = "release";
9496
let mut sysroot_kind = SysrootKind::Clif;
97+
let mut use_unstable_features = true;
9598
while let Some(arg) = args.next().as_deref() {
9699
match arg {
97100
"--target-dir" => {
@@ -109,6 +112,7 @@ fn main() {
109112
None => arg_error!("--sysroot requires argument"),
110113
}
111114
}
115+
"--no-unstable-features" => use_unstable_features = false,
112116
flag if flag.starts_with("-") => arg_error!("Unknown flag {}", flag),
113117
arg => arg_error!("Unexpected argument {}", arg),
114118
}
@@ -141,7 +145,8 @@ fn main() {
141145
process::exit(1);
142146
}
143147

144-
let cg_clif_build_dir = build_backend::build_backend(channel, &host_triple);
148+
let cg_clif_build_dir =
149+
build_backend::build_backend(channel, &host_triple, use_unstable_features);
145150
build_sysroot::build_sysroot(
146151
channel,
147152
sysroot_kind,

0 commit comments

Comments
 (0)