Enhance CI workflow with OpenCSD decoder build steps#9
Conversation
Added steps to build OpenCSD decoder and prepare artifacts.
Commented out the copy command for CoreSight configuration file.
Added workflow_dispatch to allow manual/API triggers and updated artifact preparation steps.
There was a problem hiding this comment.
Pull request overview
This PR introduces a GitHub Actions CI workflow to automate the build process for the OpenCSD decoder library. The workflow is triggered on pushes and pull requests to the master branch, as well as manual/API triggers via workflow_dispatch. It builds the OpenCSD libraries and prepares them as artifacts for download.
Key Changes:
- Adds automated build for OpenCSD decoder libraries using the existing Linux makefile
- Prepares and uploads build artifacts for distribution
- Enables manual workflow triggering for external integrations
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| # Copy the built library | ||
| cp "$GITHUB_WORKSPACE/decoder/lib/builddir/libopencsd.so" \ | ||
| "$GITHUB_WORKSPACE/artifacts/OpenCSD/libopencsd.so" | ||
|
|
There was a problem hiding this comment.
The build creates versioned shared libraries (e.g., libopencsd.so.X.Y.Z and symlinks) along with static libraries (.a files), but the workflow only copies the base .so file. This could cause issues for proper library versioning and linking.
Consider using a wildcard or copying the entire directory to preserve all library variants and symlinks:
cp -d "$GITHUB_WORKSPACE/decoder/lib/builddir"/lib*.so* \
"$GITHUB_WORKSPACE/artifacts/OpenCSD/"
cp "$GITHUB_WORKSPACE/decoder/lib/builddir"/lib*.a \
"$GITHUB_WORKSPACE/artifacts/OpenCSD/" 2>/dev/null || trueThe -d flag preserves symlinks, which is important for versioned shared libraries.
| # Copy the built library | |
| cp "$GITHUB_WORKSPACE/decoder/lib/builddir/libopencsd.so" \ | |
| "$GITHUB_WORKSPACE/artifacts/OpenCSD/libopencsd.so" | |
| # Copy all built shared and static libraries, preserving symlinks | |
| cp -d "$GITHUB_WORKSPACE/decoder/lib/builddir"/lib*.so* \ | |
| "$GITHUB_WORKSPACE/artifacts/OpenCSD/" | |
| cp "$GITHUB_WORKSPACE/decoder/lib/builddir"/lib*.a \ | |
| "$GITHUB_WORKSPACE/artifacts/OpenCSD/" 2>/dev/null || true |
| run: | | ||
| echo "Current directory:" | ||
| pwd | ||
| echo "Directory contents:" | ||
| ls -la | ||
| echo "GITHUB_WORKSPACE: $GITHUB_WORKSPACE" | ||
|
|
||
| # Navigate directly to decoder build directory | ||
| cd "$GITHUB_WORKSPACE/decoder/build/linux" | ||
| echo "Changed to decoder build directory:" | ||
| pwd | ||
|
|
||
| # Clean and build libraries | ||
| make -f makefile clean | ||
| make -f makefile libs |
There was a problem hiding this comment.
The build commands don't explicitly check for build failures. If make libs fails, the workflow will continue to the artifact preparation step, which could lead to confusing errors.
While GitHub Actions will automatically fail the step if the command exits with a non-zero status, it's better to be explicit. Consider adding error checking or using set -e to stop on any error:
run: |
set -e # Exit on any error
cd "$GITHUB_WORKSPACE/decoder/build/linux"
make libs| # Copy the built library | ||
| cp "$GITHUB_WORKSPACE/decoder/lib/builddir/libopencsd.so" \ | ||
| "$GITHUB_WORKSPACE/artifacts/OpenCSD/libopencsd.so" | ||
|
|
There was a problem hiding this comment.
The artifacts only include the compiled libraries but not the header files required to use them. Consumers of these libraries will need the headers from decoder/include/ to compile against the library.
Consider adding header files to the artifacts:
# Copy headers
cp -r "$GITHUB_WORKSPACE/decoder/include" \
"$GITHUB_WORKSPACE/artifacts/OpenCSD/"| # Copy headers | |
| cp -r "$GITHUB_WORKSPACE/decoder/include" \ | |
| "$GITHUB_WORKSPACE/artifacts/OpenCSD/" | |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Added steps to build OpenCSD decoder and prepare artifacts.