Skip to content

Commit

Permalink
ci: add automated tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DenizUgur committed Jan 31, 2025
1 parent 6b30538 commit aac0bc8
Show file tree
Hide file tree
Showing 3 changed files with 81 additions and 14 deletions.
27 changes: 15 additions & 12 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,9 @@ jobs:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

# These steps install the dependencies needed for the build
- if: matrix.build-mode == 'manual'
name: Install GStreamer
shell: bash
run: sudo apt-get install -y libgstreamer1.0-dev
- if: matrix.build-mode == 'manual'
name: Install GPAC
# These steps install the dependencies needed for the build
- name: Install GPAC
if: matrix.language == 'c-cpp'
shell: bash
working-directory: ${{ runner.temp }}
run: |
Expand All @@ -52,15 +48,22 @@ jobs:
./configure && make -j
sudo make install
# This step builds the project.
- if: matrix.build-mode == 'manual'
name: Build
- name: Install GStreamer
if: matrix.language == 'c-cpp'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libgstreamer1.0-dev
# This step builds the project.
- name: Build
if: matrix.language == 'c-cpp'
shell: bash
run: |
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -B build
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=Release -B build
cmake --build build -j
# This step performs the CodeQL analysis.
# This step performs the CodeQL analysis.
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Tests

on:
push:
branches: ["main"]
pull_request:

permissions:
contents: read

jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

# These steps install the dependencies needed for the build
- name: Install GPAC
shell: bash
working-directory: ${{ runner.temp }}
run: |
git clone --depth 1 https://github.com/gpac/gpac.git
cd gpac
./configure && make -j
sudo make install
- name: Install GStreamer
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev
# This step installs the Rust toolchain
- name: Install Rust
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8

# This step installs the dependencies needed for the tests
- name: Install cmafmux element
shell: bash
working-directory: ${{ runner.temp }}
run: |
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
cd gst-plugins-rs
cargo install cargo-c
cargo cbuild -p gst-plugin-fmp4
cargo cinstall -p gst-plugin-fmp4 --destdir bin
mkdir -p $HOME/.local/share/gstreamer-1.0/plugins
cp bin/usr/local/lib/x86_64-linux-gnu/gstreamer-1.0/libgstfmp4.so $HOME/.local/share/gstreamer-1.0/plugins/
# This step builds the project.
- name: Build
shell: bash
run: |
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DENABLE_TESTS=ON -DCMAKE_BUILD_TYPE=Debug -B build
cmake --build build -j
# Run the tests
- name: Test
shell: bash
env:
GST_PLUGIN_PATH: ${{ github.workspace}}/build:$HOME/.local/share/gstreamer-1.0/plugins
GST_DEBUG: 3
run: ./build/tests/gstgpacplugin_test
4 changes: 2 additions & 2 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ endif()
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/2b6b042a77446ff322cd7522ca068d9f2a21c1d1.zip
DOWNLOAD_EXTRACT_TIMESTAMP
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG 2b6b042a77446ff322cd7522ca068d9f2a21c1d1
)

# For Windows: Prevent overriding the parent project's compiler/linker settings
Expand Down

0 comments on commit aac0bc8

Please sign in to comment.