Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: CI

on:
push:
branches: [main]
pull_request:
branches: [main]

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential libjansson-dev libncursesw5-dev nvidia-cuda-toolkit

- name: Compile check
run: make check

shellcheck:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Run ShellCheck
run: find scripts -name '*.sh' -exec shellcheck {} +
53 changes: 53 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
name: Release

on:
push:
tags:
- 'v*'

permissions:
contents: write

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Extract version from tag
id: version
run: echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"

- name: Verify version matches source
run: |
src_version=$(grep '#define NVFD_VERSION' include/nvfd.h | cut -d'"' -f2)
if [ "$src_version" != "${{ steps.version.outputs.version }}" ]; then
echo "ERROR: Tag ${{ github.ref_name }} does not match NVFD_VERSION \"$src_version\" in include/nvfd.h"
exit 1
fi

- name: Generate release notes
id: notes
run: |
prev_tag=$(git tag --sort=-v:refname | sed -n '2p')
if [ -n "$prev_tag" ]; then
echo "## Changes since $prev_tag" > notes.md
echo "" >> notes.md
git log "$prev_tag"..HEAD --pretty=format:"- %s" --no-merges >> notes.md
else
echo "## Initial release" > notes.md
fi
echo "" >> notes.md
echo "## Installation" >> notes.md
echo '```bash' >> notes.md
echo "git clone https://github.com/${{ github.repository }}.git" >> notes.md
echo "cd nvfd" >> notes.md
echo "sudo scripts/install.sh" >> notes.md
echo '```' >> notes.md

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: NVFD v${{ steps.version.outputs.version }}
body_path: notes.md
generate_release_notes: false
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ SRCS = $(wildcard $(SRCDIR)/*.c)
OBJS = $(patsubst $(SRCDIR)/%.c,$(BUILDDIR)/%.o,$(SRCS))
TARGET = $(BUILDDIR)/nvfd

.PHONY: all clean install uninstall
.PHONY: all clean check install uninstall

all: $(TARGET)

Expand All @@ -34,6 +34,9 @@ $(BUILDDIR)/%.o: $(SRCDIR)/%.c | $(BUILDDIR)
$(BUILDDIR):
mkdir -p $(BUILDDIR)

check: $(OBJS)
@echo "All source files compiled successfully."

clean:
rm -rf $(BUILDDIR)

Expand Down
1 change: 1 addition & 0 deletions scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ echo

# Detect OS
if [ -f /etc/os-release ]; then
# shellcheck disable=SC1091
. /etc/os-release
OS=$NAME
elif type lsb_release >/dev/null 2>&1; then
Expand Down