From 1e620d15df79a91944ff80d5e52d29d2e1a9b5f2 Mon Sep 17 00:00:00 2001 From: Andrew King Date: Thu, 11 Apr 2024 09:45:21 +0700 Subject: [PATCH 1/6] Update build.yml --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9eab65c3..6799caaf 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,7 +33,7 @@ jobs: - 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}" From 2deac96af4f357730faf748d59e80b4933da3ab4 Mon Sep 17 00:00:00 2001 From: Andrew King Date: Thu, 11 Apr 2024 09:50:42 +0700 Subject: [PATCH 2/6] Update to windows too --- .github/workflows/build.yml | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6799caaf..bbf08fc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -25,11 +25,23 @@ 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: | From 7a920fb09a963854b8c32b40ae40eabe7f08d2b8 Mon Sep 17 00:00:00 2001 From: Andrew King Date: Thu, 11 Apr 2024 09:51:40 +0700 Subject: [PATCH 3/6] Update build.rs --- build.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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); } From f31d9486717300ed7f9fcf9a311fe94670a492a0 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Thu, 11 Apr 2024 10:01:39 +0700 Subject: [PATCH 4/6] Cargo fmt --- crates/core/src/bc_protocol.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; From e7268f248135edb0eec2c94b59b6ec53f7766f92 Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Thu, 11 Apr 2024 10:12:59 +0700 Subject: [PATCH 5/6] Swapping to newer config format --- .cargo/{config => config.toml} | 0 .gitignore | 3 +++ 2 files changed, 3 insertions(+) rename .cargo/{config => config.toml} (100%) diff --git a/.cargo/config b/.cargo/config.toml similarity index 100% rename from .cargo/config rename to .cargo/config.toml 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 From 0eddab0b2e0a9ec7d135a7fd8c42fca8cf8668dc Mon Sep 17 00:00:00 2001 From: QuantumEntangledAndy Date: Thu, 11 Apr 2024 10:20:26 +0700 Subject: [PATCH 6/6] Use aptitude over apt for resolving conflicts --- .github/workflows/style_checks.yml | 59 +++++++++++++++--------------- 1 file changed, 30 insertions(+), 29 deletions(-) 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