Files
xahaud/.github/workflows/macos.ga.yml
2025-03-25 10:06:17 +01:00

119 lines
3.4 KiB
YAML

name: MacOS CI
on: [push, pull_request]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
strategy:
matrix:
generator:
- Ninja
configuration:
- Debug
runs-on: [self-hosted, macOS, ARM64]
env:
build_dir: .build
deps_dir: .build-deps
NUM_PROCESSORS: 12
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Conan
run: |
brew install conan@1
echo "$(brew --prefix conan@1)/bin" >> $GITHUB_PATH
- name: Install Coreutils
run: |
brew install coreutils
echo "Num proc: $(nproc)"
- name: Install Ninja
if: matrix.generator == 'Ninja'
run: brew install ninja
- name: Install Python
run: |
if which python3 > /dev/null 2>&1; then
echo "Python 3 executable exists"
python3 --version
else
brew install python@3.12
fi
# Create python symlink if needed
if ! which python > /dev/null 2>&1; then
sudo ln -sf $(which python3) /usr/local/bin/python
fi
- name: Install CMake
run: |
if which cmake > /dev/null 2>&1; then
echo "cmake executable exists"
cmake --version
else
brew install cmake
fi
- name: Check environment
run: |
echo "PATH:"
echo ${PATH} | tr ':' '\n'
which python
python --version
which conan
conan --version
which cmake
cmake --version
clang --version
env
- name: Configure Conan
run: |
conan profile new default --detect || true
conan profile update settings.compiler.cppstd=20 default
- name: Install dependencies
uses: ./.github/actions/dependencies
with:
configuration: ${{ matrix.configuration }}
cache-key: macos-${{ matrix.platform }}-${{ matrix.generator }}
env:
build_dir: ${{ env.deps_dir }}
- name: Generate safe branch name
id: safe-branch
run: |
# Replace characters that aren't allowed in cache keys
SAFE_BRANCH=$(echo "${{ github.ref_name }}" | tr -c 'a-zA-Z0-9_.-' '-')
echo "name=${SAFE_BRANCH}" >> $GITHUB_OUTPUT
- name: Restore build directory cache
id: build-cache-restore
uses: actions/cache/restore@v4
with:
path: ${{ env.build_dir }}
key: ${{ runner.os }}-build-${{ matrix.configuration }}-${{ steps.safe-branch.outputs.name }}-${{ hashFiles('**/conanfile.txt', '**/conanfile.py') }}
restore-keys: |
${{ runner.os }}-build-${{ matrix.configuration }}-${{ steps.safe-branch.outputs.name }}-
${{ runner.os }}-build-${{ matrix.configuration }}-
- name: Build
uses: ./.github/actions/build
with:
generator: ${{ matrix.generator }}
configuration: ${{ matrix.configuration }}
- name: Save build directory cache
if: success()
uses: actions/cache/save@v4
with:
path: ${{ env.build_dir }}
key: ${{ steps.build-cache-restore.outputs.cache-primary-key }}
- name: Test
run: |
${build_dir}/rippled --unittest --unittest-jobs $(nproc)