dragonfly/.github/workflows/ci.yml

187 lines
6.3 KiB
YAML
Raw Normal View History

2021-12-21 08:50:46 +00:00
name: ci-tests
on:
2022-05-05 10:38:22 +00:00
# push:
# branches: [ main ]
2021-12-21 08:50:46 +00:00
pull_request:
branches: [main]
2021-12-21 08:50:46 +00:00
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions/setup-python@v3
- name: Install dependencies
run: |
python -m pip install pre-commit
python -m pip freeze --local
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Run pre-commit checks
run: pre-commit run --show-diff-on-failure --color=always --from-ref HEAD^ --to-ref HEAD
shell: bash
2021-12-21 08:50:46 +00:00
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
strategy:
matrix:
# Test of these containers
container: ["ubuntu-dev:20", "alpine-dev:latest"]
build-type: [Debug, Release]
compiler: [{cxx: g++, c: gcc}]
cxx_flags: ["-Werror"]
include:
- container: "alpine-dev:latest"
build-type: Debug
compiler: {cxx: clang++, c: clang}
cxx_flags: ""
timeout-minutes: 60
env:
SCCACHE_ERROR_LOG: /tmp/sccache_log.txt
container:
2022-05-11 17:37:25 +00:00
image: ghcr.io/romange/${{ matrix.container }}
credentials:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
2021-12-21 08:50:46 +00:00
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Install dependencies
run: |
2021-12-21 08:50:46 +00:00
uname -a
cmake --version
mkdir -p ${{github.workspace}}/build
- name: Write GCS service account key
shell: bash
env:
GCS_SERVICE_ACCOUNT_KEY: ${{ secrets.GCS_SERVICE_ACCOUNT_KEY }}
run: |
echo "$GCS_SERVICE_ACCOUNT_KEY" > /tmp/key.json
- name: Run sccache-cache
uses: mozilla-actions/sccache-action@v0.0.3
- name: Configure Cache Env
uses: actions/github-script@v6
with:
script: |
core.exportVariable('SCCACHE_GCS_KEY_PATH', '/tmp/key.json');
core.exportVariable('SCCACHE_GCS_BUCKET', 'gh-sccache-storage')
core.exportVariable('SCCACHE_GCS_RW_MODE', 'READ_WRITE')
core.exportVariable('SCCACHE_GCS_VERBOSE_STATS', '1')
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: |
cmake -B ${{github.workspace}}/build \
-DCMAKE_BUILD_TYPE=${{matrix.build-type}} \
-GNinja \
-DCMAKE_C_COMPILER="${{matrix.compiler.c}}" \
-DCMAKE_CXX_COMPILER="${{matrix.compiler.cxx}}" \
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache -DCMAKE_C_COMPILER_LAUNCHER=sccache \
-DCMAKE_CXX_FLAGS="${{matrix.cxx_flags}}" \
-L
2022-01-14 17:22:14 +00:00
cd ${{github.workspace}}/build && pwd
du -hcs _deps/
- name: Build
run: |
2022-01-14 17:22:14 +00:00
cd ${{github.workspace}}/build
ninja src/all
${SCCACHE_PATH} --show-stats | tee $GITHUB_STEP_SUMMARY
- name: Test
run: |
cd ${{github.workspace}}/build
echo Run ctest -V -L DFLY
#GLOG_logtostderr=1 GLOG_vmodule=transaction=1,engine_shard_set=1
GLOG_logtostderr=1 GLOG_vmodule=rdb_load=1,rdb_save=1,snapshot=1 ctest -V -L DFLY
echo "Running tests with --force_epoll and --use_zset_tree"
FLAGS_force_epoll=true FLAGS_use_zset_tree=true ctest -V -L DFLY
echo "Running tests with --cluster_mode=emulated"
FLAGS_cluster_mode=emulated ctest -V -L DFLY
echo "Running tests with both --cluster_mode=emulated & --lock_on_hashtags"
FLAGS_cluster_mode=emulated FLAGS_lock_on_hashtags=true ctest -V -L DFLY
./dragonfly_test
./multi_test --multi_exec_mode=1
./multi_test --multi_exec_mode=3
2022-01-14 17:22:14 +00:00
# GLOG_logtostderr=1 GLOG_vmodule=transaction=1,engine_shard_set=1 CTEST_OUTPUT_ON_FAILURE=1 ninja server/test
- name: Upload cache log
uses: actions/upload-artifact@v3
with:
name: sccache_log.txt
path: /tmp/sccache_log.txt
lint-test-chart:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Set up Helm
uses: azure/setup-helm@v3
- uses: actions/setup-python@v4
with:
python-version: '3.9'
check-latest: true
- name: Chart Rendering Tests
run: |
go test -v ./contrib/charts/dragonfly/...
- name: Set up chart-testing
uses: helm/chart-testing-action@v2.3.1
- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config .ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi
- name: Run chart-testing (lint)
run: |
ct \
lint \
--config .ct.yaml \
${{github.event_name == 'workflow_dispatch' && '--all'}} ;
- if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
name: Create kind cluster
uses: helm/kind-action@v1.5.0
- if: steps.list-changed.outputs.changed == 'true' || github.event_name == 'workflow_dispatch'
name: Getting cluster ready
run: |
kubectl label nodes chart-testing-control-plane key/node-kind=high-memory
- name: Run chart-testing (install)
run: |
ct \
install \
--config .ct.yaml \
--debug \
--helm-extra-set-args "--set=image.repository=ghcr.io/${{ github.repository }},probes=null" \
${{github.event_name == 'workflow_dispatch' && '--all'}} ;