Skip to content

Commit

Permalink
feat: start adding os-specific integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno committed Oct 26, 2024
1 parent f976e0c commit 9b66508
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 2 deletions.
45 changes: 43 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,24 @@ jobs:

- name: "Build (native)"
if: ${{ matrix.target == '' }}
run: cargo build --release
run: cargo build --release --all-targets

- name: "Build (cross)"
if: ${{ matrix.target != '' }}
run: cross build --release --target=${{ matrix.target }}
run: cross build --release --all-targets --target=${{ matrix.target }}

- name: "Upload binaries"
uses: actions/upload-artifact@v4
with:
name: binaries-${{ matrix.arch }}-${{ matrix.os }}
path: target/${{ matrix.target }}/release/${{ matrix.binary_name }}

- name: "Upload integration test binaries"
uses: actions/upload-artifact@v4
with:
name: integration-tests-${{ matrix.arch }}-${{ matrix.os }}
path: target/${{ matrix.target }}/release/deps/brush_*_tests-*

# Test functional correctness
test:
strategy:
Expand Down Expand Up @@ -317,3 +323,38 @@ jobs:
pr/benchmarks.txt
main/benchmarks.txt
benchmark-results.md
# Test release binary on a variety of OS platforms.
os-tests:
name: "OS tests"
runs-on: ubuntu-latest
container: fedora:latest
needs: build
steps:
- name: Download binaries
uses: actions/download-artifact@v4
with:
name: binaries-x86_64-linux
path: binaries

- name: Download integration test binaries
uses: actions/download-artifact@v4
with:
name: integration-tests-x86_64-linux
path: binaries

- name: Preview downloads
run: ls -l binaries

- name: Run tests
run: |
export CARGO_TARGET_DIR=binaries
export CARGO_BIN_EXE_brush=binaries/brush
result=0
for test_name in binaries/*tests*; do
echo "Running test: ${test_name}"
${test_name} || result=$?
done
exit ${result}
4 changes: 4 additions & 0 deletions brush-shell/tests/compat_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
//! The test harness for brush shell integration tests.
// Only compile this for Unix-like platforms (Linux, macOS) because they have an oracle to compare
// against.
#![cfg(unix)]

use anyhow::{Context, Result};
use assert_fs::fixture::{FileWriteStr, PathChild};
use clap::Parser;
Expand Down
2 changes: 2 additions & 0 deletions brush-shell/tests/completion_tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
//! Completion integration tests for brush shell.
// For now, only compile this for Linux.
#![cfg(target_os = "linux")]
#![allow(clippy::panic_in_result_fn)]
Expand Down
4 changes: 4 additions & 0 deletions brush-shell/tests/interactive_tests.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
//! Interactive integration tests for brush shell
// For now, only compile this for Unix-like platforms (Linux, macOS).
#![cfg(unix)]
#![allow(clippy::panic_in_result_fn)]

use anyhow::Context;
Expand Down

0 comments on commit 9b66508

Please sign in to comment.