Skip to content

Commit

Permalink
Add conditions for running individual steps of Github workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rapp committed Nov 11, 2023
1 parent a4a33fe commit a5fe468
Show file tree
Hide file tree
Showing 2 changed files with 77 additions and 13 deletions.
68 changes: 57 additions & 11 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,87 @@ name: 'Test build'
on:
push:
paths:
- '**/*.hpp'
- '**/*.cpp'
- '**/*.pxd'
- '**/*.pyx'
- '**/*.py'
- '**/*.build'
- '.github/workflows/test_build.yml'
- 'scons/**'
- '**/requirements.txt'
- 'cpp/**'
- 'python/**'
- 'doc/**'
- 'python/subprojects/testbed/tests/**'
- '.github/workflows/test_build.yml'
jobs:
changes:
name: Detect changes
runs-on: ubuntu-latest
outputs:
cpp: ${{ steps.filter.outputs.cpp }}
cpp_tests: ${{ steps.filter.outputs.cpp_tests }}
python: ${{ steps.filter.outputs.python }}
python_tests: ${{ steps.filter.outputs.python_tests }}
doc: ${{ steps.filter.outputs.doc }}
steps:
- name: Checkout
uses: actions/checkout@v4
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
cpp: &cpp
- 'scons/**'
- 'cpp/**/include/**'
- 'cpp/**/src/**'
- '**/*.pxd'
- '**/*.pyx'
- '**/meson.build'
cpp_tests:
- *cpp
- 'cpp/**/test/**'
python: &python
- 'scons/**'
- 'python/requirements.txt'
- 'python/**/mlrl/**'
python_tests:
- *python
- python/**/tests/**
doc:
- 'scons/**'
- 'doc/**'
linux_build:
needs: changes
name: Test Linux build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install OpenCL
if: ${{ needs.changes.outputs.cpp_tests == 'true' || needs.changes.outputs.python_tests == 'true' || needs.changes.outputs.doc == 'true' }}
run: |
sudo apt update
sudo apt install -y opencl-headers ocl-icd-opencl-dev
- name: Install GoogleTest
if: ${{ needs.changes.outputs.cpp_tests == 'true' || needs.changes.outputs.python_tests == 'true' || needs.changes.outputs.doc == 'true' }}
run: sudo apt install -y googletest
- name: Compile via GCC
run: ./build compile
- name: Test C++ code
if: ${{ needs.changes.outputs.cpp_tests == 'true' }}
run: ./build tests_cpp
- name: Test Python code
if: ${{ needs.changes.outputs.cpp == 'true' || needs.changes.outputs.python_tests == 'true' }}
run: ./build tests_python
- name: Install Doxygen
if: ${{ needs.changes.outputs.cpp == 'true' || needs.changes.outputs.doc == 'true' }}
uses: ssciwr/doxygen-install@v1
- name: Generate C++ Apidoc
if: ${{ needs.changes.outputs.cpp == 'true' }}
run: ./build apidoc_cpp
- name: Generate Python Apidoc
if: ${{ needs.changes.outputs.python == 'true' }}
run: ./build apidoc_python
- name: Install Roboto font
if: ${{ needs.changes.outputs.doc == 'true' }}
run: sudo apt install -y fonts-roboto
- name: Generate Documentation
if: ${{ needs.changes.outputs.doc == 'true' }}
run: ./build doc
macos_build:
needs: changes
if: ${{ needs.changes.outputs.cpp == 'true' }}
name: Test MacOS build
runs-on: macos-latest
steps:
Expand All @@ -53,6 +97,8 @@ jobs:
- name: Compile via Clang
run: TEST_SUPPORT=disabled CPLUS_INCLUDE_PATH=/usr/local/opt/opencl-clhpp-headers/include ./build compile
windows_build:
needs: changes
if: ${{ needs.changes.outputs.cpp == 'true' }}
name: Test Windows build
runs-on: windows-latest
steps:
Expand Down
22 changes: 20 additions & 2 deletions .github/workflows/test_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,41 @@ name: 'Check code style'
on:
push:
paths:
- '.github/workflows/test_format.yml'
- 'scons/**'
- '**/*.hpp'
- '**/*.cpp'
- '**/*.py'
- 'scons/**'
- '.clang-format'
- '.isort.cfg'
- '.pylintrc'
- '.style.yapf'
- '.github/workflows/test_format.yml'
jobs:
test_format:
name: Check code style
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Detect changes
uses: dorny/paths-filter@v2
id: filter
with:
filters: |
cpp:
- 'scons/**'
- '**/*.hpp'
- '**/*.cpp'
- '.clang-format'
python:
- 'scons/**'
- '**/*.py'
- '.isort.cfg'
- '.pylintrc'
- '.style.yapf'
- name: Check C++ code style
if: steps.filter.outputs.cpp == 'true'
run: ./build test_format_cpp
- name: Check Python code style
if: steps.filter.outputs.python == 'true'
run: ./build test_format_python

0 comments on commit a5fe468

Please sign in to comment.