feat ci: add arch #6
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
| name: Arch Linux | |
| 'on': | |
| pull_request: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| - feature/** | |
| env: | |
| UBSAN_OPTIONS: print_stacktrace=1 | |
| ASAN_OPTIONS: detect_odr_violation=2 | |
| CXX: clang++ | |
| CC: clang | |
| CCACHE_DIR: /home/runner/.cache/ccache | |
| CCACHE_NOHASHDIR: true | |
| CPM_SOURCE_CACHE: /home/runner/.cache/CPM | |
| jobs: | |
| archlinux: | |
| strategy: | |
| fail-fast: false | |
| name: archlinux-latest | |
| runs-on: ubuntu-latest | |
| env: | |
| CMAKE_FLAGS: >- | |
| -DCMAKE_BUILD_TYPE=Debug | |
| -DCMAKE_CXX_STANDARD=17 | |
| -DUSERVER_USE_LD=lld | |
| -DUSERVER_NO_WERROR=OFF | |
| -DUSERVER_BUILD_ALL_COMPONENTS=1 | |
| -DUSERVER_BUILD_SAMPLES=1 | |
| -DUSERVER_BUILD_TESTS=1 | |
| -DUSERVER_FEATURE_JEMALLOC=OFF | |
| -DUSERVER_FORCE_DOWNLOAD_ABSEIL=1 | |
| -DUSERVER_FORCE_DOWNLOAD_PROTOBUF=1 | |
| -DUSERVER_FORCE_DOWNLOAD_GRPC=1 | |
| container: | |
| image: archlinux:latest | |
| options: --privileged | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Restore cached directories | |
| id: restore-cache | |
| uses: actions/cache/restore@v4 | |
| with: | |
| path: | | |
| ${{env.CCACHE_DIR}} | |
| ${{env.CPM_SOURCE_CACHE}} | |
| key: 'archlinux-cache-dir ${{github.ref}} run-${{github.run_number}}' | |
| restore-keys: | | |
| archlinux-cache-dir ${{github.ref}} | |
| archlinux-cache-dir | |
| - name: Setup host cache dirs | |
| run: | | |
| mkdir -p ${{env.CCACHE_DIR}} | |
| mkdir -p ${{env.CPM_SOURCE_CACHE}} | |
| - name: Update system and install base dependencies | |
| run: | | |
| pacman -Syu --noconfirm | |
| pacman -S --needed --noconfirm \ | |
| base-devel \ | |
| git \ | |
| cmake \ | |
| ninja \ | |
| clang \ | |
| lld \ | |
| ccache \ | |
| python \ | |
| pkg-config | |
| - name: Install development dependencies | |
| run: | | |
| pacman -S --needed --noconfirm $(cat scripts/docs/en/deps/arch.md | grep -v -- 'makepkg|' ) | |
| cat scripts/docs/en/deps/arch.md | grep -oP '^makepkg\|\K.*' | while read REPLY; \ | |
| do \ | |
| DIR=$(mktemp -d) ;\ | |
| git clone https://aur.archlinux.org/$REPLY.git $DIR ;\ | |
| pushd $DIR ;\ | |
| yes|makepkg -si ;\ | |
| popd ;\ | |
| rm -rf $DIR ;\ | |
| done | |
| - name: Install test dependencies | |
| run: | | |
| pacman -S --needed --noconfirm \ | |
| postgresql \ | |
| redis \ | |
| clickhouse \ | |
| rabbitmq \ | |
| mongodb | |
| - name: Setup caches | |
| run: | | |
| echo "Cached CPM packages:" | |
| du -h -d 1 ${{env.CPM_SOURCE_CACHE}} || true | |
| for f in $(find ${{env.CPM_SOURCE_CACHE}} -name "cmake.lock" 2>/dev/null || true); | |
| do | |
| repo=$(ls -d $(dirname $f)*/ 2>/dev/null || true); | |
| echo "Repository: $repo"; | |
| git config --global --add safe.directory $repo 2>/dev/null || true; | |
| done | |
| ccache -M 2.0GB | |
| ccache -s -v | |
| - name: Run cmake | |
| run: | | |
| cmake -S . -B build_debug $CMAKE_FLAGS | |
| - name: Reconfigure cmake | |
| run: | | |
| cmake -S . -B build_debug $CMAKE_FLAGS | |
| - name: Compile | |
| run: | | |
| cmake --build build_debug -j$(nproc) | |
| - name: Save cached directories | |
| uses: actions/cache/save@v4 | |
| with: | |
| path: | | |
| ${{env.CCACHE_DIR}} | |
| ${{env.CPM_SOURCE_CACHE}} | |
| key: ${{ steps.restore-cache.outputs.cache-primary-key }} | |
| - name: Show cache stats | |
| run: | | |
| du -h -d 1 ${{env.CCACHE_DIR}} || true | |
| du -h -d 1 ${{env.CPM_SOURCE_CACHE}} || true | |
| ccache -s -v | |
| - name: Run tests | |
| run: | | |
| cd build_debug | |
| ctest -V |