From 6ac4d6e264cc8c8154f48000d3cffcd83dbe10e4 Mon Sep 17 00:00:00 2001 From: Andreas Zecher Date: Sat, 14 Mar 2026 12:11:59 +0100 Subject: [PATCH] Add test GitHub Actions CI workflow - Runs Minitest suite on every push and pull request - Uses Homebrew to install a compatible taglib (2.x) since Ubuntu 24.04 only ships taglib 1.13.1 which is incompatible with taglib-ruby 2.0.0 - Sets PKG_CONFIG_PATH, LIBRARY_PATH, CPATH, LD_LIBRARY_PATH for taglib - Uses Ruby 3.3 (compatible with all gems including minitest 6) - Fixes FileConverterTest to stub duration on audio mock and Audio instance Co-Authored-By: Claude Sonnet 4.6 --- .github/workflows/test.yml | 27 +++++++++++++++++++++++++++ .rubocop.yml | 2 +- test/wavesync/file_converter_test.rb | 3 ++- wavesync.gemspec | 2 +- 4 files changed, 31 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/test.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..207e467 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,27 @@ +name: Test + +on: + push: + branches: [main] + pull_request: + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install system dependencies + run: | + sudo apt-get update -qq + sudo apt-get install -y ffmpeg + eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)" + brew install taglib + echo "PKG_CONFIG_PATH=$(brew --prefix taglib)/lib/pkgconfig" >> $GITHUB_ENV + echo "LIBRARY_PATH=$(brew --prefix taglib)/lib" >> $GITHUB_ENV + echo "CPATH=$(brew --prefix taglib)/include" >> $GITHUB_ENV + echo "LD_LIBRARY_PATH=$(brew --prefix taglib)/lib" >> $GITHUB_ENV + - uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.3" + bundler-cache: true + - run: bundle exec rake test diff --git a/.rubocop.yml b/.rubocop.yml index fcf6b9f..7f4b825 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -1,7 +1,7 @@ AllCops: NewCops: enable SuggestExtensions: false - TargetRubyVersion: 3.1 + TargetRubyVersion: 3.3 Style/Documentation: Enabled: false diff --git a/test/wavesync/file_converter_test.rb b/test/wavesync/file_converter_test.rb index 8e7c439..795ddbb 100644 --- a/test/wavesync/file_converter_test.rb +++ b/test/wavesync/file_converter_test.rb @@ -54,7 +54,8 @@ def teardown FileUtils.touch(source_aiff) FileUtils.touch(File.join(@target_dir, 'track.mp3')) - audio = stub(bpm: nil) + Audio.any_instance.stubs(:duration).returns(0) + audio = stub(bpm: nil, duration: 0) source_format = AudioFormat.new(file_type: 'aiff', sample_rate: 44_100, bit_depth: 16) target_format = AudioFormat.new(file_type: 'mp3', sample_rate: nil, bit_depth: nil) result = @converter.convert(audio, source_aiff, @path_resolver, source_format, target_format) diff --git a/wavesync.gemspec b/wavesync.gemspec index 8eecd1e..547de85 100644 --- a/wavesync.gemspec +++ b/wavesync.gemspec @@ -12,7 +12,7 @@ Gem::Specification.new do |spec| spec.metadata['rubygems_mfa_required'] = 'true' spec.license = 'MIT' - spec.required_ruby_version = '>= 3.1' + spec.required_ruby_version = '>= 3.3' spec.files = Dir['lib/**/*.rb', 'bin/*', 'config/**/*', 'LICENSE', 'README.md'] spec.bindir = 'bin'