Skip to content

Implement the RX pipeline #173

Implement the RX pipeline

Implement the RX pipeline #173

Workflow file for this run

name: Main Workflow
on: [ push, pull_request ]
env:
LLVM_VERSION: 15
jobs:
debug:
if: github.event_name == 'push'
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.3
strategy:
matrix:
toolchain: [ 'clang', 'gcc' ]
include:
- toolchain: gcc
c-compiler: gcc
cxx-compiler: g++
- toolchain: clang
c-compiler: clang
cxx-compiler: clang++
steps:
- uses: actions/checkout@v3
with:
submodules: true
# language=bash
- run: >
cmake
-B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=Debug
-DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
tests
# language=bash
- run: |
cd ${{ github.workspace }}/build
make VERBOSE=1 -j$(nproc)
make test ARGS="--verbose"
- uses: actions/upload-artifact@v3
if: always()
with:
# The matrix is shown for convenience but this is fragile because the values may not be string-convertible.
# Shall it break one day, feel free to remove the matrix from here.
name: ${{github.job}}-#${{strategy.job-index}}-${{job.status}}-${{join(matrix.*, ',')}}
path: ${{github.workspace}}/**/*
retention-days: 2
optimizations:
if: github.event_name == 'push'
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.3
strategy:
matrix:
toolchain: [ 'clang', 'gcc' ]
build_type: [ Release, MinSizeRel ]
include:
- toolchain: gcc
c-compiler: gcc
cxx-compiler: g++
cxx-flags: -fno-strict-aliasing # GCC in MinSizeRel C++20 mode misoptimizes the Cavl test.
- toolchain: clang
c-compiler: clang
cxx-compiler: clang++
steps:
- uses: actions/checkout@v3
with:
submodules: true
# language=bash
- run: >
cmake
-B ${{ github.workspace }}/build
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_C_COMPILER=${{ matrix.c-compiler }}
-DCMAKE_CXX_COMPILER=${{ matrix.cxx-compiler }}
-DCMAKE_CXX_FLAGS="${{ matrix.cxx-flags }}"
-DNO_STATIC_ANALYSIS=1
tests
# language=bash
- run: |
cd ${{ github.workspace }}/build
make VERBOSE=1 -j$(nproc)
make test ARGS="--verbose"
- uses: actions/upload-artifact@v3
if: always()
with:
# The matrix is shown for convenience but this is fragile because the values may not be string-convertible.
# Shall it break one day, feel free to remove the matrix from here.
name: ${{github.job}}-#${{strategy.job-index}}-${{job.status}}-${{join(matrix.*, ',')}}
path: ${{github.workspace}}/**/*
retention-days: 2
avr:
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
mcu: at90can64
flags: -Wall -Wextra -Werror -pedantic -Wconversion -Wtype-limits
strategy:
matrix:
std: [ 'c99', 'c11', 'gnu99', 'gnu11' ]
steps:
- uses: actions/checkout@v3
# language=bash
- run: |
sudo apt update -y && sudo apt upgrade -y
sudo apt install gcc-avr avr-libc
avr-gcc --version
- run: avr-gcc libudpard/*.c -c -std=${{matrix.std}} -mmcu=${{env.mcu}} ${{env.flags}}
arm:
if: github.event_name == 'push'
runs-on: ubuntu-latest
env:
flags: -Wall -Wextra -Werror -pedantic -Wconversion -Wtype-limits -Wcast-align -Wfatal-errors
strategy:
matrix:
std: [ 'c99', 'c11', 'gnu99', 'gnu11' ]
steps:
- uses: actions/checkout@v3
# language=bash
- run: |
sudo apt update -y && sudo apt upgrade -y
sudo apt-get install -y gcc-arm-none-eabi
- run: arm-none-eabi-gcc libudpard/*.c -c -std=${{matrix.std}} ${{ env.flags }}
sonar:
runs-on: ubuntu-latest
container: ghcr.io/opencyphal/toolshed:ts22.4.3
if: >
(
(github.event_name == 'pull_request' || contains(github.ref, '/main') || contains(github.ref, '/release')) &&
!contains(github.event.head_commit.message, '#yolo')
) || (
contains(github.event.head_commit.message, '#sonar')
)
env:
SONAR_SCANNER_VERSION: 4.8.0.2856
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
submodules: true
- uses: actions/setup-java@v3
with:
java-version: 11
distribution: 'zulu'
# language=bash
- run: |
clang --version
- name: Install Sonar tools
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
BUILD_WRAPPER_DOWNLOAD_URL: https://sonarcloud.io/static/cpp/build-wrapper-linux-x86.zip
# language=bash
run: |
mkdir -p $HOME/.sonar
curl -sSLo $HOME/.sonar/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/sonar-scanner.zip -d $HOME/.sonar/
echo "$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin" >> $GITHUB_PATH
curl -sSLo $HOME/.sonar/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o $HOME/.sonar/build-wrapper-linux-x86.zip -d $HOME/.sonar/
echo "$HOME/.sonar/build-wrapper-linux-x86" >> $GITHUB_PATH
# Sonar is not run on builds originating from forks due to secrets not being available (avoids errors).
# language=bash
- run: |
[ -z "$SONAR_TOKEN" ] || tools/run_sonar.sh
- uses: actions/upload-artifact@v3
if: always()
with:
name: ${{github.job}}
path: ${{github.workspace}}/
retention-days: 3
style_check:
if: github.event_name == 'push'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.15
with:
source: './libudpard ./tests'
extensions: 'c,h,cpp,hpp'
clangFormatVersion: ${{ env.LLVM_VERSION }}