Skip to content

Commit

Permalink
Workflow integration (#29)
Browse files Browse the repository at this point in the history
* Updated makefile to only rebuild changed files. Also generates dependency listings to check for modified header files

* Updated workflow to archive the generated binaries and build fullspec and standard versions of the app

* Updated to run workflow on all branches

* Create tar file to retain file permissions

* Fix archive path

* Fix typo

* Remove unnecessary git ignore

* Added reference to issue that drives the need for nested compressed files.

Co-authored-by: akuker <[email protected]>
  • Loading branch information
akuker and akuker authored Sep 4, 2020
1 parent 7ff24d6 commit bb379b8
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 29 deletions.
29 changes: 22 additions & 7 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
name: C/C++ CI

on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
on: [push, pull_request]

jobs:
build:
Expand All @@ -15,10 +11,29 @@ jobs:
- name: Install cross compile toolchain
run: sudo apt-get install gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
- uses: actions/checkout@v2
- name: make
run: make all DEBUG=1

- name: make standard
run: make all DEBUG=1 CONNECT_TYPE=STANDARD
working-directory: ./src/raspberrypi

- name: make fullspec
run: make all DEBUG=1 CONNECT_TYPE=FULLSPEC
working-directory: ./src/raspberrypi

# We need to tar the binary outputs to retain the executable
# file permission. Currently, actions/upload-artifact only
# supports .ZIP files.
# This is workaround for https:/actions/upload-artifact/issues/38
- name: tar binary outputs
run: tar -czvf rascsi.tar.gz ./bin
working-directory: ./src/raspberrypi

- name: upload artifacts
uses: actions/upload-artifact@v2
with:
name: arm-binaries
path: ./src/raspberrypi/rascsi.tar.gz

# buildroot-image:
# runs-on: ubuntu-latest
# steps:
Expand Down
3 changes: 2 additions & 1 deletion src/raspberrypi/.gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
*.o
*.bak
*.HDA
*.save
Expand All @@ -10,3 +9,5 @@ scsimon
rasctl
sasidump
rasdump
obj
bin
41 changes: 20 additions & 21 deletions src/raspberrypi/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ else
CXXFLAGS += -O3 -Wall -Werror
BUILD_TYPE = Release
endif
CFLAGS += -iquote .
CXXFLAGS += -std=c++14 -iquote .
CFLAGS += -iquote . -MD -MP
CXXFLAGS += -std=c++14 -iquote . -MD -MP

# If its not specified, build for STANDARD configuration
CONNECT_TYPE ?= STANDARD
Expand All @@ -39,8 +39,8 @@ USR_LOCAL_BIN = /usr/local/bin
MAN_PAGE_DIR = /usr/share/man/man1
DOC_DIR = ../../doc

OBJDIR := ./obj
BINDIR := ./bin
OBJDIR := ./obj/$(shell echo $(CONNECT_TYPE) | tr '[:upper:]' '[:lower:]')
BINDIR := ./bin/$(shell echo $(CONNECT_TYPE) | tr '[:upper:]' '[:lower:]')

#BIN_ALL = $(RASCSI) $(RASCTL) $(RASDUMP) $(SASIDUMP) $(SCSIMON)
# Temporarily remove the RASDUMP and RASDUMP tools, since they're not needed
Expand All @@ -58,8 +58,8 @@ SRC_RASCSI = \
# rasctl_command.cpp
# rascsi_mgr.cpp
# command_thread.cpp
SRC_RASCSI += $(notdir $(shell find ./controllers -name '*.cpp'))
SRC_RASCSI += $(notdir $(shell find ./devices -name '*.cpp'))
SRC_RASCSI += $(shell find ./controllers -name '*.cpp')
SRC_RASCSI += $(shell find ./devices -name '*.cpp')

SRC_RASCTL = \
rasctl.cpp
Expand All @@ -85,39 +85,38 @@ vpath %.o ./$(OBJDIR)
vpath ./$(BINDIR)


OBJ_RASCSI := $(SRC_RASCSI:%.cpp=$(OBJDIR)/%.o)
OBJ_RASCTL := $(SRC_RASCTL:%.cpp=$(OBJDIR)/%.o)
OBJ_RASDUMP := $(SRC_RASDUMP:%.cpp=$(OBJDIR)/%.o)
OBJ_SASIDUMP := $(SRC_SASIDUMP:%.cpp=$(OBJDIR)/%.o)
OBJ_SCSIMON := $(SRC_SCSIMON:%.cpp=$(OBJDIR)/%.o)
OBJ_RASCSI := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCSI:%.cpp=%.o)))
OBJ_RASCTL := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASCTL:%.cpp=%.o)))
OBJ_RASDUMP := $(addprefix $(OBJDIR)/,$(notdir $(SRC_RASDUMP:%.cpp=%.o)))
OBJ_SASIDUMP := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SASIDUMP:%.cpp=%.o)))
OBJ_SCSIMON := $(addprefix $(OBJDIR)/,$(notdir $(SRC_SCSIMON:%.cpp=%.o)))
#OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP) $(OBJ_SCSIMON)
OBJ_ALL := $(OBJ_RASCSI) $(OBJ_RASCTL) $(OBJ_RASDUMP) $(OBJ_SASIDUMP)


# The following will include all of the auto-generated dependency files (*.d)
# if they exist. This will trigger a rebuild of a source file if a header changes
ALL_DEPS := $(patsubst %.o,%.d,$(OBJ_RASCSI) $(OBJ_RASCTL))
-include $(ALL_DEPS)

$(OBJDIR) $(BINDIR):
echo Creating directory $@
mkdir -p $@

$(OBJDIR)/%.o: %.cpp $(OBJDIR)
$(OBJDIR)/%.o: %.cpp | $(OBJDIR)
$(CXX) $(CXXFLAGS) -c $< -o $@

# $(OBJDIR)/%.o: %.c
# $(CXX) $(CXXFLAGS) -c $< -o $@

# %.o: %.cpp
# $(CXX) $(CXXFLAGS) -c $(OBJDIR)/$< -o $@

.DEFAULT_GOAL := all
.PHONY: all ALL docs
all: $(BIN_ALL) docs
ALL: all

docs: $(DOC_DIR)/rascsi_man_page.txt $(DOC_DIR)/rasctl_man_page.txt

$(BINDIR)/$(RASCSI): $(OBJ_RASCSI) $(BINDIR)
@echo -- Linking $(RASCSI)
$(BINDIR)/$(RASCSI): $(OBJ_RASCSI) | $(BINDIR)
$(CXX) -o $@ $(OBJ_RASCSI) -lpthread

$(BINDIR)/$(RASCTL): $(OBJ_RASCTL) $(BINDIR)
@echo -- Linking $(RASCTL)
$(CXX) -o $@ $(OBJ_RASCTL)

$(RASDUMP): $(OBJ_RASDUMP) $(BINDIR)
Expand Down

0 comments on commit bb379b8

Please sign in to comment.