forked from telegramdesktop/tdesktop
-
Notifications
You must be signed in to change notification settings - Fork 20
210 lines (187 loc) · 6.96 KB
/
Copy pathlinux.yml
File metadata and controls
210 lines (187 loc) · 6.96 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
name: Linux.
on:
push:
paths-ignore:
- 'docs/**'
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/linux.yml'
- 'snap/**'
- 'Telegram/build/**'
- '!Telegram/build/docker/centos_env/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.bat'
- 'Telegram/Telegram.plist'
pull_request:
paths-ignore:
- 'docs/**'
- '**.md'
- 'changelog.txt'
- 'LEGAL'
- 'LICENSE'
- '.github/**'
- '!.github/workflows/linux.yml'
- 'snap/**'
- 'Telegram/build/**'
- '!Telegram/build/docker/centos_env/**'
- 'Telegram/Resources/uwp/**'
- 'Telegram/Resources/winrc/**'
- 'Telegram/SourceFiles/platform/win/**'
- 'Telegram/SourceFiles/platform/mac/**'
- 'Telegram/Telegram/**'
- 'Telegram/configure.bat'
- 'Telegram/Telegram.plist'
jobs:
linux:
name: Rocky Linux 8
runs-on: ${{ (github.event_name == 'pull_request' || startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/nightly') && 'depot-ubuntu-latest-16' || 'ubuntu-latest' }}
strategy:
matrix:
defines:
- ""
env:
UPLOAD_ARTIFACT: "true"
ONLY_CACHE: "false"
IMAGE_TAG: tdesktop:centos_env
steps:
- name: Clone.
uses: actions/checkout@v7
with:
submodules: recursive
- name: First set up.
run: |
sudo apt update
curl -sSL https://install.python-poetry.org | python3 -
curl -sSL https://github.com/ccache/ccache/releases/download/v4.13.6/ccache-4.13.6-linux-x86_64-glibc.tar.xz \
| sudo tar xJ -C /usr/local/bin --strip-components=1 ccache-4.13.6-linux-x86_64-glibc/ccache
echo "CCACHE_DIR=$RUNNER_TEMP/.tdesktop-cache" >> $GITHUB_ENV
cd Telegram/build/docker/centos_env
poetry install
DOCKERFILE=$(DEBUG= LTO= poetry run gen_dockerfile)
echo "$DOCKERFILE" > Dockerfile
rm -rf __pycache__
- name: Free up some disk space.
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be
with:
tool-cache: true
- name: Set up Docker Buildx.
id: setup-buildx
uses: docker/setup-buildx-action@v4
- name: Libraries cache.
id: cache-libs
uses: actions/cache@v6
with:
path: |
${{ runner.temp }}/.buildx-cache
${{ runner.temp }}/.mount-cache
key: ${{ runner.OS }}-libs-${{ hashFiles('Telegram/build/docker/centos_env/**') }}
restore-keys: ${{ runner.OS }}-libs-
- name: Restore Docker cache mounts.
uses: reproducible-containers/buildkit-cache-dance@5422eac04292c961a382e0f584ea0f03ad9da723
with:
builder: ${{ steps.setup-buildx.outputs.name }}
cache-dir: ${{ runner.temp }}/.mount-cache
dockerfile: Telegram/build/docker/centos_env/Dockerfile
skip-extraction: ${{ steps.cache-libs.outputs.cache-hit }}
- name: Libraries.
uses: docker/build-push-action@v7
with:
context: Telegram/build/docker/centos_env
load: ${{ env.ONLY_CACHE == 'false' }}
tags: ${{ env.IMAGE_TAG }}
cache-from: type=local,src=${{ runner.temp }}/.buildx-cache
cache-to: type=local,dest=${{ runner.temp }}/.buildx-cache-new,mode=max
- name: Move cache.
run: |
rm -rf ${{ runner.temp }}/.buildx-cache
mv ${{ runner.temp }}/.buildx-cache{-new,}
- name: Restore Telegram Desktop cache.
id: cache-tdesktop
if: env.ONLY_CACHE == 'false'
uses: actions/cache/restore@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ runner.OS }}-tdesktop-${{ matrix.defines || 'null' }}-${{ github.run_id }}
restore-keys: ${{ runner.OS }}-tdesktop-${{ matrix.defines || 'null' }}-
- name: Telegram Desktop build.
if: env.ONLY_CACHE == 'false'
run: |
DEFINE=""
if [ -n "${{ matrix.defines }}" ]; then
DEFINE="-D ${{ matrix.defines }}=ON"
echo Define from matrix: $DEFINE
echo "ARTIFACT_NAME=Telegram ${{ matrix.defines }}" >> $GITHUB_ENV
else
echo "ARTIFACT_NAME=Telegram" >> $GITHUB_ENV
fi
ccache -z
docker run --rm \
-u $(id -u) \
-v $PWD:/usr/src/tdesktop \
-v ${{ env.CCACHE_DIR }}:/var/cache/ccache \
-e CONFIG=Debug \
-e CCACHE_SLOPPINESS=pch_defines,time_macros \
$IMAGE_TAG \
env -u CCACHE_DISABLE /usr/src/tdesktop/Telegram/build/docker/centos_env/build.sh \
-D CMAKE_CONFIGURATION_TYPES=Debug \
-D CMAKE_C_FLAGS_DEBUG="-O0 -fpch-preprocess" \
-D CMAKE_CXX_FLAGS_DEBUG="-O0 -fpch-preprocess" \
-D CMAKE_COMPILE_WARNING_AS_ERROR=ON \
-D TDESKTOP_API_TEST=ON \
-D DESKTOP_APP_DISABLE_AUTOUPDATE=OFF \
-D DESKTOP_APP_DISABLE_CRASH_REPORTS=OFF \
$DEFINE
- name: Count ccache misses.
id: ccache-stats
if: env.ONLY_CACHE == 'false'
run: |
MISSES=$(ccache --print-stats | sed -n 's/^cache_miss\t//p' | head -1)
case "$MISSES" in (*[!0-9]*|'') MISSES=0;; esac
echo "misses=$MISSES" >> $GITHUB_OUTPUT
echo "ccache misses this run: $MISSES"
- name: Trim Telegram Desktop cache.
if: >
env.ONLY_CACHE == 'false'
&& github.ref_name == github.event.repository.default_branch
&& fromJSON(steps.ccache-stats.outputs.misses) > 300
run: ccache --evict-older-than 1d
- name: Save Telegram Desktop cache.
if: >
env.ONLY_CACHE == 'false'
&& github.ref_name == github.event.repository.default_branch
&& fromJSON(steps.ccache-stats.outputs.misses) > 300
uses: actions/cache/save@v6
with:
path: ${{ env.CCACHE_DIR }}
key: ${{ steps.cache-tdesktop.outputs.cache-primary-key }}
- name: Check.
if: env.ONLY_CACHE == 'false'
run: |
filePath="out/Debug/Telegram"
if test -f "$filePath"; then
echo "Build successfully done! :)"
size=$(stat -c %s "$filePath")
echo "File size of ${filePath}: ${size} Bytes."
else
echo "Build error, output file does not exist."
exit 1
fi
- name: Move artifact.
if: env.UPLOAD_ARTIFACT == 'true'
run: |
cd out/Debug
mkdir artifact
mv {Telegram,Updater} artifact/
- uses: actions/upload-artifact@v7
if: env.UPLOAD_ARTIFACT == 'true'
name: Upload artifact.
with:
name: ${{ env.ARTIFACT_NAME }}
path: out/Debug/artifact/