add build ccache

This commit is contained in:
0FL01 2025-07-22 19:38:19 +03:00
parent 875436ce96
commit 71248c7d95

View file

@ -90,30 +90,25 @@ jobs:
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
path: ${{ github.workspace }}/ccache-static/ccache path: ${{ github.workspace }}/ccache-static/ccache
key: ${{ runner.os }}-static-ccache-v1 key: ${{ runner.os }}-static-ccache-v2
- name: Build static ccache - name: Build static ccache
if: steps.static-ccache.outputs.cache-hit != 'true' if: steps.static-ccache.outputs.cache-hit != 'true'
run: | run: |
echo "Статический ccache не найден в кэше, собираем его..."
sudo dnf install -y gcc-c++ cmake git zlib-devel libzstd-devel fmt-devel sudo dnf install -y gcc-c++ cmake git zlib-devel libzstd-devel fmt-devel
git clone --depth=1 --branch v4.10 https://github.com/ccache/ccache.git ccache-source git clone --depth=1 --branch v4.10 https://github.com/ccache/ccache.git ccache-source
cd ccache-source cd ccache-source
mkdir build && cd build mkdir build && cd build
cmake .. \ cmake .. \
-DCMAKE_BUILD_TYPE=Release \ -DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=OFF \ -DBUILD_SHARED_LIBS=OFF \
-DSTATIC_LINKING=ON \ -DENABLE_TESTING=OFF \
-DENABLE_TESTING=OFF -DHIREDIS_FROM_INTERNET=ON \
-DCMAKE_EXE_LINKER_FLAGS="-static -static-libgcc -static-libstdc++" \
-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY
cmake --build . -j$(nproc) cmake --build . -j$(nproc)
mkdir -p ${{ github.workspace }}/ccache-static mkdir -p ${{ github.workspace }}/ccache-static
cp ./ccache ${{ github.workspace }}/ccache-static/ccache cp ./ccache ${{ github.workspace }}/ccache-static/ccache
echo "Статический ccache успешно собран."
- name: Cache TDesktop Dependencies - name: Cache TDesktop Dependencies
id: cache-tdesktop-deps id: cache-tdesktop-deps
@ -122,10 +117,6 @@ jobs:
path: Telegram/ThirdParty path: Telegram/ThirdParty
key: ${{ runner.os }}-tdeps-${{ hashFiles('Telegram/build/prepare/dependencies.txt') }} key: ${{ runner.os }}-tdeps-${{ hashFiles('Telegram/build/prepare/dependencies.txt') }}
- name: Install ccache on runner
run: |
sudo dnf install -y ccache
- name: Cache ccache directory - name: Cache ccache directory
uses: actions/cache@v4 uses: actions/cache@v4
with: with:
@ -137,19 +128,21 @@ jobs:
- name: Prepare libraries - name: Prepare libraries
run: ./Telegram/build/prepare/linux.sh run: ./Telegram/build/prepare/linux.sh
- name: Zero ccache statistics before build
run: |
${{ github.workspace }}/ccache-static/ccache -z --config-path=${{ github.workspace }}/.ccache/ccache.conf
- name: Build AyuGram binary - name: Build AyuGram binary
env: env:
TDESKTOP_API_ID: ${{ secrets.TDESKTOP_API_ID }} TDESKTOP_API_ID: ${{ secrets.TDESKTOP_API_ID }}
TDESKTOP_API_HASH: ${{ secrets.TDESKTOP_API_HASH }} TDESKTOP_API_HASH: ${{ secrets.TDESKTOP_API_HASH }}
run: | run: |
mkdir -p ${{ github.workspace }}/.ccache mkdir -p ${{ github.workspace }}/.ccache
docker run --rm \ docker run --rm \
--cpus="3" \ --cpus="3" \
-u $(id -u):$(id -g) \ -u $(id -u):$(id -g) \
-v "$PWD:/usr/src/tdesktop" \ -v "$PWD:/usr/src/tdesktop" \
-v "/usr/bin/ccache:/usr/local/bin/ccache:ro" \ -v "${{ github.workspace }}/ccache-static/ccache:/usr/local/bin/ccache:ro" \
-v "${{ github.workspace }}/.ccache:/home/user/.ccache" \ -v "${{ github.workspace }}/.ccache:/home/user/.ccache" \
-e "CCACHE_DIR=/home/user/.ccache" \ -e "CCACHE_DIR=/home/user/.ccache" \
ghcr.io/telegramdesktop/tdesktop/centos_env:latest \ ghcr.io/telegramdesktop/tdesktop/centos_env:latest \
@ -159,6 +152,11 @@ jobs:
-D TDESKTOP_API_ID=${TDESKTOP_API_ID} \ -D TDESKTOP_API_ID=${TDESKTOP_API_ID} \
-D TDESKTOP_API_HASH=${TDESKTOP_API_HASH} -D TDESKTOP_API_HASH=${TDESKTOP_API_HASH}
- name: Show ccache statistics and cache size
run: |
${{ github.workspace }}/ccache-static/ccache -s --config-path=${{ github.workspace }}/.ccache/ccache.conf
du -sh ${{ github.workspace }}/.ccache
- name: Prepare Flatpak build directory - name: Prepare Flatpak build directory
run: | run: |
mkdir -p ayugram-flatpak-build mkdir -p ayugram-flatpak-build