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
84 changes: 84 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Release

on:
push:
tags: ['v*']

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
artifact_name: FileBroadcaster
asset_name: FileBroadcaster-linux-x86_64
- os: macos-latest
artifact_name: FileBroadcaster
asset_name: FileBroadcaster-macos-arm64
- os: windows-latest
artifact_name: FileBroadcaster.exe
asset_name: FileBroadcaster-windows-x86_64.exe

defaults:
run:
shell: ${{ matrix.os == 'windows-latest' && 'msys2 {0}' || 'bash' }}

steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Set up MSYS2 (Windows)
if: runner.os == 'Windows'
uses: msys2/setup-msys2@v2
with:
msystem: MINGW64
install: mingw-w64-x86_64-gcc make

- name: Build (release)
env:
VERSION: ${{ github.ref_name }}
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
make program \
CXXFLAGS="-std=c++17 -O2 -Wall -Wextra -pthread -DFILEBROADCASTER_VERSION=\\\"${VERSION}\\\"" \
LDLIBS_WIN="-lws2_32 -static -static-libgcc -static-libstdc++"
mv FileBroadcaster FileBroadcaster.exe
else
make program \
CXXFLAGS="-std=c++17 -O2 -Wall -Wextra -pthread -DFILEBROADCASTER_VERSION=\"\\\"${VERSION}\\\"\""
fi

- name: Rename artifact
run: mv ${{ matrix.artifact_name }} ${{ matrix.asset_name }}

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.asset_name }}
path: ${{ matrix.asset_name }}
if-no-files-found: error

release:
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true

- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
generate_release_notes: true
draft: false
prerelease: ${{ contains(github.ref_name, '-') }}
18 changes: 17 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ on:
branches: [master, develop, tests]

jobs:
gtest:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]

Expand Down Expand Up @@ -39,6 +40,14 @@ jobs:
if: runner.os == 'macOS'
run: brew install googletest

- name: Build program
run: |
if [ "$RUNNER_OS" == "Windows" ]; then
make program LDLIBS_WIN="-lws2_32"
else
make program
fi

- name: Build tests
run: |
if [ "$RUNNER_OS" == "macOS" ]; then
Expand All @@ -50,3 +59,10 @@ jobs:

- name: Run tests
run: ./GTests --gtest_filter=*

- name: Run E2E loopback tests
# Skip on Windows: SO_REUSEADDR semantics on Winsock cause one socket
# to silently capture all loopback traffic, which breaks two-process
# localhost tests. The protocol works fine across separate hosts.
if: runner.os != 'Windows'
run: make e2e
30 changes: 28 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,36 @@
*.out
*.app

#Visual studio dirs
# Project binaries
/FileBroadcaster
/GTests

# Debug symbols
*.dSYM/
*.pdb

# Build directories
build/
out/

# Visual Studio
.vs/
x64/
x86/
Debug/
Release/
packages/
packages/

# IDE / editor metadata
.idea/
.vscode/
*.swp
*.swo

# Tooling
compile_commands.json
.cache/

# OS noise
.DS_Store
Thumbs.db
41 changes: 29 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
program:
g++ src/Main.cpp src/Receiver.cpp src/Sender.cpp src/Config.cpp \
-std=c++14 -pthread \
-Ilib/cxxopts/include \
-o FileBroadcaster
CXX ?= g++
CXXFLAGS ?= -std=c++17 -O2 -Wall -Wextra -pthread
INCLUDES = -Ilib/cxxopts/include
LDLIBS_WIN ?=

SRCS = src/Main.cpp src/Receiver.cpp src/Sender.cpp src/Config.cpp
TARGET = FileBroadcaster

GTEST_CFLAGS ?=
GTEST_LDFLAGS ?=

.PHONY: all program gtests e2e clean

all: program

program: $(TARGET)

$(TARGET): $(SRCS)
$(CXX) $(SRCS) $(CXXFLAGS) $(INCLUDES) -o $(TARGET) $(LDLIBS_WIN)

gtests:
g++ tests/Tests.cpp \
-std=c++17 -pthread \
-Ilib/cxxopts/include \
$(GTEST_CFLAGS) \
-lgtest \
$(GTEST_LDFLAGS) \
-o GTests
$(CXX) tests/Tests.cpp \
$(CXXFLAGS) \
$(INCLUDES) \
$(GTEST_CFLAGS) \
-lgtest \
$(GTEST_LDFLAGS) \
-o GTests

e2e: program
BINARY=./$(TARGET) bash tests/e2e.sh

clean:
rm -f $(TARGET) $(TARGET).exe GTests GTests.exe
Loading
Loading