Skip to content

Commit 9cb34cf

Browse files
committed
ci: use composite action for devbuild on ubuntu & macos runner
Signed-off-by: Ray Huang <bjhuang@cs.nycu.edu.tw>
1 parent 8fc01b0 commit 9cb34cf

File tree

4 files changed

+94
-403
lines changed

4 files changed

+94
-403
lines changed
Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
name: Setup modmesh CI dependencies on Linux
2-
description: Sets up the necessary dependencies for running CI tests on Github action Linux runners
1+
name: Set up modmesh CI dependencies on Linux
2+
description: Set up the necessary dependencies for running CI tests on Github action Linux runners
3+
4+
inputs:
5+
workflow:
6+
description: The name of the workflow that will use this action
7+
required: true
38

49
runs:
510
using: composite
611
steps:
7-
- uses: actions/checkout@v6
8-
with:
9-
fetch-depth: 1
10-
1112
- name: Add 8G swap
1213
# Prevent hitting runner's resource limits when running clang-tidy
1314
shell: bash
@@ -47,19 +48,14 @@ runs:
4748
test -f /usr/share/doc/kitware-archive-keyring/copyright || \
4849
sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg
4950
sudo apt-get -qy install kitware-archive-keyring
51+
sudo apt-get -qy install \
52+
sudo curl git build-essential make cmake libc6-dev gcc g++ \
53+
python3 python3-dev python3-venv
5054
# The path of apt-get cmake is `/usr/bin/cmake`,
5155
# but the path of built-in cmake of runner image is `/usr/local/bin/cmake`.
5256
# We remove the built-in cmake.
5357
sudo rm -rf /usr/local/bin/cmake
54-
# Install clang-tidy-21 from LLVM repository for full C++23 support
55-
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
56-
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | sudo tee /etc/apt/sources.list.d/llvm.list
57-
sudo apt-get -qqy update
58-
sudo apt-get -qy install \
59-
sudo curl git build-essential make cmake libc6-dev gcc g++ silversearcher-ag \
60-
clang-tidy-21 \
61-
python3 python3-dev python3-venv
62-
sudo ln -fs "$(which clang-tidy-21)" "/usr/local/bin/clang-tidy"
58+
6359
# Install qt6 only with ubuntu-24.04
6460
# This page explains why we need libgl1-mesa-dev
6561
# https://doc-snapshots.qt.io/qt6-dev/linux.html
@@ -75,7 +71,18 @@ runs:
7571
# libgl1-mesa-dev
7672
# fi
7773
78-
- name: install and configure gcc-14
74+
- name: Install clang-tidy for lint
75+
if: ${{ inputs.workflow == 'lint' }}
76+
shell: bash
77+
run: |
78+
# Install clang-tidy-21 from LLVM repository for full C++23 support
79+
wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
80+
echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | sudo tee /etc/apt/sources.list.d/llvm.list
81+
sudo apt-get -qqy update
82+
sudo apt-get -qy install clang-tidy-21 silversearcher-ag
83+
sudo ln -fs "$(which clang-tidy-21)" "/usr/local/bin/clang-tidy"
84+
85+
- name: Install and configure gcc-14
7986
shell: bash
8087
run: |
8188
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
@@ -97,11 +104,18 @@ runs:
97104
setup-python: 'false'
98105
cache: false
99106

100-
- name: dependency by pip
107+
- name: dependency by pip (common)
101108
shell: bash
102109
run: |
103110
sudo pip3 install setuptools
104-
sudo pip3 install numpy matplotlib pytest flake8 jsonschema pyside6==$(qmake6 -query QT_VERSION)
111+
sudo pip3 install numpy pytest flake8
112+
113+
- name: dependency by pip (lint & build)
114+
if: "${{ inputs.workflow == 'lint' || inputs.workflow == 'build' }}"
115+
shell: bash
116+
run: |
117+
sudo pip3 install matplotlib jsonschema
118+
sudo pip3 install pyside6==$(qmake6 -query QT_VERSION)
105119
106120
- name: dependency (manual)
107121
shell: bash
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
1-
name: Setup modmesh CI dependencies on MacOS
2-
description: Sets up the necessary dependencies for running CI tests on Github action MacOS runners
1+
name: Set up modmesh CI dependencies on MacOS
2+
description: Set up the necessary dependencies for running CI tests on Github action MacOS runners
3+
4+
inputs:
5+
workflow:
6+
description: The name of the workflow that will use this action
7+
required: true
38

49
runs:
510
using: composite
611
steps:
7-
- uses: actions/checkout@v6
8-
with:
9-
fetch-depth: 1
10-
1112
- name: Creates /usr/local/include for macos runner
1213
shell: bash
1314
run: |
@@ -53,6 +54,12 @@ runs:
5354
shell: bash
5455
run: sudo NO_INSTALL_PREFIX=1 ${GITHUB_WORKSPACE}/contrib/dependency/install.sh pybind11
5556

57+
- name: dependency (manual) for build
58+
if: ${{ inputs.workflow == 'build' }}
59+
shell: bash
60+
run: |
61+
thirdparty/metal-cpp.sh
62+
5663
- name: show dependency
5764
shell: bash
5865
# Copy the commands from contrib/dependency/showdep.sh

0 commit comments

Comments
 (0)