-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
1 changed file
with
28 additions
and
4 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,41 @@ | ||
name: C build lib and example test | ||
name: C Build, Test, and Release Example | ||
|
||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
|
||
release: | ||
types: [ "published" ] | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: make | ||
run: make | ||
|
||
- name: Install build tools | ||
run: sudo apt-get update && sudo apt-get install -y build-essential | ||
|
||
- name: Build the project | ||
run: | | ||
make | ||
if [ ! -f ./example ]; then | ||
echo "Error: './example' binary not found after build!" >&2 | ||
exit 1 | ||
fi | ||
- name: Test the example binary | ||
run: | | ||
./example || echo "Execution of './example' failed with an error." | ||
- name: Upload Release Asset | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
uses: actions/upload-release-asset@v1 | ||
with: | ||
upload_url: ${{ github.event.release.upload_url }} | ||
asset_path: ./example | ||
asset_name: example | ||
asset_content_type: application/octet-stream |