-
Notifications
You must be signed in to change notification settings - Fork 57
ci: composite actions for setting up dependencies for macOS and Linux runners #691
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ExplorerRay
wants to merge
2
commits into
solvcon:master
Choose a base branch
from
ExplorerRay:ci-composite
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+305
−643
Open
Changes from 1 commit
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next
Next commit
ci: add composite action for lint setup dependency based on OS
Signed-off-by: Ray Huang <bjhuang@cs.nycu.edu.tw>
- Loading branch information
commit 8fc01b005fa4e9a9291a898f0268034741d08374
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,133 @@ | ||
| name: Setup modmesh CI dependencies on Linux | ||
| description: Sets up the necessary dependencies for running CI tests on Github action Linux runners | ||
|
||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Add 8G swap | ||
| # Prevent hitting runner's resource limits when running clang-tidy | ||
| shell: bash | ||
| run: | | ||
| # Remove /swapfile first to avoid "fallocate: Text file busy" error | ||
| sudo swapoff -a | ||
| sudo rm -f /swapfile | ||
| sudo fallocate -l 8G /swapfile | ||
| sudo chmod 600 /swapfile | ||
| sudo mkswap /swapfile | ||
| sudo swapon /swapfile | ||
| free -h | ||
|
|
||
| - name: Cache Qt download | ||
| uses: actions/cache@v3 | ||
| with: | ||
| path: ${{ github.workspace }}/Qt | ||
| key: ${{ runner.os }}-qt-6.8.1-linux_gcc_64 | ||
| # fallback to any previous Qt cache on this OS | ||
| restore-keys: | | ||
| ${{ runner.os }}-qt-6.8.1- | ||
|
|
||
| - name: dependency by apt | ||
| shell: bash | ||
| run: | | ||
| # To update the cmake version > 4, install the latest cmake by kitware apt repository. | ||
| # Reference: https://apt.kitware.com/ | ||
| sudo apt-get -y update | ||
| sudo apt-get -qy install ca-certificates gpg wget | ||
| test -f /usr/share/doc/kitware-archive-keyring/copyright || \ | ||
| wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | \ | ||
| gpg --dearmor - | \ | ||
| sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null | ||
| echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main' | \ | ||
| sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null | ||
| sudo apt-get -qqy update | ||
| test -f /usr/share/doc/kitware-archive-keyring/copyright || \ | ||
| sudo rm /usr/share/keyrings/kitware-archive-keyring.gpg | ||
| sudo apt-get -qy install kitware-archive-keyring | ||
| # The path of apt-get cmake is `/usr/bin/cmake`, | ||
| # but the path of built-in cmake of runner image is `/usr/local/bin/cmake`. | ||
| # We remove the built-in cmake. | ||
| sudo rm -rf /usr/local/bin/cmake | ||
| # Install clang-tidy-21 from LLVM repository for full C++23 support | ||
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc | ||
| echo "deb http://apt.llvm.org/noble/ llvm-toolchain-noble-21 main" | sudo tee /etc/apt/sources.list.d/llvm.list | ||
| sudo apt-get -qqy update | ||
| sudo apt-get -qy install \ | ||
| sudo curl git build-essential make cmake libc6-dev gcc g++ silversearcher-ag \ | ||
| clang-tidy-21 \ | ||
| python3 python3-dev python3-venv | ||
| sudo ln -fs "$(which clang-tidy-21)" "/usr/local/bin/clang-tidy" | ||
| # Install qt6 only with ubuntu-24.04 | ||
| # This page explains why we need libgl1-mesa-dev | ||
| # https://doc-snapshots.qt.io/qt6-dev/linux.html | ||
| # | ||
| # In short, OpenGL libraries and headers are required. Without | ||
| # installing this package, cmake won't find the correct lib path. | ||
| # This has been replaced by the 'install qt' section below to manage | ||
| # qt6 versioning independently from the OS. | ||
|
|
||
| # if [ "${{ matrix.os }}" == "ubuntu-24.04" ] ; then \ | ||
| # sudo apt-get -qy install \ | ||
| # qt6-3d-dev xvfb \ | ||
| # libgl1-mesa-dev | ||
| # fi | ||
|
|
||
| - name: install and configure gcc-14 | ||
| shell: bash | ||
| run: | | ||
| sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y | ||
| sudo apt-get -qqy update | ||
| sudo apt-get -qy install gcc-14 g++-14 | ||
| sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-14 100 | ||
| sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-14 100 | ||
| sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc-14 100 | ||
| sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++-14 100 | ||
|
|
||
| - name: install qt | ||
| uses: jurplel/install-qt-action@v4 | ||
| with: | ||
| version: '6.8.1' | ||
| host: 'linux' | ||
| target: 'desktop' | ||
| arch: 'linux_gcc_64' | ||
| modules: 'qt3d' | ||
| setup-python: 'false' | ||
| cache: false | ||
|
|
||
| - name: dependency by pip | ||
| shell: bash | ||
| run: | | ||
| sudo pip3 install setuptools | ||
| sudo pip3 install numpy matplotlib pytest flake8 jsonschema pyside6==$(qmake6 -query QT_VERSION) | ||
|
|
||
| - name: dependency (manual) | ||
| shell: bash | ||
| run: sudo ${GITHUB_WORKSPACE}/contrib/dependency/install.sh pybind11 | ||
|
|
||
| - name: show dependency | ||
| shell: bash | ||
| # Copy the commands from contrib/dependency/showdep.sh | ||
| run: | | ||
| echo "gcc path: $(which gcc)" | ||
| echo "gcc version: $(gcc --version)" | ||
| echo "cmake path: $(which cmake)" | ||
| echo "cmake version: $(cmake --version)" | ||
| echo "python3 path: $(which python3)" | ||
| echo "python3 version: $(python3 --version)" | ||
| echo "python3-config --prefix: $(python3-config --prefix)" | ||
| echo "python3-config --exec-prefix: $(python3-config --exec-prefix)" | ||
| echo "python3-config --includes: $(python3-config --includes)" | ||
| echo "python3-config --libs: $(python3-config --libs)" | ||
| echo "python3-config --cflags: $(python3-config --cflags)" | ||
| echo "python3-config --ldflags: $(python3-config --ldflags)" | ||
| echo "pip3 path: $(which pip3)" | ||
| python3 -c 'import numpy as np; print("np.__version__:", np.__version__, np.get_include())' | ||
| echo "pytest path: $(which pytest)" | ||
| echo "pytest version: $(pytest --version)" | ||
| echo "clang-tidy path: $(which clang-tidy)" | ||
| echo "clang-tidy version: $(clang-tidy -version)" | ||
| echo "flake8 path: $(which flake8)" | ||
| echo "flake8 version: $(flake8 --version)" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,79 @@ | ||
| name: Setup modmesh CI dependencies on MacOS | ||
| description: Sets up the necessary dependencies for running CI tests on Github action MacOS runners | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - uses: actions/checkout@v6 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Creates /usr/local/include for macos runner | ||
| shell: bash | ||
| run: | | ||
| # Some mac runner does not have /usr/local/include and cmake sometimes crashes | ||
| sudo mkdir -p /usr/local/include | ||
|
|
||
| - name: dependency by homebrew | ||
| shell: bash | ||
| run: | | ||
| export HOMEBREW_NO_AUTO_UPDATE=1 | ||
| export HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK=1 | ||
| # This has been replaced by the 'install qt' section below to manage | ||
| # qt6 versioning independently from the OS. | ||
| # brew install llvm@21 qt6 | ||
| brew install llvm@21 | ||
| ln -s "$(brew --prefix llvm@21)/bin/clang-format" "/usr/local/bin/clang-format" | ||
| ln -s "$(brew --prefix llvm@21)/bin/clang-tidy" "/usr/local/bin/clang-tidy" | ||
|
|
||
| - name: install qt | ||
| uses: jurplel/install-qt-action@v4 | ||
| with: | ||
| version: '6.8.1' | ||
| host: 'mac' | ||
| target: 'desktop' | ||
| arch: 'clang_64' | ||
| modules: 'qt3d' | ||
| setup-python: 'false' | ||
| cache: true | ||
|
|
||
| - name: dependency by pip | ||
| shell: bash | ||
| run: | | ||
| echo "which python3: $(which python3)" | ||
| ls -al $(which python3) | ||
| # suppress the warning of pip because brew forces PEP668 since python3.12 | ||
| python3 -m pip -v install --upgrade setuptools --break-system-packages | ||
| python3 -m pip -v install --upgrade numpy matplotlib pytest flake8 jsonschema | ||
| # For now (2024/10/22), pyside6 6.6.3 does not support Python 3.13. | ||
| # Use --ignore-requires-python to force installation. | ||
| python3 -m pip -v install --upgrade pyside6==$(qmake -query QT_VERSION) --ignore-requires-python | ||
|
|
||
| - name: dependency (manual) | ||
| shell: bash | ||
| run: sudo NO_INSTALL_PREFIX=1 ${GITHUB_WORKSPACE}/contrib/dependency/install.sh pybind11 | ||
|
|
||
| - name: show dependency | ||
| shell: bash | ||
| # Copy the commands from contrib/dependency/showdep.sh | ||
| run: | | ||
| echo "gcc path: $(which gcc)" | ||
| echo "gcc version: $(gcc --version)" | ||
| echo "cmake path: $(which cmake)" | ||
| echo "cmake version: $(cmake --version)" | ||
| echo "python3 path: $(which python3)" | ||
| echo "python3 version: $(python3 --version)" | ||
| echo "python3-config --prefix: $(python3-config --prefix)" | ||
| echo "python3-config --exec-prefix: $(python3-config --exec-prefix)" | ||
| echo "python3-config --includes: $(python3-config --includes)" | ||
| echo "python3-config --libs: $(python3-config --libs)" | ||
| echo "python3-config --cflags: $(python3-config --cflags)" | ||
| echo "python3-config --ldflags: $(python3-config --ldflags)" | ||
| echo "pip3 path: $(which pip3)" | ||
| python3 -c 'import numpy as np; print("np.__version__:", np.__version__, np.get_include())' | ||
| echo "pytest path: $(which pytest)" | ||
| echo "pytest version: $(pytest --version)" | ||
| echo "clang-tidy path: $(which clang-tidy)" | ||
| echo "clang-tidy version: $(clang-tidy -version)" | ||
| echo "flake8 path: $(which flake8)" | ||
| echo "flake8 version: $(flake8 --version)" |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Setup" is not a verb (at least was not one). Use "Set up" like what you wrote in the next line.