diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9eab65c3..bbf08fc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,15 +25,27 @@ jobs: - if: runner.os == 'Windows' name: Install Gstreamer run: | - choco install -y --no-progress gstreamer --version=1.16.2.20200527 - choco install -y --no-progress gstreamer-devel --version=1.16.2 - echo "Updating Cargo environment" - echo "C:\gstreamer\1.0\x86_64\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append - echo "GSTREAMER_1_0_ROOT_X86_64=C:\gstreamer\1.0\x86_64\" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + # Gstreamer + choco install -y --no-progress gstreamer --version=1.20.0 + choco install -y --no-progress gstreamer-devel --version=1.20.0 + $env:GSTREAMER_1_0_ROOT_MSVC_X86_64=$env:SYSTEMDRIVE + '\gstreamer\1.0\msvc_x86_64\' + # Github runners work on both C or D drive and figuring out which was used is difficult + if (-not (Test-Path -Path "$env:GSTREAMER_1_0_ROOT_MSVC_X86_64" -PathType Container)) { + $env:GSTREAMER_1_0_ROOT_MSVC_X86_64='D:\\gstreamer\1.0\msvc_x86_64\' + } + echo "GSTREAMER_1_0_ROOT_MSVC_X86_64=$env:GSTREAMER_1_0_ROOT_MSVC_X86_64" + + # Set github vars + Add-Content -Path $env:GITHUB_ENV -Value "GSTREAMER_1_0_ROOT_MSVC_X86_64=$env:GSTREAMER_1_0_ROOT_MSVC_X86_64" + Add-Content -Path $env:GITHUB_PATH -Value "$env:GSTREAMER_1_0_ROOT_MSVC_X86_64\bin" + Add-Content -Path $env:GITHUB_PATH -Value "%GSTREAMER_1_0_ROOT_MSVC_X86_64%\bin" + + # One last check on directories + dir "$env:GSTREAMER_1_0_ROOT_MSVC_X86_64" - if: runner.os == 'macOS' name: Install Gstreamer on macOS run: | - curl -L 'https://gstreamer.freedesktop.org/data/pkg/osx/1.16.2/gstreamer-1.0-devel-1.16.2-x86_64.pkg' -o "$(pwd)/gstreamer-devel.pkg" + curl -L 'https://gstreamer.freedesktop.org/data/pkg/osx/1.24.1/gstreamer-1.0-devel-1.24.1-universal.pkg' -o "$(pwd)/gstreamer-devel.pkg" sudo installer -verbose -pkg "$(pwd)/gstreamer-devel.pkg" -target / PKG_CONFIG_PATH="/Library/Frameworks/GStreamer.framework/Versions/1.0/lib/pkgconfig${PKG_CONFIG_PATH:+:$PKG_CONFIG_PATH}" echo "PKG_CONFIG_PATH=${PKG_CONFIG_PATH}" >> "${GITHUB_ENV}" diff --git a/.github/workflows/style_checks.yml b/.github/workflows/style_checks.yml index d1b8bf55..bfbbe3e3 100644 --- a/.github/workflows/style_checks.yml +++ b/.github/workflows/style_checks.yml @@ -7,48 +7,49 @@ jobs: name: Clippy runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: apt install gstreamer - run: | - sudo apt update - sudo apt install -y libgstrtspserver-1.0-dev libgstreamer1.0-dev libgtk2.0-dev - - uses: actions-rs/toolchain@v1 - with: + - uses: actions/checkout@v1 + - name: apt install gstreamer + run: | + sudo apt-get update + sudo apt-get install -y aptitude + sudo aptitude install -y libgstrtspserver-1.0-dev libgstreamer1.0-dev libgtk2.0-dev + - uses: actions-rs/toolchain@v1 + with: toolchain: nightly components: clippy override: true - - name: Run clippy action to produce annotations - uses: actions-rs/clippy-check@v1 - if: steps.check_permissions.outputs.has-permission - with: - toolchain: nightly - token: ${{ secrets.GITHUB_TOKEN }} - args: --workspace --all-targets --all-features - - name: Run clippy manually without annotations - if: ${{ !steps.check_permissions.outputs.has-permission }} - run: cargo +nightly clippy --workspace --all-targets --all-features + - name: Run clippy action to produce annotations + uses: actions-rs/clippy-check@v1 + if: steps.check_permissions.outputs.has-permission + with: + toolchain: nightly + token: ${{ secrets.GITHUB_TOKEN }} + args: --workspace --all-targets --all-features + - name: Run clippy manually without annotations + if: ${{ !steps.check_permissions.outputs.has-permission }} + run: cargo +nightly clippy --workspace --all-targets --all-features check_fmt: name: Rust-fmt runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions-rs/toolchain@v1 - with: + - uses: actions/checkout@v1 + - uses: actions-rs/toolchain@v1 + with: toolchain: nightly components: rustfmt override: true - - name: rustfmt - run: | - cargo +nightly fmt --all -- --check + - name: rustfmt + run: | + cargo +nightly fmt --all -- --check check_lua: name: Luacheck runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - name: Run luacheck - uses: nebularg/actions-luacheck@v1 - with: - files: 'dissector/baichuan.lua' - args: --globals Dissector Proto ProtoField base ByteArray DESEGMENT_ONE_MORE_SEGMENT DissectorTable + - uses: actions/checkout@v1 + - name: Run luacheck + uses: nebularg/actions-luacheck@v1 + with: + files: "dissector/baichuan.lua" + args: --globals Dissector Proto ProtoField base ByteArray DESEGMENT_ONE_MORE_SEGMENT DissectorTable diff --git a/.gitignore b/.gitignore index 78aa81c6..84518cfe 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ # Committing IntelliJ project files is a violation of intergalactic law .idea/ + +.vscode/ +.pre-commit-config.yaml \ No newline at end of file diff --git a/build.rs b/build.rs index 801c3271..334c523e 100644 --- a/build.rs +++ b/build.rs @@ -49,7 +49,11 @@ fn github_ver() -> Option { fn platform_cfg() { let gstreamer_dir = env::var_os("GSTREAMER_1_0_ROOT_X86_64") .and_then(|x| x.into_string().ok()) - .unwrap_or_else(|| r#"C:\gstreamer\1.0\x86_64\"#.to_string()); + .unwrap_or_else(|| { + env::var_os("GSTREAMER_1_0_ROOT_MSVC_X86_64") + .and_then(|x| x.into_string().ok()) + .unwrap_or_else(|| r#"C:\gstreamer\1.0\x86_64\"#.to_string()) + }); println!(r"cargo:rustc-link-search=native={}\lib", gstreamer_dir); } diff --git a/crates/core/src/bc_protocol.rs b/crates/core/src/bc_protocol.rs index 24b9d30c..87131174 100644 --- a/crates/core/src/bc_protocol.rs +++ b/crates/core/src/bc_protocol.rs @@ -26,9 +26,9 @@ use bc::model::*; pub(crate) use connection::*; pub use errors::Error; pub use ledstate::LightState; +pub use motion::{MotionOutput, MotionOutputError, MotionStatus}; pub use pirstate::PirState; pub use resolution::*; -pub use motion::{MotionOutput, MotionOutputError, MotionStatus}; pub use stream::{Stream, StreamOutput, StreamOutputError}; type Result = std::result::Result;