diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 0000000000..1cebbd71dd --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,104 @@ +name: pull-request + +on: # yamllint disable-line rule:truthy + push: + branches: + - master + paths-ignore: + - "**.md" + - "**/docs/**" + - "**/LICENSE" + - "**/NOTICE" + - "**/benchmark/**" + - "version.txt" + - "build.sh" + pull_request: + types: + - opened + - synchronize + - reopened + paths-ignore: + - "**.md" + - "**/docs/**" + - "**/LICENSE" + - "**/NOTICE" + - "**/benchmark/**" + - "version.txt" + - "build.sh" + + workflow_dispatch: + inputs: + pr: + description: "Pull request#" + required: false + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: RelWithDebInfo + +jobs: + check-style: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v3 + + - name: Install tools + run: sudo apt-get update && sudo apt install -y shellcheck libxml2-utils git python3-pip pylint yamllint && pip3 install codespell + + - name: Check style + working-directory: ${{github.workspace}}/tests/ci + run: python3 code_style_check.py + + build: + runs-on: ubuntu-22.04 + needs: check-style + steps: + - uses: actions/checkout@v3 + with: + submodules: recursive + + - name: Install tools + run: sudo apt install -y ninja-build ccache + + - name: Generate Makefile + run: export CC=`which clang` CXX=`which clang++` && cmake -G Ninja -B ./build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} + + - name: Build + working-directory: ${{github.workspace}}/build + run: ninja -j 10 + + - name: Upload build artifacts + uses: actions/upload-artifact@v3 + with: + name: build + path: build/ + + unit-tests: + runs-on: ubuntu-22.04 + needs: build + steps: + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build + path: ${{github.workspace}}/build/ + + - name: Run unit Tests + working-directory: build + run: ./src/rk_unit_tests --gtest_color=yes + + integration-tests: + runs-on: ubuntu-22.04 + needs: build + steps: + - uses: actions/checkout@v3 + + - name: Download build artifacts + uses: actions/download-artifact@v3 + with: + name: build + path: ${{github.workspace}}/build/ + + - name: Run integration Tests + working-directory: ${{github.workspace}}/tests/integration + run: bash ${{github.workspace}}/.github/workflows/run-integration-test.sh ${{github.workspace}}/tests/integration