Skip to content

Commit 13bf7c6

Browse files
committed
🧪 Speed up apt interactions on Ubuntu
This is done by disabling `dpkg` triggers[[1]][[2]]. [1]: https://abbbi.github.io/actions/ [2]: actions/runner-images#10977
1 parent a43317f commit 13bf7c6

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/reusable-tests.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,36 @@ jobs:
8686
TOXENV: py
8787

8888
steps:
89+
- name: Disable dpkg triggers to speed up apt
90+
if: >-
91+
runner.os == 'Linux'
92+
# yamllint disable rule:line-length
93+
run: |
94+
INITRAMFS_CONF="/etc/initramfs-tools/update-initramfs.conf"
95+
DPKG_TRIGGERS="/var/lib/dpkg/triggers/File"
96+
97+
if [ -e $INITRAMFS_CONF ]; then
98+
sudo sed -i 's/yes/no/g' $INITRAMFS_CONF
99+
fi
100+
echo 'set man-db/auto-update false' | sudo debconf-communicate >/dev/null
101+
sudo dpkg-reconfigure man-db
102+
103+
if [ -e $DPKG_TRIGGERS ]; then
104+
sudo sed '/fontconfig/d' -i $DPKG_TRIGGERS
105+
sudo sed '/install-info/d' -i $DPKG_TRIGGERS
106+
sudo sed '/mime/d' -i $DPKG_TRIGGERS
107+
sudo sed '/hicolor-icon-theme/d' -i $DPKG_TRIGGERS
108+
fi
109+
110+
echo "force-unsafe-io" | sudo tee -a /etc/dpkg/dpkg.cfg.d/force-unsafe-io
111+
112+
if [ -a /usr/bin/eatmydata ]; then
113+
echo "eatmydata available"
114+
echo -e '#!/bin/sh\nexec eatmydata /usr/bin/dpkg $@' | sudo tee /usr/local/bin/dpkg && sudo chmod +x /usr/local/bin/dpkg
115+
echo -e '#!/bin/sh\nexec eatmydata /usr/bin/apt $@' | sudo tee /usr/local/bin/apt && sudo chmod +x /usr/local/bin/apt
116+
echo -e '#!/bin/sh\nexec eatmydata /usr/bin/apt-get $@' | sudo tee /usr/local/bin/apt-get && sudo chmod +x /usr/local/bin/apt-get
117+
fi
118+
# yamllint enable rule:line-length
89119
- name: Install build toolchain and openssl headers on Linux
90120
if: >-
91121
inputs.dist-type == 'source' &&

0 commit comments

Comments
 (0)