Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix docker tests trigger on CI #347

Merged
merged 9 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ name: Build/Test/Release

on:
push:
branches: [ "*" ]
tags: [ "v*" ]
pull_request:
branches: [ "master" ]
Expand All @@ -29,6 +28,7 @@ jobs:
with:
submodules: recursive
- uses: ilammy/setup-nasm@v1
if : ${{ matrix.platforms.os == 'windows-2022' }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: stable
Expand All @@ -39,13 +39,13 @@ jobs:
run: cargo check --all --all-features
- name: Run cargo clippy
run: cargo clippy --all --all-features -- -D warnings
- name: Run cargo test on non-macos
if: ${{ matrix.os }} != 'macos-13'
- name: Run cargo test on Linux
if: ${{ matrix.platforms.os == 'ubuntu-22.04' }}
run: cargo test --all --all-features
env:
- name: Run cargo test on non LInux
env: # this is a bit counter intuitive - some tests relies on Docker to run and are marked not(ci), but macos runner doesn't have Docker installed, so we make it "ci" to bypass those tests
CLASH_RS_CI: 'true'
- name: Run cargo test on macos
if: ${{ matrix.os }} == 'macos-13'
if: ${{ matrix.platforms.os != 'ubuntu-22.04' }}
run: cargo test --all --all-features
- name: Build artifacts
run: sh ./scripts/build.sh "${{ matrix.platforms.target }}" "${{ matrix.static }}"
Expand Down
2 changes: 1 addition & 1 deletion clash_lib/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
fn main() {
if std::env::var("CLASH_RS_CI").is_ok() {
println!("cargo:rustc-cfg=ci");
println!("cargo::rustc-cfg=ci");
}
}
3 changes: 2 additions & 1 deletion clash_lib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ async fn start_async(opts: Options) -> Result<(), Error> {

let _g =
app::logging::setup_logging(config.general.log_level, log_collector, &cwd, opts.log_file)
.map_err(|x| Error::InvalidConfig(format!("failed to setup logging: {}", x)))?;
.map_err(|x| eprintln!("failed to setup logging: {}", x))
.unwrap_or_default();

let default_panic = std::panic::take_hook();
std::panic::set_hook(Box::new(move |info| {
Expand Down