Skip to content

Commit 829899f

Browse files
committed
ci: add actions/cache to environment-check, use RUNNER_TEMP for build sources
1 parent cde6f71 commit 829899f

1 file changed

Lines changed: 21 additions & 8 deletions

File tree

.github/actions/environment-check/action.yml

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,18 @@ inputs:
2323
runs:
2424
using: composite
2525
steps:
26+
- name: Restore environment cache
27+
id: env-cache
28+
uses: actions/cache@0057852bfaa89a56745cba8c7296529d2fc39830 # v4
29+
with:
30+
path: |
31+
/usr/local/lib
32+
/usr/local/include
33+
/usr/local/bin
34+
/usr/local/share
35+
${{ runner.temp }}/mtl-source
36+
key: env-dpdk-${{ inputs.dpdk-version }}-mtl-${{ inputs.mtl-version }}-ffmpeg-${{ inputs.ffmpeg-version }}-${{ runner.os }}
37+
2638
- name: Install APT packages
2739
shell: bash
2840
run: |
@@ -84,17 +96,18 @@ runs:
8496
MTL_VERSION: ${{ inputs.mtl-version }}
8597
run: |
8698
echo "===== DPDK Setup ====="
99+
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH:-}
87100
if pkg-config --exists libdpdk 2>/dev/null; then
88-
echo " [OK] libdpdk ($(pkg-config --modversion libdpdk))"
101+
echo " [OK] libdpdk ($(pkg-config --modversion libdpdk)) — skipping build (cached)"
89102
exit 0
90103
fi
91104
echo " Building DPDK $DPDK_VERSION from source..."
92-
MTL_SOURCE="$HOME/Media-Transport-Library"
105+
MTL_SOURCE="$RUNNER_TEMP/mtl-source"
93106
if [ ! -d "$MTL_SOURCE" ]; then
94107
git clone https://github.com/OpenVisualCloud/Media-Transport-Library.git "$MTL_SOURCE"
95108
cd "$MTL_SOURCE" && git checkout "$MTL_VERSION"
96109
fi
97-
cd "$HOME"
110+
cd "$RUNNER_TEMP"
98111
git clone https://github.com/DPDK/dpdk.git
99112
cd dpdk
100113
git checkout "v$DPDK_VERSION"
@@ -114,11 +127,11 @@ runs:
114127
echo "===== MTL Setup ====="
115128
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH:-}
116129
if pkg-config --exists mtl 2>/dev/null; then
117-
echo " [OK] mtl ($(pkg-config --modversion mtl))"
130+
echo " [OK] mtl ($(pkg-config --modversion mtl)) — skipping build (cached)"
118131
exit 0
119132
fi
120133
echo " Building MTL $MTL_VERSION from source..."
121-
MTL_SOURCE="$HOME/Media-Transport-Library"
134+
MTL_SOURCE="$RUNNER_TEMP/mtl-source"
122135
if [ ! -d "$MTL_SOURCE" ]; then
123136
git clone https://github.com/OpenVisualCloud/Media-Transport-Library.git "$MTL_SOURCE"
124137
cd "$MTL_SOURCE" && git checkout "$MTL_VERSION"
@@ -155,12 +168,12 @@ runs:
155168
echo "===== FFmpeg Setup ====="
156169
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/local/lib/x86_64-linux-gnu/pkgconfig:${PKG_CONFIG_PATH:-}
157170
if command -v ffmpeg &>/dev/null && ffmpeg -devices 2>&1 | grep -qi mtl; then
158-
echo " [OK] FFmpeg with MTL plugin already installed"
171+
echo " [OK] FFmpeg with MTL plugin already installed — skipping build (cached)"
159172
exit 0
160173
fi
161174
echo " Building FFmpeg $FFMPEG_VERSION with MTL plugin from source..."
162-
MTL_SOURCE="$HOME/Media-Transport-Library"
163-
cd "$HOME"
175+
MTL_SOURCE="$RUNNER_TEMP/mtl-source"
176+
cd "$RUNNER_TEMP"
164177
git clone https://github.com/FFmpeg/FFmpeg.git
165178
cd FFmpeg
166179
git checkout "release/$FFMPEG_VERSION"

0 commit comments

Comments
 (0)