test config_json files #35
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: Build projects | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
# enable manual triggering | |
workflow_dispatch: | |
jobs: | |
# Removed for testing | |
# lint: | |
# runs-on: ubuntu-latest | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# - name: Update no-OS submodule | |
# run: | | |
# git submodule update --init libraries/no-OS | |
# - name: Get Commit ID | |
# run: | | |
# commit_id=$(git rev-parse --short HEAD) | |
# echo "Commit ID: $commit_id" | |
# echo "COMMIT=$commit_id" >> $GITHUB_ENV # Store commit_id | |
# - name: Run astyle on source code | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install -y astyle fd-find | |
# set -e | |
# # Find all `.c` and `.h` files excluding those in any `STM32` directory within `projects` | |
# formatted=$(find projects -type f \( -name '*.c' -o -name '*.h' \) | grep -v '/STM32/' | xargs astyle --formatted --options=libraries/no-OS/ci/astyle_config) | |
# if [[ ! -z "${formatted}" ]]; then | |
# echo "INFO: The following files were formatted by astyle:" | |
# echo "${formatted}" | |
# else | |
# echo "SUCCESS: No files needed formatting by astyle" | |
# fi | |
# Commenting for faster tests | |
# build: | |
# runs-on: ubuntu-latest | |
# # needs: [lint] | |
# strategy: | |
# matrix: | |
# project: | |
# - ad405x_iio | |
# # - ad469x_iio | |
# # - ltc2672_iio | |
# # Pull the container from the private repository | |
# container: | |
# image: ghcr.io/noahp/stm32wba55-example:2024-08-01 | |
# #options: --user root | |
# #credentials: | |
# # username: ${{ secrets.ARTIFACT_USERNAME }} | |
# #password: ${{ secrets.ARTIFACT_PASSWORD }} | |
# steps: | |
# - name: Checkout repository | |
# uses: actions/checkout@v4 | |
# with: | |
# submodules: recursive | |
# - name: Build project | |
# run: | | |
# echo "Check pwd" | |
# pwd | |
# echo "Again pwd: ${PWD}" | |
# # Configure Git to mark the directory as safe | |
# git config --global --add safe.directory "${PWD}" | |
# # Check contents of the root directory | |
# echo "Listing root directory:" | |
# ls -la / | |
# # Check contents of /opt directory | |
# echo "Listing /opt directory:" | |
# ls -la /opt | |
# echo "Step commit id: ${{ env.COMMIT }}" | |
# # Retrieve commit ID directly in this step | |
# sh_id=$(git rev-parse --short HEAD) | |
# echo "Commit ID: $sh_id" | |
# # Create warnings.log before build | |
# touch ${{ matrix.project }}_warnings.log | |
# touch ${{ matrix.project }}_specific_warnings.log | |
# /opt/st/stm32cubeide_1.16.0/stm32cubeide --launcher.suppressErrors -nosplash \ | |
# -application org.eclipse.cdt.managedbuilder.core.headlessbuild \ | |
# -data /tmp/stm-workspace \ | |
# -import "projects/${{ matrix.project }}/STM32" | |
# /opt/st/stm32cubeide_1.16.0/stm32cubeide --launcher.suppressErrors -nosplash \ | |
# -application org.eclipse.cdt.managedbuilder.core.headlessbuild \ | |
# -data /tmp/stm-workspace \ | |
# -build ${{ matrix.project }}/Debug \ | |
# -D FIRMWARE_VERSION=$sh_id \ | |
# 2>&1 | grep -i 'warning' | tee -a ${{ matrix.project }}_warnings.log | |
# - name: Filter specific warnings | |
# run: | | |
# grep "projects/${{ matrix.project }}/app" ${{ matrix.project }}_warnings.log > ${{ matrix.project }}_specific_warnings.log | |
# - name: Upload specific warnings log | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: ${{ matrix.project }}-specific-warnings-log | |
# path: ${{ matrix.project }}_specific_warnings.log | |
# # - name: Upload warnings log | |
# # uses: actions/upload-artifact@v4 | |
# # with: | |
# # name: ${{ matrix.project }}-warnings-log | |
# # path: ${{ matrix.project }}_warnings.log | |
# - name: Upload artifacts | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: ${{ matrix.project }} | |
# path: projects/${{ matrix.project }}/STM32/Debug/${{ matrix.project }}.bin | |
test: | |
runs-on: self-hosted | |
# needs: build | |
strategy: | |
matrix: | |
project: | |
- ad405x_iio | |
# - ad469x_iio | |
# - ltc2672_iio | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
# - name: Download build artifacts | |
# uses: actions/download-artifact@v4 | |
# with: | |
# name: ${{ matrix.project }} | |
# path: ./build | |
- name: Read configuration from JSON | |
id: config | |
shell: bash | |
run: | | |
config=$(jq -r '.${{ matrix.project }}' config.json) | |
echo "::set-output name=serialport::$(echo $config | jq -r '.serialport')" | |
echo "::set-output name=device_name::$(echo $config | jq -r '.device_name')" | |
echo "::set-output name=platform_name::$(echo $config | jq -r '.platform_name')" | |
echo "::set-output name=serial_com_type::$(echo $config | jq -r '.serial_com_type')" | |
echo "::set-output name=drive_path::$(echo $config | jq -r '.drive_path')" | |
# - name: Copy artifact to hardware drive | |
# run: | | |
# echo "Programming the board" | |
# copy .\build\${{ matrix.project }}.bin D:\ | |
# echo "Programmed the board" | |
# - name: Copy artifact to hardware drive | |
# run: | | |
# config=$(jq -r '.${{ matrix.project }}' config.json) | |
# drive_path=$(echo $config | jq -r '.drive_path') | |
# echo "Programming the board" | |
# copy .\build\${{ matrix.project }}.bin $drive_path | |
# echo "Programmed the board" | |
- name: Run tests | |
shell: bash | |
run: | | |
cd projects/${{ matrix.project }}/tests | |
pytest -c pytest.ini --serialport "${{ steps.config.outputs.serialport }}" --device_name "${{ steps.config.outputs.device_name }}" --platform_name "${{ steps.config.outputs.platform_name }}" --serial_com_type "${{ steps.config.outputs.serial_com_type }}" | |
# - name: Run tests | |
# run: | | |
# cd projects/${{ matrix.project }}/tests | |
# pytest -c pytest.ini --serialport "COM7" --device_name "AD4052" --platform_name "SDP-K1" --serial_com_type "USE_PHY_COM_PORT" | |