Skip to content

Commit

Permalink
Scripts: Speed up GH action, install scripts.
Browse files Browse the repository at this point in the history
  • Loading branch information
realazthat committed Sep 9, 2024
1 parent e03130e commit c3b11eb
Show file tree
Hide file tree
Showing 4 changed files with 118 additions and 72 deletions.
14 changes: 13 additions & 1 deletion .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,19 @@ jobs:
GH_ACTION_UNIQUE_ID="${{ github.run_id }}-$MATRIX_HASH"
echo "GH_ACTION_UNIQUE_ID=$GH_ACTION_UNIQUE_ID" >> $GITHUB_ENV
- uses: actions/checkout@v4
# Install a specific version of Rust and Cargo
- name: Install specific Rust version
uses: actions-rs/toolchain@v1
with:
toolchain: 1.81.0 # Specify the Rust version you want (Cargo comes bundled)
profile: minimal
- name: Cache Cargo registry
uses: actions/cache@v3
with:
path: ~/.cargo/registry
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-registry-
- name: Set up Node
uses: actions/setup-node@v4
with:
Expand All @@ -53,7 +66,6 @@ jobs:
# curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
- name: Run everything
run: |
source "$HOME/.cargo/env"
npm install -g npm@latest
npm install
bash scripts/pre.sh
84 changes: 49 additions & 35 deletions scripts/install-reqs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
set -e -x -v -u -o pipefail

GREEN='\033[0;32m'
NC='\033[0m'


TMPDIR=$(mktemp -d)
function cleanup {
Expand All @@ -15,42 +18,53 @@ trap cleanup EXIT
################################################################################
bash scripts/utilities/install-basic.sh
################################################################################
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
cargo install --git https://github.com/Y2Z/monolith.git --rev b6b358b3bceabecf2676dfa887e849ab2f550610
monolith --version
################################################################################
# For examples/tests:# See .github/dependencies.yml for the list of dependencies.
sudo apt-get update && sudo apt-get install -y bash findutils grep xxd git xxhash rsync expect jq libcairo2-dev libjpeg-dev libpango1.0-dev libgif-dev build-essential g++ ffmpeg gifsicle
################################################################################
sudo apt update
sudo apt install -y yasm nasm cmake libtool autoconf automake git pkg-config \
build-essential
################################################################################
cd "${TMPDIR}"
git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git
cd SVT-AV1
mkdir build.cmake
cd build.cmake
cmake ..
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://aomedia.googlesource.com/aom
cd aom
mkdir build.tmp && cd build.tmp
cmake -G "Unix Makefiles" ../ -DCMAKE_INSTALL_PREFIX=/usr/local
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-libaom --enable-libsvtav1
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
if ! cargo --version; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
fi
################################################################################
if ! monolith --version; then
cargo install --git https://github.com/Y2Z/monolith.git --rev b6b358b3bceabecf2676dfa887e849ab2f550610
monolith --version
fi
################################################################################
if ! ffmpeg -codecs | grep -E 'libaom|libvpx'; then
sudo apt update
sudo apt install -y yasm nasm cmake libtool autoconf automake git pkg-config \
build-essential
################################################################################
cd "${TMPDIR}"
git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git
cd SVT-AV1
mkdir build.cmake
cd build.cmake
cmake ..
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://aomedia.googlesource.com/aom
cd aom
mkdir build.tmp && cd build.tmp
cmake -G "Unix Makefiles" ../ -DCMAKE_INSTALL_PREFIX=/usr/local
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-libaom --enable-libsvtav1
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
ffmpeg -codecs | grep -E 'libaom|libvpx'
echo -e "${GREEN}ffmpeg is installed.${NC}"
fi

echo -e "${GREEN}All dependencies are installed.${NC}"
84 changes: 49 additions & 35 deletions scripts/install-reqs.sh.jinja2
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# https://gist.github.com/mohanpedala/1e2ff5661761d3abd0385e8223e16425
set -e -x -v -u -o pipefail

GREEN='\033[0;32m'
NC='\033[0m'


TMPDIR=$(mktemp -d)
function cleanup {
Expand All @@ -11,44 +14,55 @@ trap cleanup EXIT
################################################################################
bash scripts/utilities/install-basic.sh
################################################################################
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
cargo install --git https://github.com/Y2Z/monolith.git --rev b6b358b3bceabecf2676dfa887e849ab2f550610
monolith --version
################################################################################
# For examples/tests:
{%- set dev_dependencies=shell('python -m yq -r -c \'.dev | keys_unsorted | join(" ")\' .github/dependencies.yml', include_args=False)|trim -%}
# See .github/dependencies.yml for the list of dependencies.
sudo apt-get update && sudo apt-get install -y {{dev_dependencies}}
################################################################################
sudo apt update
sudo apt install -y yasm nasm cmake libtool autoconf automake git pkg-config \
build-essential
################################################################################
cd "${TMPDIR}"
git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git
cd SVT-AV1
mkdir build.cmake
cd build.cmake
cmake ..
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://aomedia.googlesource.com/aom
cd aom
mkdir build.tmp && cd build.tmp
cmake -G "Unix Makefiles" ../ -DCMAKE_INSTALL_PREFIX=/usr/local
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-libaom --enable-libsvtav1
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
if ! cargo --version; then
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
. "$HOME/.cargo/env"
fi
################################################################################
if ! monolith --version; then
cargo install --git https://github.com/Y2Z/monolith.git --rev b6b358b3bceabecf2676dfa887e849ab2f550610
monolith --version
fi
################################################################################
if ! ffmpeg -codecs | grep -E 'libaom|libvpx'; then
sudo apt update
sudo apt install -y yasm nasm cmake libtool autoconf automake git pkg-config \
build-essential
################################################################################
cd "${TMPDIR}"
git clone https://gitlab.com/AOMediaCodec/SVT-AV1.git
cd SVT-AV1
mkdir build.cmake
cd build.cmake
cmake ..
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://aomedia.googlesource.com/aom
cd aom
mkdir build.tmp && cd build.tmp
cmake -G "Unix Makefiles" ../ -DCMAKE_INSTALL_PREFIX=/usr/local
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
cd "${TMPDIR}"
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
./configure --enable-libaom --enable-libsvtav1
make -j$(nproc)
sudo make install
sudo ldconfig /usr/local/lib
################################################################################
ffmpeg -codecs | grep -E 'libaom|libvpx'
echo -e "${GREEN}ffmpeg is installed.${NC}"
fi

echo -e "${GREEN}All dependencies are installed.${NC}"
8 changes: 7 additions & 1 deletion scripts/utilities/install-basic.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ BLUE='\033[0;34m'
GREEN='\033[0;32m'
NC='\033[0m'

TMPDIR=$(mktemp -d)
function cleanup {
rm -rf "${TMPDIR}" || true
}
trap cleanup EXIT

################################################################################
sudo apt update
sudo apt install -y bash findutils grep xxd git xxhash rsync expect jq unzip \
Expand Down Expand Up @@ -47,7 +53,7 @@ fi
NVM_DIR="${NVM_DIR:-"${HOME}/.nvm"}"
# sourcing nvm.sh when .nvmrc is present can return an error with no message
# (https://github.com/nvm-sh/nvm/issues/1985).
rm .nvmrc || true
cd ${TMPDIR}
{ set +x +v; } 2>/dev/null; [[ -s "${NVM_DIR}/nvm.sh" ]] && \. "${NVM_DIR}/nvm.sh"; set -x -v
NVM_VERSION=$(nvm --version 2>/dev/null || true)

Expand Down

0 comments on commit c3b11eb

Please sign in to comment.