This commit is contained in:
1 parent
aafe105612
commit
d594efe447
1 file changed
+17
-9
+17
-9
@@ -23,20 +23,28 @@ jobs:
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
# The image is expected to carry the toolchain already (ci/Dockerfile);
|
||||
# this step only proves it and says how to fix a bare image, instead of
|
||||
# failing later with "cmake: command not found".
|
||||
# The runner image is a bare ubuntu, so the toolchain is installed per run.
|
||||
# Point apt at a domestic mirror first -- archive.ubuntu.com is the slowest
|
||||
# hop on this network. Swap APT_MIRROR for mirrors.aliyun.com/ubuntu or
|
||||
# mirrors.ustc.edu.cn/ubuntu if TUNA is unhappy.
|
||||
- name: toolchain
|
||||
env:
|
||||
DEBIAN_FRONTEND: noninteractive
|
||||
APT_MIRROR: https://mirrors.tuna.tsinghua.edu.cn/ubuntu
|
||||
run: |
|
||||
set -eu
|
||||
for tool in cmake c++ make; do
|
||||
if ! command -v "$tool" >/dev/null 2>&1; then
|
||||
echo "this runner image has no $tool -- build ci/Dockerfile and point the runner label at it" >&2
|
||||
exit 1
|
||||
fi
|
||||
SUDO=""
|
||||
command -v sudo >/dev/null 2>&1 && SUDO=sudo
|
||||
# jammy and older keep sources.list; noble and newer use the deb822
|
||||
# .sources format, so rewrite whatever exists.
|
||||
for f in /etc/apt/sources.list /etc/apt/sources.list.d/*.sources; do
|
||||
[ -f "$f" ] || continue
|
||||
$SUDO sed -i -E "s#https?://(archive|security|ports)\.ubuntu\.com/ubuntu#${APT_MIRROR}#g" "$f"
|
||||
done
|
||||
$SUDO apt-get update -qq
|
||||
$SUDO apt-get install -y -qq --no-install-recommends cmake g++ make
|
||||
cmake --version | head -1
|
||||
c++ --version | head -1
|
||||
g++ --version | head -1
|
||||
echo "cores: $(nproc)"
|
||||
- name: configure
|
||||
run: cmake -S . -B build -DCMAKE_BUILD_TYPE=Release
|
||||
|
||||
Reference in new issue
Block a user