Skip to content

Commit

Permalink
ci: enable caching for dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
DenizUgur committed Feb 1, 2025
1 parent 1eff38e commit 952252b
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 45 deletions.
107 changes: 107 additions & 0 deletions .github/actions/deps/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
name: "Plugin Dependencies"
description: "Install dependencies for the plugin"

inputs:
for-test:
description: "Whether the plugin is being built for testing"
required: false
default: false
type: boolean

runs:
using: "composite"
steps:
- name: Retrieve gpac HEAD commit
id: gpac-commit
shell: bash
run: |
head_sha=$(git ls-remote https://github.com/gpac/gpac.git HEAD | awk '{ print $1 }')
echo "gpac-commit=$head_sha" >> $GITHUB_OUTPUT
- name: Cache gpac
id: cache-gpac
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/gpac
key: gpac-${{ steps.gpac-commit.outputs.gpac-commit }}
restore-keys: |
gpac-
- name: Clone gpac
if: steps.cache-gpac.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ runner.temp }}
run: |
if [ -d gpac ]; then
cd gpac
git clean -fdx
git pull
else
git clone --depth 1 https://github.com/gpac/gpac.git
- name: Compile gpac
working-directory: ${{ runner.temp }}/gpac
shell: bash
run: ./configure && make -j

- name: Install gpac
working-directory: ${{ runner.temp }}/gpac
shell: bash
run: 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
- name: Retrieve gst-plugins-rs HEAD commit
if: inputs.for-test
id: gst-commit
shell: bash
run: |
head_sha=$(git ls-remote https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git HEAD | awk '{ print $1 }')
echo "gst-commit=$head_sha" >> $GITHUB_OUTPUT
- name: Cache gst
if: inputs.for-test
id: cache-gst
uses: actions/cache@v4
with:
path: ${{ runner.temp }}/gst-plugins-rs
key: gst-${{ steps.gst-commit.outputs.gst-commit }}
restore-keys: |
gst-
- name: Install Rust
if: inputs.for-test && steps.cache-gst.outputs.cache-hit != 'true'
uses: actions-rust-lang/setup-rust-toolchain@11df97af8e8102fd60b60a77dfbf58d40cd843b8

- name: Clone gst-plugins-rs
if: inputs.for-test && steps.cache-gst.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ runner.temp }}
run: |
if [ -d gst-plugins-rs ]; then
cd gst-plugins-rs
git clean -fdx
git pull
else
git clone --depth 1 https://gitlab.freedesktop.org/gstreamer/gst-plugins-rs.git
- name: Compile cmafmux element
if: inputs.for-test && steps.cache-gst.outputs.cache-hit != 'true'
shell: bash
working-directory: ${{ runner.temp }}/gst-plugins-rs
run: |
cargo install cargo-c
cargo cbuild -p gst-plugin-fmp4
cargo cinstall -p gst-plugin-fmp4 --destdir bin
- name: Install cmafmux element
if: inputs.for-test
shell: bash
working-directory: ${{ runner.temp }}/gst-plugins-rs
run: |
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/
17 changes: 2 additions & 15 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,22 +38,9 @@ jobs:
build-mode: ${{ matrix.build-mode }}

# These steps install the dependencies needed for the build
- name: Install GPAC
- name: Install gpac and GStreamer
if: matrix.language == 'c-cpp'
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
if: matrix.language == 'c-cpp'
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libgstreamer1.0-dev
uses: ./.github/actions/deps

# This step builds the project.
- name: Build
Expand Down
37 changes: 7 additions & 30 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,50 +15,27 @@ jobs:
- 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 gpac and GStreamer
uses: ./.github/actions/deps
with:
for-test: true

- name: Install GStreamer
- name: Install Ugly plugins (for x264enc)
shell: bash
run: |
sudo apt-get update
sudo apt-get install -y libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-plugins-ugly
# 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/
sudo apt-get install -y gstreamer1.0-plugins-ugly
# 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 -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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,7 @@ build/
# Dot files
graph/

# GitHub Actions
!.github/**/*

# End of https://www.toptal.com/developers/gitignore/api/visualstudiocode,cmake,macos,linux

0 comments on commit 952252b

Please sign in to comment.