|
| 1 | +name: Arch |
| 2 | + |
| 3 | +'on': |
| 4 | + pull_request: |
| 5 | + push: |
| 6 | + branches: |
| 7 | + - master |
| 8 | + - develop |
| 9 | + - feature/** |
| 10 | + |
| 11 | +env: |
| 12 | + UBSAN_OPTIONS: print_stacktrace=1 |
| 13 | + ASAN_OPTIONS: detect_odr_violation=2 |
| 14 | + CXX: clang++ |
| 15 | + CC: clang |
| 16 | + CCACHE_DIR: /home/runner/.cache/ccache |
| 17 | + CCACHE_NOHASHDIR: true |
| 18 | + CPM_SOURCE_CACHE: /home/runner/.cache/CPM |
| 19 | + |
| 20 | +jobs: |
| 21 | + archlinux: |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + |
| 25 | + name: archlinux-latest |
| 26 | + runs-on: ubuntu-latest |
| 27 | + container: |
| 28 | + image: archlinux:latest |
| 29 | + |
| 30 | + env: |
| 31 | + CMAKE_FLAGS: >- |
| 32 | + -DCMAKE_BUILD_TYPE=Debug |
| 33 | + -DCMAKE_CXX_STANDARD=17 |
| 34 | + -DUSERVER_USE_LD=lld |
| 35 | + -DUSERVER_NO_WERROR=1 |
| 36 | + -DUSERVER_BUILD_ALL_COMPONENTS=1 |
| 37 | + -DUSERVER_BUILD_SAMPLES=1 |
| 38 | + -DUSERVER_BUILD_TESTS=1 |
| 39 | + -DUSERVER_FEATURE_GRPC=0 |
| 40 | + -DUSERVER_FEATURE_GRPC_REFLECTION=0 |
| 41 | + -DUSERVER_FEATURE_GRPC_PROTOVALIDATE=0 |
| 42 | + -DUSERVER_FEATURE_MONGODB=0 |
| 43 | + -DUSERVER_FEATURE_OTLP=0 |
| 44 | + -DUSERVER_FEATURE_ROCKS=0 |
| 45 | + -DUSERVER_USE_STATIC_LIBS=0 |
| 46 | + -DUSERVER_FEATURE_PATCH_LIBPQ=0 |
| 47 | +
|
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + with: |
| 51 | + fetch-depth: 0 |
| 52 | + |
| 53 | + - name: Restore cached directories |
| 54 | + id: restore-cache |
| 55 | + uses: actions/cache/restore@v4 |
| 56 | + with: |
| 57 | + path: | |
| 58 | + ${{env.CCACHE_DIR}} |
| 59 | + ${{env.CPM_SOURCE_CACHE}} |
| 60 | + key: 'archlinux-cache-dir ${{github.ref}} run-${{github.run_number}}' |
| 61 | + restore-keys: | |
| 62 | + archlinux-cache-dir ${{github.ref}} |
| 63 | + archlinux-cache-dir |
| 64 | +
|
| 65 | + - name: Setup host cache dirs |
| 66 | + run: | |
| 67 | + mkdir -p ${{env.CCACHE_DIR}} |
| 68 | + mkdir -p ${{env.CPM_SOURCE_CACHE}} |
| 69 | +
|
| 70 | + - name: Update system and install base dependencies |
| 71 | + run: | |
| 72 | + pacman -Syu --noconfirm |
| 73 | + pacman -S --needed --noconfirm \ |
| 74 | + base-devel \ |
| 75 | + git \ |
| 76 | + cmake \ |
| 77 | + make \ |
| 78 | + clang \ |
| 79 | + lld \ |
| 80 | + ccache \ |
| 81 | + python \ |
| 82 | + pkg-config |
| 83 | +
|
| 84 | + - name: Install development dependencies |
| 85 | + run: | |
| 86 | + useradd build |
| 87 | +
|
| 88 | + pacman -S --needed --noconfirm $(cat scripts/docs/en/deps/arch.md | grep -v -- 'makepkg|' ) |
| 89 | + set -x ; \ |
| 90 | + cat scripts/docs/en/deps/arch.md | grep -oP '^makepkg\|\K.*' | while read REPLY; \ |
| 91 | + do \ |
| 92 | + DIR=$(mktemp -d) ;\ |
| 93 | + git clone --branch $REPLY --single-branch https://github.com/archlinux/aur.git $DIR ;\ |
| 94 | + pushd $DIR ;\ |
| 95 | +
|
| 96 | + chmod a+x . |
| 97 | + chmod a+rw -R . |
| 98 | +
|
| 99 | + yes | su -s /usr/bin/makepkg - build ;\ |
| 100 | + pacman -U --noconfirm *.zst |
| 101 | +
|
| 102 | + popd ;\ |
| 103 | + rm -rf $DIR ;\ |
| 104 | + done |
| 105 | +
|
| 106 | + - name: Install test dependencies |
| 107 | + if: ${{ false }} # Not working yet |
| 108 | + run: | |
| 109 | + pacman -S --needed --noconfirm \ |
| 110 | + postgresql \ |
| 111 | + redis \ |
| 112 | + clickhouse \ |
| 113 | + rabbitmq \ |
| 114 | + mongodb |
| 115 | +
|
| 116 | + - name: Setup caches |
| 117 | + run: | |
| 118 | + echo "Cached CPM packages:" |
| 119 | + du -h -d 1 ${{env.CPM_SOURCE_CACHE}} || true |
| 120 | + for f in $(find ${{env.CPM_SOURCE_CACHE}} -name "cmake.lock" 2>/dev/null || true); |
| 121 | + do |
| 122 | + repo=$(ls -d $(dirname $f)*/ 2>/dev/null || true); |
| 123 | + echo "Repository: $repo"; |
| 124 | + git config --global --add safe.directory $repo 2>/dev/null || true; |
| 125 | + done |
| 126 | +
|
| 127 | + ccache -M 2.0GB |
| 128 | + ccache -s -v |
| 129 | +
|
| 130 | + - name: Run cmake |
| 131 | + run: | |
| 132 | + cmake -S . -B build_debug $CMAKE_FLAGS |
| 133 | +
|
| 134 | + - name: Compile |
| 135 | + run: | |
| 136 | + cmake --build build_debug -j$(nproc) |
| 137 | +
|
| 138 | + - name: Save cached directories |
| 139 | + uses: actions/cache/save@v4 |
| 140 | + with: |
| 141 | + path: | |
| 142 | + ${{env.CCACHE_DIR}} |
| 143 | + ${{env.CPM_SOURCE_CACHE}} |
| 144 | + key: ${{ steps.restore-cache.outputs.cache-primary-key }} |
| 145 | + |
| 146 | + - name: Show cache stats |
| 147 | + run: | |
| 148 | + du -h -d 1 ${{env.CCACHE_DIR}} || true |
| 149 | + du -h -d 1 ${{env.CPM_SOURCE_CACHE}} || true |
| 150 | + ccache -s -v |
| 151 | +
|
| 152 | + - name: Run tests |
| 153 | + if: ${{ false }} # Not working yet |
| 154 | + run: | |
| 155 | + cd build_debug |
| 156 | + ctest -V |
0 commit comments