Skip to content

Commit a4b6ff8

Browse files
committed
Only install clang-format if it is really missing
As the default image already has v10, v11 (default) and v12 installed, you don't have to install v8 and don't even use it. This removes the need for a long (most of the time 2 minutes) mirror search or even call 'apt-get install' in the first place. This shortens the time spent in actions_install.sh from about 2:30min to 6s, which is 25x faster.
1 parent d69421a commit a4b6ff8

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

actions_install.sh

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@
33
set -e
44

55
pip3 install clint pyserial setuptools adafruit-nrfutil
6-
sudo gem install apt-spy2
7-
sudo apt-spy2 check
8-
sudo apt-spy2 fix --commit
96

10-
# after selecting a specific mirror, we need to run 'apt-get update'
11-
sudo apt-get -o Acquire::Retries=3 update
7+
# Only install stuff if it is really missing. This should never be executed,
8+
# as the default image contains clang-format v10, v11 (default) and v12.
9+
# https://github.com/actions/virtual-environments/blob/main/images/linux/Ubuntu2004-Readme.md#language-and-runtime
10+
if [ ! -f /usr/bin/clang-format ]; then
11+
sudo gem install apt-spy2
12+
sudo apt-spy2 check
13+
sudo apt-spy2 fix --commit
1214

13-
sudo apt-get -o Acquire::Retries=3 install -y libllvm8 -V
15+
# after selecting a specific mirror, we need to run 'apt-get update'
16+
sudo apt-get -o Acquire::Retries=3 update
17+
18+
sudo apt-get -o Acquire::Retries=3 install -y clang-format-8 libllvm8
1419

15-
sudo apt install -fy cppcheck clang-format-8
16-
if [ ! -f /usr/bin/clang-format ]; then
1720
sudo ln -s /usr/bin/clang-format-8 /usr/bin/clang-format
1821
fi
1922

0 commit comments

Comments
 (0)