mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
chore(build): cache apt packages between runs
For now only in the windows docker. This saves a lot of bandwidth when doing test builds locally.
This commit is contained in:
parent
900e48ef48
commit
a91c70b0c0
|
@ -97,10 +97,31 @@ fi
|
||||||
|
|
||||||
readonly BUILD_DIR="/build"
|
readonly BUILD_DIR="/build"
|
||||||
readonly DEP_DIR="$WORKSPACE_DIR/$ARCH/dep-cache"
|
readonly DEP_DIR="$WORKSPACE_DIR/$ARCH/dep-cache"
|
||||||
|
readonly APT_CACHE_DIR="$WORKSPACE_DIR/$ARCH/apt_cache"
|
||||||
|
|
||||||
|
# Create the expected directory structure
|
||||||
|
|
||||||
|
# Just make sure those exist
|
||||||
|
mkdir -p "$WORKSPACE_DIR"
|
||||||
|
mkdir -p "$DEP_DIR"
|
||||||
|
mkdir -p "$APT_CACHE_DIR"
|
||||||
|
|
||||||
|
# Build dir should be empty
|
||||||
|
rm -rf "$BUILD_DIR"
|
||||||
|
mkdir -p "$BUILD_DIR"
|
||||||
|
cd "$BUILD_DIR"
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
echo "Restoring package cache"
|
||||||
|
# ensure at least one file exists
|
||||||
|
touch "$APT_CACHE_DIR"/dummy
|
||||||
|
# restore apt cache
|
||||||
|
cp -r "$APT_CACHE_DIR"/* /var/cache/
|
||||||
|
|
||||||
|
# remove docker specific config file, this file prevents usage of the package cache
|
||||||
|
rm /etc/apt/apt.conf.d/docker-clean
|
||||||
|
|
||||||
|
|
||||||
# Get packages
|
# Get packages
|
||||||
|
|
||||||
|
@ -145,18 +166,6 @@ fi
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
|
|
||||||
# Create the expected directory structure
|
|
||||||
|
|
||||||
# Just make sure those exist
|
|
||||||
mkdir -p "$WORKSPACE_DIR"
|
|
||||||
mkdir -p "$DEP_DIR"
|
|
||||||
|
|
||||||
# Build dir should be empty
|
|
||||||
rm -rf "$BUILD_DIR"
|
|
||||||
mkdir -p "$BUILD_DIR"
|
|
||||||
cd "$BUILD_DIR"
|
|
||||||
|
|
||||||
|
|
||||||
# Use all cores for building
|
# Use all cores for building
|
||||||
|
|
||||||
MAKEFLAGS=j$(nproc)
|
MAKEFLAGS=j$(nproc)
|
||||||
|
@ -206,6 +215,14 @@ strip_all()
|
||||||
set -e
|
set -e
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Store apt cache
|
||||||
|
store_apt_cache()
|
||||||
|
{
|
||||||
|
# prevent old packages from polluting the cache
|
||||||
|
apt-get autoclean
|
||||||
|
cp -r /var/cache/apt/ "$APT_CACHE_DIR"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
# OpenSSL
|
# OpenSSL
|
||||||
|
|
||||||
|
@ -360,6 +377,7 @@ if [[ "$TRAVIS_CI_STAGE" == "stage1" ]]
|
||||||
then
|
then
|
||||||
# Strip to reduce cache size
|
# Strip to reduce cache size
|
||||||
strip_all
|
strip_all
|
||||||
|
store_apt_cache
|
||||||
# Chmod since everything is root:root
|
# Chmod since everything is root:root
|
||||||
chmod 777 -R "$WORKSPACE_DIR"
|
chmod 777 -R "$WORKSPACE_DIR"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1070,6 +1088,7 @@ if [[ "$TRAVIS_CI_STAGE" == "stage2" ]]
|
||||||
then
|
then
|
||||||
# Strip to reduce cache size
|
# Strip to reduce cache size
|
||||||
strip_all
|
strip_all
|
||||||
|
store_apt_cache
|
||||||
# Chmod since everything is root:root
|
# Chmod since everything is root:root
|
||||||
chmod 777 -R "$WORKSPACE_DIR"
|
chmod 777 -R "$WORKSPACE_DIR"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -1236,5 +1255,8 @@ fi
|
||||||
cd ..
|
cd ..
|
||||||
rm -rf ./qtox
|
rm -rf ./qtox
|
||||||
|
|
||||||
|
# Cache APT packages for future runs
|
||||||
|
store_apt_cache
|
||||||
|
|
||||||
# Chmod since everything is root:root
|
# Chmod since everything is root:root
|
||||||
chmod 777 -R "$WORKSPACE_DIR"
|
chmod 777 -R "$WORKSPACE_DIR"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user