diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index ca500c04..8a522445 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,6 +26,10 @@ jobs: submodules: recursive fetch-depth: 0 fetch-tags: true + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - uses: ruby/setup-ruby@v1 with: ruby-version: 3.3 @@ -109,6 +113,7 @@ jobs: make \ openssl \ openssl-dev \ + curl-dev \ readline-dev \ ruby \ tar \ @@ -367,7 +372,7 @@ jobs: build_macos_x86_64: needs: source - runs-on: macos-13 + runs-on: macos-15-intel strategy: fail-fast: false matrix: @@ -406,7 +411,7 @@ jobs: needs: - source - build_macos_x86_64 - runs-on: macos-13 + runs-on: macos-15-intel steps: - uses: actions/download-artifact@v4 with: @@ -454,6 +459,10 @@ jobs: - '3.3' - '3.4' steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - uses: actions/download-artifact@v4 with: name: couchbase-${{ needs.source.outputs.gem_version }}-x86_64-linux @@ -555,6 +564,15 @@ jobs: logs/* test/**/*.{log,xml} retention-days: 5 + - name: Upload crash logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash + path: | + ~/Library/Logs/DiagnosticReports/ + /Library/Logs/DiagnosticReports/ + retention-days: 5 - name: Publish Test Report uses: mikepenz/action-junit-report@v4.1.0 if: always() @@ -569,7 +587,7 @@ jobs: needs: - source - repackage_macos_x86_64 - runs-on: macos-13 + runs-on: macos-15-intel strategy: fail-fast: false matrix: @@ -616,6 +634,15 @@ jobs: logs/* test/**/*.{log,xml} retention-days: 5 + - name: Upload crash logs + if: failure() + uses: actions/upload-artifact@v4 + with: + name: ${{ github.job }}-${{ github.run_attempt }}-${{ matrix.ruby }}-crash + path: | + ~/Library/Logs/DiagnosticReports/ + /Library/Logs/DiagnosticReports/ + retention-days: 5 - name: Publish Test Report uses: mikepenz/action-junit-report@v4.1.0 if: always() @@ -640,6 +667,10 @@ jobs: - 7.1.6 - 7.0.5 steps: + - name: Install dependencies + run: | + sudo apt-get update + sudo apt-get install -y libcurl4-openssl-dev - name: Install cbdinocluster run: | mkdir -p "$HOME/bin" diff --git a/.gitignore b/.gitignore index 448c2d67..78599282 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ /pkg/ /test/reports/ /tmp/ +/logs/ /vendor/bundle/ Gemfile.lock Makefile diff --git a/Gemfile b/Gemfile index 261e2d87..08d33a54 100644 --- a/Gemfile +++ b/Gemfile @@ -23,6 +23,7 @@ gem "rake" group :development do gem "activesupport", "~> 7.0.3" + gem "curb" gem "drb" gem "faker" gem "flay" @@ -30,7 +31,7 @@ group :development do gem "gem-compiler" gem "grpc-tools", "~> 1.59" gem "heckle" - gem "minitest" + gem "minitest", "< 6.0" gem "minitest-reporters" gem "mutex_m" gem "rack" diff --git a/test/mock_helper.rb b/test/mock_helper.rb index d26cb6dc..be8bb844 100755 --- a/test/mock_helper.rb +++ b/test/mock_helper.rb @@ -20,30 +20,33 @@ require "fileutils" require "tmpdir" require "socket" +require "curb" class Caves attr_accessor :verbose - VERSION = "v0.0.1-78" + VERSION = "v0.0.1-79" FORK = "couchbaselabs" def download_mock(url = caves_url) return if binary_ready? puts "download #{url}" - resp = Net::HTTP.get_response(URI.parse(url)) - case resp - when Net::HTTPSuccess - raise "Unexpected content type: #{resp['content-type']}" if resp["content-type"] != "application/octet-stream" + curl = Curl::Easy.new(url) do |c| + c.follow_location = true + c.max_redirects = 5 + end + curl.perform + case curl.response_code + when 200..299 + raise "Unexpected content type: #{curl.content_type}" if curl.content_type != "application/octet-stream" FileUtils.mkdir_p(caves_dir, verbose: verbose?) - File.write(mock_path, resp.body, binmode: true) + File.write(mock_path, curl.body, binmode: true) FileUtils.chmod("a+x", mock_path, verbose: verbose?) unless windows? - when Net::HTTPRedirection - download_mock(resp["location"]) else - raise "Unable to download mock from #{url}: #{resp.status}" + raise "Unable to download mock from #{url}: #{curl.response_code}" end end