From 404ad691d5188c6315a6a1a6db5d1494afe006c0 Mon Sep 17 00:00:00 2001 From: Samuel Williams Date: Mon, 16 Dec 2024 01:45:45 +1300 Subject: [PATCH] Fix broken workflows. (#421) --- .../workflows/{development.yml => test.yml} | 40 ++++++++++++++----- spec/daemonizing_spec.rb | 6 ++- spec/server/tcp_spec.rb | 2 +- spec/server/unix_socket_spec.rb | 4 +- 4 files changed, 38 insertions(+), 14 deletions(-) rename .github/workflows/{development.yml => test.yml} (57%) diff --git a/.github/workflows/development.yml b/.github/workflows/test.yml similarity index 57% rename from .github/workflows/development.yml rename to .github/workflows/test.yml index 860271b9..f1b5e6a8 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/test.yml @@ -1,38 +1,60 @@ -name: Development +name: Test -on: [push, pull_request] +on: + push: + branches: + - master + pull_request: + branches: + - master + +permissions: + contents: read jobs: test: + name: ${{matrix.ruby}} ${{matrix.gemfile}} runs-on: ${{matrix.os}}-latest continue-on-error: ${{matrix.experimental}} + env: + BUNDLE_GEMFILE: ${{matrix.gemfile}} + strategy: matrix: experimental: [false] os: - ubuntu - - macos ruby: - 2.5 - 2.6 - 2.7 + - 3.0 + - 3.1 - 3.2 + - 3.3 + + gemfile: ["Gemfile"] include: + - experimental: false + os: macos + ruby: 3.3 + gemfile: gems/rack-v2.rb - experimental: true os: ubuntu ruby: head + gemfile: gems/rack-v2.rb - experimental: true os: ubuntu ruby: 2.7 - env: BUNDLE_GEMFILE=gems/rack-v1.rb + gemfile: gems/rack-v1.rb - experimental: true os: ubuntu ruby: 3.2 - env: BUNDLE_GEMFILE=gems/rack-v2.rb + gemfile: gems/rack-v2.rb # enable when rack v3 is supported # - experimental: true # os: ubuntu @@ -41,12 +63,12 @@ jobs: steps: - uses: actions/checkout@v3 + - uses: ruby/setup-ruby@v1 with: ruby-version: ${{matrix.ruby}} - - - name: Install dependencies - run: ${{matrix.env}} bundle install + bundler-cache: true - name: Run tests - run: ${{matrix.env}} bundle exec rake + timeout-minutes: 10 + run: bundle exec rake diff --git a/spec/daemonizing_spec.rb b/spec/daemonizing_spec.rb index 0beab8d3..6a716801 100644 --- a/spec/daemonizing_spec.rb +++ b/spec/daemonizing_spec.rb @@ -120,7 +120,7 @@ def name pid = subject.pid - subject.kill(1) + subject.kill(10) expect(File.exist?(subject.pid_file)).to be_falsey expect(Process.running?(pid)).to be_falsey @@ -183,6 +183,8 @@ def name private def wait_for_server_to_start - expect{sleep 0.1 until File.exist?(subject.pid_file)}.to take_less_then(10) + until File.exist?(subject.pid_file) + sleep(0.1) + end end end diff --git a/spec/server/tcp_spec.rb b/spec/server/tcp_spec.rb index e538a34a..48d82d7b 100644 --- a/spec/server/tcp_spec.rb +++ b/spec/server/tcp_spec.rb @@ -38,7 +38,7 @@ end it "should retrieve remote address" do - expect(get('/')).to include('"REMOTE_ADDR"=>"127.0.0.1"') + expect(get('/')).to be =~ /"REMOTE_ADDR"\s*=>\s*"127.0.0.1"/ end after do diff --git a/spec/server/unix_socket_spec.rb b/spec/server/unix_socket_spec.rb index 426f8b0a..856950cc 100644 --- a/spec/server/unix_socket_spec.rb +++ b/spec/server/unix_socket_spec.rb @@ -11,8 +11,8 @@ expect(get("/?this")).to include('this') end - it "should retreive remote address" do - expect(get('/')).to include('"REMOTE_ADDR"=>"127.0.0.1"') + it "should retreive remote address" do + expect(get('/')).to be =~ /"REMOTE_ADDR"\s*=>\s*"127.0.0.1"/ end it "should remove socket file after server stops" do