add cache

This commit is contained in:
0FL01 2025-07-22 21:17:08 +03:00
parent c248775e7d
commit 4c926115ad

View file

@ -51,15 +51,20 @@ jobs:
- name: Update metainfo.xml with new release - name: Update metainfo.xml with new release
run: | run: |
# Путь к файлу метаданных
METAINFO_FILE="docs/assets/flatpak-files/usr/share/metainfo/com.ayugram.desktop.metainfo.xml" METAINFO_FILE="docs/assets/flatpak-files/usr/share/metainfo/com.ayugram.desktop.metainfo.xml"
# Получаем текущую дату в нужном формате
CURRENT_DATE=$(date +%Y-%m-%d) CURRENT_DATE=$(date +%Y-%m-%d)
echo "Обновление $METAINFO_FILE для версии ${{ env.APP_VERSION }} от $CURRENT_DATE" echo "Обновление $METAINFO_FILE для версии ${{ env.APP_VERSION }} от $CURRENT_DATE"
sed -i '/<releases>/a \ sed -i '/<releases>/a \
<release version="${{ env.APP_VERSION }}" date="'"$CURRENT_DATE"'">\ <release version="${{ env.APP_VERSION }}" date="'"$CURRENT_DATE"'">\
<description>\ <description>\
<p>Автоматическая сборка Flatpak. Синхронизировано с upstream-тегом ${{ env.LATEST_TAG }}.</p>\ <p>Автоматическая сборка Flatpak. Синхронизировано с upstream-тегом ${{ env.LATEST_TAG }}.</p>\
</description>\ </description>\
</release>' "$METAINFO_FILE" </release>' "$METAINFO_FILE"
echo "Файл metainfo.xml успешно обновлен." echo "Файл metainfo.xml успешно обновлен."
- name: Verify that required secrets are set - name: Verify that required secrets are set
@ -73,7 +78,7 @@ jobs:
- name: Install dependencies and Flatpak SDK - name: Install dependencies and Flatpak SDK
run: | run: |
sudo dnf install -y flatpak flatpak-builder python3-pip cpio sudo dnf install -y flatpak flatpak-builder python3-pip
pip3 install --user poetry pip3 install --user poetry
echo "$HOME/.local/bin" >> $GITHUB_PATH echo "$HOME/.local/bin" >> $GITHUB_PATH
flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo flatpak remote-add --user --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
@ -89,45 +94,39 @@ jobs:
- name: Prepare libraries - name: Prepare libraries
run: ./Telegram/build/prepare/linux.sh run: ./Telegram/build/prepare/linux.sh
- name: Prepare ccache binary for the container - name: Cache ccache data
run: |
mkdir -p ${{ github.workspace }}/ccache-bin
cd ${{ github.workspace }}/ccache-bin
curl -L -o ccache.rpm http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/ccache-3.7.7-1.el8.x86_64.rpm
rpm2cpio ccache.rpm | cpio -idmv ./usr/bin/ccache
mv usr/bin/ccache .
rm -rf usr ccache.rpm
echo "ccache binary is ready at ${{ github.workspace }}/ccache-bin/ccache"
- name: Cache ccache directory
uses: actions/cache@v4 uses: actions/cache@v4
id: cache-ccache
with: with:
path: ${{ github.workspace }}/.ccache path: .ccache
key: ${{ runner.os }}-ccache-ayugram-${{ github.ref }} key: ${{ runner.os }}-ccache-${{ github.sha }}
restore-keys: | restore-keys: |
${{ runner.os }}-ccache-ayugram- ${{ runner.os }}-ccache-
- 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 }}
CCACHE_DIR: /ccache
CCACHE_MAXSIZE: 3G
run: | run: |
mkdir -p ${{ github.workspace }}/.ccache mkdir -p .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 "${{ github.workspace }}/ccache-bin:/opt/ccache-bin" \ -v "$PWD/.ccache:/ccache" \
-v "${{ github.workspace }}/.ccache:/ccache" \ -e CCACHE_DIR \
-e CCACHE_DIR="/ccache" \ -e CCACHE_MAXSIZE \
-e PATH="/opt/ccache-bin:$PATH" \ ghcr.io/telegramdesktop/tdesktop/centos_env:latest \
ghcr.io/telegramdesktop/tdesktop/centos_env:latest \ /bin/bash -c "\
set -ex && \
/usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \ /usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \
-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} \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -D USE_CCACHE=ON && \
-D CMAKE_C_COMPILER_LAUNCHER=ccache ccache -s" # Отображение статистики использования кеша
- name: Prepare Flatpak build directory - name: Prepare Flatpak build directory
run: | run: |