1
0
mirror of https://github.com/BurntSushi/ripgrep.git synced 2025-01-29 22:01:04 +02:00

ci: add more ARM build configurations to CI and release workflows

... it turns out that rustembedded/cross:armv7-unknown-linux-musleabi
doesn't exist. And looking more closely, it looks like the Cross project
has decided to shake things up and publish images to ghcr instead. So we
migrate everything over to that.
This commit is contained in:
Younes El-karama 2024-01-05 01:06:42 -05:00 committed by Andrew Gallant
parent 6c2a550e1e
commit 827082a33a
6 changed files with 70 additions and 16 deletions

View File

@ -75,6 +75,18 @@ jobs:
os: ubuntu-latest os: ubuntu-latest
rust: stable rust: stable
target: aarch64-unknown-linux-gnu target: aarch64-unknown-linux-gnu
- build: stable-arm-gnueabihf
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-gnueabihf
- build: stable-arm-musleabihf
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-musleabihf
- build: stable-arm-musleabi
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-musleabi
- build: stable-powerpc64 - build: stable-powerpc64
os: ubuntu-latest os: ubuntu-latest
rust: stable rust: stable

View File

@ -80,6 +80,24 @@ jobs:
target: aarch64-unknown-linux-gnu target: aarch64-unknown-linux-gnu
strip: aarch64-linux-gnu-strip strip: aarch64-linux-gnu-strip
qemu: qemu-aarch64 qemu: qemu-aarch64
- build: stable-arm-gnueabihf
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-gnueabihf
strip: arm-linux-gnueabihf-strip
qemu: qemu-arm
- build: stable-arm-musleabihf
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-musleabihf
strip: arm-linux-musleabihf-strip
qemu: qemu-arm
- build: stable-arm-musleabi
os: ubuntu-latest
rust: stable
target: armv7-unknown-linux-musleabi
strip: arm-linux-musleabi-strip
qemu: qemu-arm
- build: stable-powerpc64 - build: stable-powerpc64
os: ubuntu-latest os: ubuntu-latest
rust: stable rust: stable
@ -175,9 +193,9 @@ jobs:
run: | run: |
docker run --rm -v \ docker run --rm -v \
"$PWD/target:/target:Z" \ "$PWD/target:/target:Z" \
"rustembedded/cross:${{ matrix.target }}" \ "ghcr.io/cross-rs/${{ matrix.target }}:main" \
"${{ matrix.strip }}" \ "${{ matrix.strip }}" \
"/target/${{ matrix.target }}/release/rg" "/$BIN"
- name: Determine archive name - name: Determine archive name
shell: bash shell: bash
@ -210,31 +228,31 @@ jobs:
run: | run: |
docker run --rm -v \ docker run --rm -v \
"$PWD/target:/target:Z" \ "$PWD/target:/target:Z" \
"rustembedded/cross:${{ matrix.target }}" \ "ghcr.io/cross-rs/${{ matrix.target }}:main" \
"${{ matrix.qemu }}" "/$BIN" --version "${{ matrix.qemu }}" "/$BIN" --version
docker run --rm -v \ docker run --rm -v \
"$PWD/target:/target:Z" \ "$PWD/target:/target:Z" \
"rustembedded/cross:${{ matrix.target }}" \ "ghcr.io/cross-rs/${{ matrix.target }}:main" \
"${{ matrix.qemu }}" "/$BIN" \ "${{ matrix.qemu }}" "/$BIN" \
--generate complete-bash > "$ARCHIVE/complete/rg.bash" --generate complete-bash > "$ARCHIVE/complete/rg.bash"
docker run --rm -v \ docker run --rm -v \
"$PWD/target:/target:Z" \ "$PWD/target:/target:Z" \
"rustembedded/cross:${{ matrix.target }}" \ "ghcr.io/cross-rs/${{ matrix.target }}:main" \
"${{ matrix.qemu }}" "/$BIN" \ "${{ matrix.qemu }}" "/$BIN" \
--generate complete-fish > "$ARCHIVE/complete/rg.fish" --generate complete-fish > "$ARCHIVE/complete/rg.fish"
docker run --rm -v \ docker run --rm -v \
"$PWD/target:/target:Z" \ "$PWD/target:/target:Z" \
"rustembedded/cross:${{ matrix.target }}" \ "ghcr.io/cross-rs/${{ matrix.target }}:main" \
"${{ matrix.qemu }}" "/$BIN" \ "${{ matrix.qemu }}" "/$BIN" \
--generate complete-powershell > "$ARCHIVE/complete/_rg.ps1" --generate complete-powershell > "$ARCHIVE/complete/_rg.ps1"
docker run --rm -v \ docker run --rm -v \
"$PWD/target:/target:Z" \ "$PWD/target:/target:Z" \
"rustembedded/cross:${{ matrix.target }}" \ "ghcr.io/cross-rs/${{ matrix.target }}:main" \
"${{ matrix.qemu }}" "/$BIN" \ "${{ matrix.qemu }}" "/$BIN" \
--generate complete-zsh > "$ARCHIVE/complete/_rg" --generate complete-zsh > "$ARCHIVE/complete/_rg"
docker run --rm -v \ docker run --rm -v \
"$PWD/target:/target:Z" \ "$PWD/target:/target:Z" \
"rustembedded/cross:${{ matrix.target }}" \ "ghcr.io/cross-rs/${{ matrix.target }}:main" \
"${{ matrix.qemu }}" "/$BIN" \ "${{ matrix.qemu }}" "/$BIN" \
--generate man > "$ARCHIVE/doc/rg.1" --generate man > "$ARCHIVE/doc/rg.1"

View File

@ -972,7 +972,7 @@ rgtest!(f1404_nothing_searched_warning, |dir: Dir, mut cmd: TestCommand| {
cmd.assert_err(); cmd.assert_err();
// Test that we actually get an error message that we expect. // Test that we actually get an error message that we expect.
let output = cmd.cmd().output().unwrap(); let output = cmd.raw_output();
let stderr = String::from_utf8_lossy(&output.stderr); let stderr = String::from_utf8_lossy(&output.stderr);
let expected = "\ let expected = "\
No files were searched, which means ripgrep probably applied \ No files were searched, which means ripgrep probably applied \
@ -995,7 +995,7 @@ rgtest!(f1404_nothing_searched_ignored, |dir: Dir, mut cmd: TestCommand| {
// But since --no-messages is given, there should not be any error message // But since --no-messages is given, there should not be any error message
// printed. // printed.
let output = cmd.cmd().output().unwrap(); let output = cmd.raw_output();
let stderr = String::from_utf8_lossy(&output.stderr); let stderr = String::from_utf8_lossy(&output.stderr);
let expected = ""; let expected = "";
eqnice!(expected, stderr); eqnice!(expected, stderr);

View File

@ -411,7 +411,7 @@ rgtest!(include_zero, |dir: Dir, mut cmd: TestCommand| {
cmd.args(&["--count", "--include-zero", "nada"]); cmd.args(&["--count", "--include-zero", "nada"]);
cmd.assert_err(); cmd.assert_err();
let output = cmd.cmd().output().unwrap(); let output = cmd.raw_output();
let stdout = String::from_utf8_lossy(&output.stdout); let stdout = String::from_utf8_lossy(&output.stdout);
let expected = "sherlock:0\n"; let expected = "sherlock:0\n";
@ -423,7 +423,7 @@ rgtest!(include_zero_override, |dir: Dir, mut cmd: TestCommand| {
cmd.args(&["--count", "--include-zero", "--no-include-zero", "nada"]); cmd.args(&["--count", "--include-zero", "--no-include-zero", "nada"]);
cmd.assert_err(); cmd.assert_err();
let output = cmd.cmd().output().unwrap(); let output = cmd.raw_output();
let stdout = String::from_utf8_lossy(&output.stdout); let stdout = String::from_utf8_lossy(&output.stdout);
assert!(stdout.is_empty()); assert!(stdout.is_empty());
}); });

View File

@ -399,7 +399,7 @@ rgtest!(r428_unrecognized_style, |dir: Dir, mut cmd: TestCommand| {
cmd.arg("--colors=match:style:").arg("Sherlock"); cmd.arg("--colors=match:style:").arg("Sherlock");
cmd.assert_err(); cmd.assert_err();
let output = cmd.cmd().output().unwrap(); let output = cmd.raw_output();
let stderr = String::from_utf8_lossy(&output.stderr); let stderr = String::from_utf8_lossy(&output.stderr);
let expected = "\ let expected = "\
error parsing flag --colors: \ error parsing flag --colors: \

View File

@ -9,6 +9,8 @@ use std::sync::atomic::{AtomicUsize, Ordering};
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use bstr::ByteSlice;
static TEST_DIR: &'static str = "ripgrep-tests"; static TEST_DIR: &'static str = "ripgrep-tests";
static NEXT_ID: AtomicUsize = AtomicUsize::new(0); static NEXT_ID: AtomicUsize = AtomicUsize::new(0);
@ -325,13 +327,21 @@ impl TestCommand {
/// Gets the output of a command. If the command failed, then this panics. /// Gets the output of a command. If the command failed, then this panics.
pub fn output(&mut self) -> process::Output { pub fn output(&mut self) -> process::Output {
let output = self.cmd.output().unwrap(); let output = self.raw_output();
self.expect_success(output) self.expect_success(output)
} }
/// Gets the raw output of a command after filtering nonsense like jemalloc
/// error messages from stderr.
pub fn raw_output(&mut self) -> process::Output {
let mut output = self.cmd.output().unwrap();
output.stderr = strip_jemalloc_nonsense(&output.stderr);
output
}
/// Runs the command and asserts that it resulted in an error exit code. /// Runs the command and asserts that it resulted in an error exit code.
pub fn assert_err(&mut self) { pub fn assert_err(&mut self) {
let o = self.cmd.output().unwrap(); let o = self.raw_output();
if o.status.success() { if o.status.success() {
panic!( panic!(
"\n\n===== {:?} =====\n\ "\n\n===== {:?} =====\n\
@ -479,7 +489,7 @@ fn dir_list<P: AsRef<Path>>(dir: P) -> Vec<String> {
/// So... we just manually handle these cases. So fucking fun. /// So... we just manually handle these cases. So fucking fun.
fn cross_runner() -> Option<String> { fn cross_runner() -> Option<String> {
let runner = std::env::var("CROSS_RUNNER").ok()?; let runner = std::env::var("CROSS_RUNNER").ok()?;
if runner.is_empty() { if runner.is_empty() || runner == "empty" {
return None; return None;
} }
if cfg!(target_arch = "powerpc64") { if cfg!(target_arch = "powerpc64") {
@ -500,3 +510,17 @@ fn cross_runner() -> Option<String> {
pub fn is_cross() -> bool { pub fn is_cross() -> bool {
std::env::var("CROSS_RUNNER").ok().map_or(false, |v| !v.is_empty()) std::env::var("CROSS_RUNNER").ok().map_or(false, |v| !v.is_empty())
} }
/// Strips absolutely fucked `<jemalloc>:` lines from the output.
///
/// In theory this only happens under qemu, which is where our tests run under
/// `cross`. But is messes with our tests, because... they don't expect the
/// allocator to fucking write to stderr. I mean, what the fuck? Who prints a
/// warning message with absolutely no instruction for what to do with it or
/// how to disable it. Absolutely fucking bonkers.
fn strip_jemalloc_nonsense(data: &[u8]) -> Vec<u8> {
let lines = data
.lines_with_terminator()
.filter(|line| !line.starts_with_str("<jemalloc>:"));
bstr::concat(lines)
}