C/C++ CI #339
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
name: C/C++ CI | |
on: | |
schedule: | |
- cron: "0 23 * * 6" | |
push: | |
branches: [master] | |
paths: | |
- 'src/**' | |
- 'include/**' | |
- '.github/**' | |
- configure.ac | |
- Makfile.am | |
release: | |
types: [published] | |
pull_request: | |
branches: [master] | |
jobs: | |
notification: | |
runs-on: ubuntu-latest | |
name: Notify start to IRC/gitlama | |
outputs: | |
branch: ${{ steps.extract_branch.outputs.branch }} | |
steps: | |
- name: Extract Branch name | |
shell: bash | |
run: echo "branch=$(echo ${GITHUB_REF#refs/heads/})" >> $GITHUB_OUTPUT | |
id: extract_branch | |
- name: IRC notification | |
uses: Gottox/irc-message-action@v2 | |
with: | |
server: irc.uvt.nl | |
channel: '#gitlama' | |
nickname: GitHub | |
message: > | |
${{ github.actor }} started a build of Frog | |
[${{ steps.extract_branch.outputs.branch }}] | |
build: | |
runs-on: ${{ matrix.os }} | |
needs: notification | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-14] | |
compiler: [g++, clang++] | |
steps: | |
- name: Cancel Previous Runs | |
uses: styfle/[email protected] | |
with: | |
access_token: ${{ github.token }} | |
- uses: actions/[email protected] | |
- name: Install Build Environment | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ] | |
then | |
sudo apt-get install pkg-config autoconf-archive | |
else | |
brew upgrade | |
brew install pkg-config | |
brew install autoconf-archive | |
brew install libtool | |
brew install autoconf | |
brew install automake | |
fi | |
- name: Install Dependencies | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ] | |
then | |
sudo apt-get install libicu-dev libxml2-dev libbz2-dev | |
sudo apt-get install zlib1g-dev libexttextcat-dev | |
sudo apt-get install expect cppcheck clang-tools | |
else | |
brew install libxml2 | |
brew install bzip2 | |
brew install zlib | |
brew install telnet | |
brew install cppcheck | |
fi | |
- name: Configure CppCheck | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ] | |
then | |
cpc_opts="--enable=warning,style --inline-suppr --force -I include --quiet --error-exitcode=0" | |
else | |
cpc_opts="--enable=warning,style --inline-suppr --force -I include --check-level=exhaustive --suppress=*:*libexttextcat* --quiet --error-exitcode=0" | |
fi | |
echo "cpc_opts=$cpc_opts" >> $GITHUB_ENV | |
- name: install TiccUtils | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
git clone https://github.com/LanguageMachines/ticcutils | |
cd ticcutils | |
bash bootstrap.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
- name: install libfolia | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
git clone https://github.com/LanguageMachines/libfolia | |
cd libfolia | |
bash bootstrap.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
- name: install uctodata | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
git clone https://github.com/LanguageMachines/uctodata | |
cd uctodata | |
bash bootstrap.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
- name: install libexttextcat on MacOS | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
if [ "$RUNNER_OS" != "Linux" ]; then | |
git clone https://github.com/LibreOffice/libexttextcat/ | |
cd libexttextcat | |
sh autogen.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
fi | |
- name: install ucto | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
git clone https://github.com/LanguageMachines/ucto | |
cd ucto | |
bash bootstrap.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
- name: install timbl | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
git clone https://github.com/LanguageMachines/timbl | |
cd timbl | |
bash bootstrap.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
- name: install mbt | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
git clone https://github.com/LanguageMachines/mbt | |
cd mbt | |
bash bootstrap.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
- name: install frogdata | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
git clone https://github.com/LanguageMachines/frogdata | |
cd frogdata | |
bash bootstrap.sh | |
./configure | |
make | |
sudo make install | |
cd .. | |
- name: bootstrap | |
run: sh bootstrap.sh | |
- name: configure | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: ./configure | |
- name: compiler-id | |
id: compiler | |
run: | | |
id=$(echo ${{matrix.compiler}} | cut -d\+ -f1) | |
echo "id=$id" >> $GITHUB_ENV | |
- name: Static Code-check | |
run: cppcheck ${{ env.cpc_opts }} . | |
- name: Run Scan-Build on LINUX | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
if ${{ runner.os == 'Linux' && env.id == 'clang' }} | |
then | |
scan-build --status-bugs make | |
fi | |
- name: make | |
run: make | |
- name: install | |
run: sudo make install | |
- name: check | |
env: | |
CXX: ${{ matrix.compiler }} | |
run: | | |
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib make check | |
continue-on-error: true | |
- name: show log on failed make check | |
if: ${{ env.test_status != '0' }} | |
run: | | |
cat src/test-suite.log | |
- name: frogtests | |
run: | | |
git clone --depth=1 --single-branch https://github.com/LanguageMachines/frogtests.git | |
cd frogtests | |
frog_bin=/usr/local/bin LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib ./testaction.sh | |
TEST_STAT=$(cat status.tmp) | |
echo "test_status=$TEST_STAT" >> $GITHUB_ENV | |
continue-on-error: true | |
- name: show log on failed test | |
if: ${{ env.test_status != '0' }} | |
run: | | |
cat frogtests/*.err | |
cat frogtests/*.diff | |
- name: Notify IRC of failure | |
if: ${{ env.test_status != '0' }} | |
uses: Gottox/irc-message-action@v2 | |
with: | |
server: irc.uvt.nl | |
channel: '#gitlama' | |
nickname: GH-${{ runner.os }}-${{ env.id }} | |
message: "frog [${{ needs.notification.outputs.branch }}] build \ | |
with ${{ matrix.compiler }} by ${{ github.actor }} on ${{ matrix.os }}: \ | |
\u00034FAILED\u0003 with ${{ env.test_status }} errors" | |
- name: Notify IRC of success | |
if: ${{ env.test_status == '0' }} | |
uses: Gottox/irc-message-action@v2 | |
with: | |
server: irc.uvt.nl | |
channel: '#gitlama' | |
nickname: GH-${{ runner.os }}-${{ env.id }} | |
message: "frog [${{ needs.notification.outputs.branch }}] build \ | |
with ${{ matrix.compiler }} by ${{ github.actor }} on ${{ matrix.os }}: \ | |
\u00033SUCCESS\u0003" |