Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
198 changes: 198 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
# .github/workflows/build.yml
# Standard CMake-based build workflow
name: Build

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

jobs:
build:
strategy:
fail-fast: false # Don't cancel other jobs if one fails
matrix:
config:
- name: "Windows x64"
os: windows-latest
cmake_generator: "Visual Studio 17 2022"
cmake_arch: -A x64
artifact_name: windows-x64

- name: "Linux x64"
os: ubuntu-latest
cmake_generator: "Unix Makefiles"
cmake_arch: ""
artifact_name: linux-x64

- name: "macOS Universal"
os: macos-latest
cmake_generator: "Unix Makefiles"
cmake_arch: -DCMAKE_OSX_ARCHITECTURES="x86_64;arm64"
artifact_name: macos-universal

runs-on: ${{ matrix.config.os }}
name: ${{ matrix.config.name }}

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

- name: Setup CMake
uses: lukka/get-cmake@latest
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep


- name: Install Dependencies (Linux)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y \
build-essential \
libasound2-dev \
libpulse-dev \
libjack-jackd2-dev \
portaudio19-dev \
libsndfile1-dev \
pkg-config

- name: Install Dependencies (macOS)
if: runner.os == 'macOS'
run: |
brew install portaudio libsndfile pkg-config

- name: Setup MSVC (Windows)
if: runner.os == 'Windows'
uses: microsoft/setup-msbuild@v2
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep


- name: Check Repository Structure
shell: bash
run: |
echo "=== Repository Contents ==="
find . -maxdepth 2 -type f | head -20
echo ""
echo "=== Looking for CMakeLists.txt ==="
find . -name "CMakeLists.txt"
echo ""
echo "=== Looking for source files ==="
find . -name "*.cpp" -o -name "*.h" -o -name "*.c" | head -10

- name: Configure CMake
shell: bash
run: |
cmake -B build \
-DCMAKE_BUILD_TYPE=Release \
-G "${{ matrix.config.cmake_generator }}" \
${{ matrix.config.cmake_arch }}

- name: Build
shell: bash
run: |
cmake --build build --config Release --parallel $(nproc 2>/dev/null || echo 4)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (performance): The use of $(nproc 2>/dev/null || echo 4) for parallel builds may not work on macOS or Windows runners.

Since nproc is not available on macOS and this command fails on Windows, please use a more portable method for setting parallelism, such as a fixed value or leveraging GitHub Actions environment variables.


- name: List Build Output
shell: bash
run: |
echo "=== Build Directory Contents ==="
find build -type f | head -20
echo ""
echo "=== Looking for Executables ==="
find build -name "*.exe" -o \( -type f -executable \) | head -10

- name: Run Tests (if available)
shell: bash
working-directory: build
run: |
if [ -f "CTestTestfile.cmake" ] || [ -f "test/CTestTestfile.cmake" ]; then
ctest --output-on-failure -C Release
else
echo "No tests found - skipping"
fi
continue-on-error: true
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question (testing): Tests are allowed to fail without failing the workflow.

Consider removing 'continue-on-error' or making it conditional if test failures should prevent releases.


- name: Package Artifacts
shell: bash
run: |
# Create output directory
mkdir -p dist/audio-level-fixer-${{ matrix.config.artifact_name }}
cd dist/audio-level-fixer-${{ matrix.config.artifact_name }}

# Copy executables
if [ "${{ runner.os }}" == "Windows" ]; then
find ../../build -name "*.exe" -exec cp {} . \; 2>/dev/null || true
find ../../build -name "*.dll" -exec cp {} . \; 2>/dev/null || true
else
find ../../build -type f -executable -exec cp {} . \; 2>/dev/null || true
fi

# Copy preset files and documentation
cp ../../*.preset . 2>/dev/null || true
cp ../../README.md . 2>/dev/null || true
cp ../../LICENSE* . 2>/dev/null || true

# Show what we packaged
echo "=== Packaged Files ==="
ls -la

# Create archive
cd ..
if [ "${{ runner.os }}" == "Windows" ]; then
7z a audio-level-fixer-${{ matrix.config.artifact_name }}.zip audio-level-fixer-${{ matrix.config.artifact_name }}/*
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The workflow assumes 7z is available on Windows runners for zipping artifacts.

Please add a step to install 7-Zip on Windows runners, or switch to a built-in zip utility to ensure compatibility.

else
tar -czf audio-level-fixer-${{ matrix.config.artifact_name }}.tar.gz audio-level-fixer-${{ matrix.config.artifact_name }}/
fi

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: audio-level-fixer-${{ matrix.config.artifact_name }}
path: |
dist/*.zip
dist/*.tar.gz
retention-days: 30

# Only create release on pushes to main/master (not PRs)
release:
if: github.event_name == 'push'
needs: build
runs-on: ubuntu-latest

steps:
- name: Download All Artifacts
uses: actions/download-artifact@v4

- name: Display Structure
run: |
echo "Downloaded artifacts:"
find . -name "*.zip" -o -name "*.tar.gz"

- name: Generate Release Notes
run: |
echo "# Audio Level Fixer - Development Build" > release-notes.md
echo "" >> release-notes.md
echo "**Build Information:**" >> release-notes.md
echo "- Commit: \`${{ github.sha }}\`" >> release-notes.md
echo "- Date: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> release-notes.md
echo "- Workflow: [\#${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})" >> release-notes.md
echo "" >> release-notes.md
echo "**Platforms Built:**" >> release-notes.md
echo "- ?? Windows x64" >> release-notes.md
echo "- ?? Linux x64" >> release-notes.md
echo "- ?? macOS Universal (Intel + Apple Silicon)" >> release-notes.md
echo "" >> release-notes.md
echo "> **Note:** This is an automated development build. The project is under active development." >> release-notes.md

- name: Create Development Release
uses: softprops/action-gh-release@v1
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security (yaml.github-actions.security.third-party-action-not-pinned-to-commit-sha): An action sourced from a third-party repository on GitHub is not pinned to a full length commit SHA. Pinning an action to a full length commit SHA is currently the only way to use an action as an immutable release. Pinning to a particular SHA helps mitigate the risk of a bad actor adding a backdoor to the action's repository, as they would need to generate a SHA-1 collision for a valid Git object payload.

Source: opengrep

with:
tag_name: dev-${{ github.run_number }}-${{ github.run_attempt }}
name: "Development Build #${{ github.run_number }}"
body_path: release-notes.md
prerelease: true
files: |
**/*.zip
**/*.tar.gz
fail_on_unmatched_files: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
144 changes: 0 additions & 144 deletions .github/workflows/master-build.yml

This file was deleted.

Loading