From 631c66dfa30b47c82465398a91f9049eb8d8b57e Mon Sep 17 00:00:00 2001 From: Constantine Nathanson Date: Tue, 17 Jun 2025 17:37:04 +0300 Subject: [PATCH 1/4] Switch to GitHub actions --- .github/workflows/ci.yml | 42 ++++++++++++++++++++++++++++++++++++++++ .travis.yml | 23 ---------------------- 2 files changed, 42 insertions(+), 23 deletions(-) create mode 100644 .github/workflows/ci.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..30a85e77 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,42 @@ +name: Ruby Test ๐Ÿ’Ž + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + test: + name: ๐Ÿ’Ž Test with Ruby ${{ matrix.ruby-version }} + strategy: + fail-fast: false + matrix: + ruby-version: + - '3.1.7' + - '3.2.8' + - '3.3.8' + - '3.4.4' + + runs-on: ubuntu-22.04 + + steps: + - name: ๐Ÿ”„ Checkout Repository + uses: actions/checkout@v4 + + - name: ๐Ÿ› ๏ธ Setup Ruby ${{ matrix.ruby-version }} + uses: ruby/setup-ruby@v1 + with: + ruby-version: ${{ matrix.ruby-version }} + bundler-cache: true + + - name: โ˜๏ธ Set up test cloud + run: | + export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh) + echo "CLOUDINARY_URL=$CLOUDINARY_URL" >> $GITHUB_ENV + echo "cloud_name: $(echo $CLOUDINARY_URL | cut -d'@' -f2)" + + - name: ๐Ÿงช Run tests + run: bundle exec rspec + env: + CLOUDINARY_URL: ${{ env.CLOUDINARY_URL }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 1282bad5..00000000 --- a/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -dist: jammy -language: ruby -rvm: - - 3.1.4 - - 3.2.2 - - 3.3.0 - -matrix: - include: - # There is an OpenSSL issue on Jammy with Ruby 3.0 - - name: "Ruby: 3.0.6" - dist: focal - rvm: 3.0.6 - -before_script: > - export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh); - echo cloud_name: "$(echo $CLOUDINARY_URL | cut -d'@' -f2)" -script: bundle exec rspec - -notifications: - email: - recipients: - - sdk_developers@cloudinary.com From 068d57aa1fd76b90496f725dfd51393b4fec7d46 Mon Sep 17 00:00:00 2001 From: Constantine Nathanson Date: Tue, 17 Jun 2025 17:44:41 +0300 Subject: [PATCH 2/4] improve test logging --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 30a85e77..8f756090 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,6 +37,6 @@ jobs: echo "cloud_name: $(echo $CLOUDINARY_URL | cut -d'@' -f2)" - name: ๐Ÿงช Run tests - run: bundle exec rspec + run: bundle exec rspec --format documentation --color env: CLOUDINARY_URL: ${{ env.CLOUDINARY_URL }} From a13783545aa4eab3ca7dae7d29d5f19d545b81a5 Mon Sep 17 00:00:00 2001 From: Constantine Nathanson Date: Tue, 17 Jun 2025 17:56:13 +0300 Subject: [PATCH 3/4] Fix tests --- spec/uploader_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/uploader_spec.rb b/spec/uploader_spec.rb index 68f4f0fb..11d78b3e 100644 --- a/spec/uploader_spec.rb +++ b/spec/uploader_spec.rb @@ -627,7 +627,7 @@ end it "should fail if timeout is reached" do - expect { Cloudinary::Uploader.upload(Pathname.new(TEST_IMG), :tags => [TEST_TAG, TIMESTAMP_TAG]) }.to raise_error(Faraday::ConnectionFailed) + expect { Cloudinary::Uploader.upload(Pathname.new(TEST_IMG), :tags => [TEST_TAG, TIMESTAMP_TAG]) }.to raise_error(Faraday::ConnectionFailed).or raise_error(Faraday::TimeoutError) end it "should allow passing nil value" do From 37ceacd57363e1e8e768c1fc1c1195ac25553fae Mon Sep 17 00:00:00 2001 From: Constantine Nathanson Date: Tue, 17 Jun 2025 18:01:21 +0300 Subject: [PATCH 4/4] Another fix --- spec/uploader_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/uploader_spec.rb b/spec/uploader_spec.rb index 11d78b3e..02fd6f79 100644 --- a/spec/uploader_spec.rb +++ b/spec/uploader_spec.rb @@ -627,7 +627,9 @@ end it "should fail if timeout is reached" do - expect { Cloudinary::Uploader.upload(Pathname.new(TEST_IMG), :tags => [TEST_TAG, TIMESTAMP_TAG]) }.to raise_error(Faraday::ConnectionFailed).or raise_error(Faraday::TimeoutError) + expect { Cloudinary::Uploader.upload(Pathname.new(TEST_IMG), :tags => [TEST_TAG, TIMESTAMP_TAG]) }.to raise_error { |error| + expect([Faraday::ConnectionFailed, Faraday::TimeoutError]).to include(error.class) + } end it "should allow passing nil value" do