test #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: push | |
name: CI | |
jobs: | |
diff: | |
name: diff | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
project: # Filter , compilation path | |
- ['src.*one.*cpp', /src/one] | |
- ['src.*two.*cpp', /src/two] | |
steps: | |
# Prepare project repository. | |
- name: Checkout repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 2 # We need to fetch 2 commits to get the diff. | |
- name: Check for compilation requirement | |
run: | | |
DIFFS=$(git diff --name-only HEAD HEAD~1) | |
echo "$DIFFS | grep -q ${{ matrix.project[0] }}" | |
if $?; then | |
echo "COMPILATION_FLAG=true" >> $GITHUB_ENV | |
else | |
echo "COMPILATION_FLAG=false" >> $GITHUB_ENV | |
fi | |
- name: Build Project | |
if: ${{ env.COMPILATION_FLAG == 'true' }} | |
run: | | |
echo "cd ${{ matrix.project[1] }}" | |
echo "mkdir build" | |
echo "cd build" | |
echo "cmake .." | |
echo "make" |