Skip to content

Merge branch 'v28' into fieldwise_token_separators #364

Merge branch 'v28' into fieldwise_token_separators

Merge branch 'v28' into fieldwise_token_separators #364

Workflow file for this run

name: tests
#on: workflow_dispatch
on: [push, pull_request]
# Cancel previous running if a new push is made
# Source: https://stackoverflow.com/a/72408109/123545
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
test:
runs-on: ubuntu-20.04
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Install dependencies
run: |
sudo add-apt-repository -y ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install -y g++-10 make git zlib1g-dev m4
# Define the compiler
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 30
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 30
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --set cc /usr/bin/gcc
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
sudo update-alternatives --set c++ /usr/bin/g++
- name: Setup lld
run: |
sudo apt-get install -y lld
- name: Set up Bazel
uses: bazelbuild/setup-bazelisk@v2
- name: Download bazel cache
uses: jasonbosco/action-download-artifact@709b71d3729e8980f52a5a2a9ec04261060945c1
with:
name: bazel-cache
search_artifacts: true
workflow_conclusion: ""
if_no_artifact_found: warn
skip_unpack: true
branch: ${{ github.base_ref || github.head_ref || github.ref_name }}
- name: Uncompress bazel cache
run: |
if [ -f "bazel-cache.zip" ]; then
unzip bazel-cache.zip
mkdir -p ~/.cache/bazel
tar_file="bazel-cache.tar.gz" && \
[ -f "$tar_file" ] && \
tar -xzvf "$tar_file" -C ~/.cache/bazel && \
rm bazel-cache.tar.gz
else
echo "bazel-cache.zip does not exist. Continuing..."
fi
exit 0
- name: Build protobuf deps
run: |
bazel build @com_google_protobuf//:protobuf_headers
bazel build @com_google_protobuf//:protobuf_lite
bazel build @com_google_protobuf//:protobuf
bazel build @com_google_protobuf//:protoc
- name: Build Typesense
run: bazel build //:typesense-server
- name: Run tests
run: bazel test --cache_test_results=no --test_output=all //:typesense-test
- name: Compress bazel cache
if: always()
run: |
tar -czvf bazel-cache.tar.gz -C ~/.cache/bazel .
- name: Save bazel cache
uses: actions/upload-artifact@v3
if: always()
with:
name: bazel-cache
path: bazel-cache.tar.gz
if-no-files-found: warn
retention-days: 10
# Source: https://github.com/actions/upload-artifact/issues/92#issuecomment-1080347032
- name: Set BAZEL_BIN_FULL_PATH
run: echo "BAZEL_BIN_FULL_PATH=$(readlink -f bazel-bin)" >> $GITHUB_ENV
- name: Save build artifacts
uses: actions/upload-artifact@v3
with:
name: typesense-server
path: ${{ env.BAZEL_BIN_FULL_PATH }}/typesense-server