diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0d3caa11..ad16985a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,7 +2,7 @@ # This is a generated file by the `rake build_matrix:github:generate` task. # See `build_matrix.yml` for the build matrix. # Generate this file with `rake build_matrix:github:generate`. -# Generated job count: 194 +# Generated job count: 192 --- name: Ruby gem CI 'on': @@ -184,33 +184,6 @@ jobs: JRUBY_OPTS: '' COV: '1' BUNDLE_GEMFILE: gemfiles/capistrano3.gemfile - ruby_3-5-0-preview1__code_ownership_ubuntu-latest: - name: Ruby 3.5.0-preview1 - code_ownership - needs: ruby_3-5-0-preview1_ubuntu-latest - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.5.0-preview1 - bundler-cache: true - - name: Install gem extension - run: "./script/bundler_wrapper exec rake extension:install" - - name: Print extension install report - run: "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report - file found'" - - name: Print Makefile log file - run: "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file - found'" - - name: Run tests - run: "./script/bundler_wrapper exec rake test" - env: - RAILS_ENV: test - JRUBY_OPTS: '' - COV: '1' - BUNDLE_GEMFILE: gemfiles/code_ownership.gemfile ruby_3-5-0-preview1__dry-monitor_ubuntu-latest: name: Ruby 3.5.0-preview1 - dry-monitor needs: ruby_3-5-0-preview1_ubuntu-latest @@ -1704,33 +1677,6 @@ jobs: JRUBY_OPTS: '' COV: '1' BUNDLE_GEMFILE: gemfiles/capistrano3.gemfile - ruby_3-3-4__code_ownership_ubuntu-latest: - name: Ruby 3.3.4 - code_ownership - needs: ruby_3-3-4_ubuntu-latest - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - name: Install Ruby - uses: ruby/setup-ruby@v1 - with: - ruby-version: 3.3.4 - bundler-cache: true - - name: Install gem extension - run: "./script/bundler_wrapper exec rake extension:install" - - name: Print extension install report - run: "[ -e ext/install.report ] && cat ext/install.report || echo 'No ext/install.report - file found'" - - name: Print Makefile log file - run: "[ -f ext/mkmf.log ] && cat ext/mkmf.log || echo 'No ext/mkmf.log file - found'" - - name: Run tests - run: "./script/bundler_wrapper exec rake test" - env: - RAILS_ENV: test - JRUBY_OPTS: '' - COV: '1' - BUNDLE_GEMFILE: gemfiles/code_ownership.gemfile ruby_3-3-4__dry-monitor_ubuntu-latest: name: Ruby 3.3.4 - dry-monitor needs: ruby_3-3-4_ubuntu-latest diff --git a/build_matrix.yml b/build_matrix.yml index 15846ce8..5ccc6a21 100644 --- a/build_matrix.yml +++ b/build_matrix.yml @@ -132,6 +132,15 @@ matrix: - gem: "capistrano2" - gem: "capistrano3" - gem: "code_ownership" + only: + ruby: + - "3.4.1" + # - "3.3.4" + - "3.2.5" + - "3.1.6" + - "3.0.7" + - "2.7.8" + - "jruby-9.4.7.0" - gem: "dry-monitor" only: ruby: diff --git a/lib/appsignal/hooks/code_ownership.rb b/lib/appsignal/hooks/code_ownership.rb index a791db03..a9d9b641 100644 --- a/lib/appsignal/hooks/code_ownership.rb +++ b/lib/appsignal/hooks/code_ownership.rb @@ -8,7 +8,6 @@ class CodeOwnershipHook < Appsignal::Hooks::Hook def dependencies_present? defined?(::CodeOwnership) && - Gem::Specification.find_by_name("code_ownership").version < Gem::Version.new("2.0") && Appsignal.config && Appsignal.config[:instrument_code_ownership] end diff --git a/spec/lib/appsignal/integrations/code_ownership_spec.rb b/spec/lib/appsignal/integrations/code_ownership_spec.rb index 4a42509d..f67d7ced 100644 --- a/spec/lib/appsignal/integrations/code_ownership_spec.rb +++ b/spec/lib/appsignal/integrations/code_ownership_spec.rb @@ -16,10 +16,11 @@ end it "handles missing config file" do + create_app_files transaction = create_transaction logs = capture_logs do - load File.join(support_dir, "code_ownership", "file_annotation_based.rb") + load File.join(tmp_dir, "app", "file_annotation_based.rb") rescue => error transaction.add_error(error) ensure @@ -34,11 +35,12 @@ end it "handles missing team config files" do + create_app_files create_config_file transaction = create_transaction logs = capture_logs do - load File.join(support_dir, "code_ownership", "file_annotation_based.rb") + load File.join(tmp_dir, "app", "file_annotation_based.rb") rescue => error transaction.add_error(error) ensure @@ -54,6 +56,7 @@ context "and config is set up correctly" do before do + create_app_files create_config_file create_team_files end @@ -72,7 +75,7 @@ transaction = create_transaction begin - load File.join(support_dir, "code_ownership", "file_annotation_based.rb") + load File.join(tmp_dir, "app", "file_annotation_based.rb") rescue => error transaction.add_error(error) ensure @@ -86,7 +89,7 @@ transaction = create_transaction begin - load File.join(support_dir, "code_ownership", "dir", "directory_based.rb") + load File.join(tmp_dir, "app", "dir", "directory_based.rb") rescue => error transaction.add_error(error) ensure @@ -100,7 +103,7 @@ transaction = create_transaction begin - load File.join(support_dir, "code_ownership", "glob", "glob_based.rb") + load File.join(tmp_dir, "app", "glob", "glob_based.rb") rescue => error transaction.add_error(error) ensure @@ -114,7 +117,7 @@ transaction = create_transaction logs = capture_logs do - load File.join(support_dir, "code_ownership", "no_owner.rb") + load File.join(tmp_dir, "app", "no_owner.rb") rescue => error transaction.add_error(error) ensure @@ -140,6 +143,13 @@ private + def create_app_files + FileUtils.cp_r( + File.join(support_dir, "code_ownership", "app"), + File.join(tmp_dir) + ) + end + def create_config_file FileUtils.mkdir(File.join(tmp_dir, "config")) FileUtils.copy_file( @@ -149,23 +159,10 @@ def create_config_file end def create_team_files - FileUtils.mkdir(File.join(tmp_dir, "config", "teams")) - - %w[file directory].each do |team| - FileUtils.copy_file( - File.join(support_dir, "code_ownership", "config", "teams", "#{team}.yml"), - File.join(tmp_dir, "config", "teams", "#{team}.yml") - ) - end - - glob_team = - <<~CONFIG - name: GlobTeam - owned_globs: - - #{File.join(support_dir, "code_ownership", "glob", "*.rb")} - CONFIG - - write_file(File.join(tmp_dir, "config", "teams", "glob.yml"), glob_team) + FileUtils.cp_r( + File.join(support_dir, "code_ownership", "config", "teams"), + File.join(tmp_dir, "config") + ) end end end diff --git a/spec/support/code_ownership/dir/.codeowner b/spec/support/code_ownership/app/dir/.codeowner similarity index 100% rename from spec/support/code_ownership/dir/.codeowner rename to spec/support/code_ownership/app/dir/.codeowner diff --git a/spec/support/code_ownership/dir/directory_based.rb b/spec/support/code_ownership/app/dir/directory_based.rb similarity index 100% rename from spec/support/code_ownership/dir/directory_based.rb rename to spec/support/code_ownership/app/dir/directory_based.rb diff --git a/spec/support/code_ownership/file_annotation_based.rb b/spec/support/code_ownership/app/file_annotation_based.rb similarity index 100% rename from spec/support/code_ownership/file_annotation_based.rb rename to spec/support/code_ownership/app/file_annotation_based.rb diff --git a/spec/support/code_ownership/glob/glob_based.rb b/spec/support/code_ownership/app/glob/glob_based.rb similarity index 100% rename from spec/support/code_ownership/glob/glob_based.rb rename to spec/support/code_ownership/app/glob/glob_based.rb diff --git a/spec/support/code_ownership/no_owner.rb b/spec/support/code_ownership/app/no_owner.rb similarity index 100% rename from spec/support/code_ownership/no_owner.rb rename to spec/support/code_ownership/app/no_owner.rb diff --git a/spec/support/code_ownership/config/teams/directory.yml b/spec/support/code_ownership/config/teams/directory.yml index 69deeb71..6c3eacd8 100644 --- a/spec/support/code_ownership/config/teams/directory.yml +++ b/spec/support/code_ownership/config/teams/directory.yml @@ -1 +1,3 @@ name: DirectoryTeam +github: + team: '@AcmeOrg/dir-team' diff --git a/spec/support/code_ownership/config/teams/file.yml b/spec/support/code_ownership/config/teams/file.yml index adbd5b4d..4279dd8a 100644 --- a/spec/support/code_ownership/config/teams/file.yml +++ b/spec/support/code_ownership/config/teams/file.yml @@ -1 +1,3 @@ name: FileTeam +github: + team: '@AcmeOrg/file-team' diff --git a/spec/support/code_ownership/config/teams/glob.yml b/spec/support/code_ownership/config/teams/glob.yml new file mode 100644 index 00000000..8046507e --- /dev/null +++ b/spec/support/code_ownership/config/teams/glob.yml @@ -0,0 +1,6 @@ +name: GlobTeam +github: + team: '@AcmeOrg/glob-team' +owned_globs: + - "app/glob/*.rb" +