services/test_runner_service.rb
# Runs a new build, incrementing the build number from the number of builds
# for a given project
#
# @return [nil]
Runs a new build, incrementing the build number from the number of builds
for a given project
Runs a new build incrementing the build number from the number of builds for a given project
def run
      start_time = Time.now
      builds = build_service.list_builds(project: self.project)
      if builds.count > 0
        new_build_number = builds.sort_by(&:number).last.number + 1
      else
        new_build_number = 1 
      end
      self.current_build = FastlaneCI::Build.new(
        project: self.project,
        number: new_build_number,
        status: :pending,
        timestamp: Time.now,
        duration: -1,
        sha: self.sha
      )
      update_build_status!
      command = "rubocop #{project.repo_config.local_repo_path}"
      logger.info("Running #{command}")
      cmd = TTY::Command.new
      cmd.run(command)
      duration = Time.now - start_time
      current_build.duration = duration
      current_build.status = :success
      self.update_build_status!
    rescue StandardError => ex
      puts(ex)
      duration = Time.now - start_time
      current_build.duration = duration
      current_build.status = :failure 
      self.update_build_status!
    end
def run start_time = Time . now builds = build_service . list_builds ( project : self . project ) if builds . count > 0 new_build_number = builds . sort_by ( & :number ) . last . number + 1 else new_build_number = 1 end self . current_build = FastlaneCI :: Build . new ( project : self . project , number : new_build_number , status : :pending , timestamp : Time . now , duration : - 1 , sha : self . sha ) update_build_status! command = "rubocop #{project.repo_config.local_repo_path}" logger . info ( "Running #{command}" ) cmd = TTY :: Command . new cmd . run ( command ) duration = Time . now - start_time current_build . duration = duration current_build . status = :success self . update_build_status! rescue StandardError => ex puts ( ex ) duration = Time . now - start_time current_build . duration = duration current_build . status = :failure self . update_build_status! end
Runs a new build, incrementing the build number from the number of builds
for a given project
Runs a new build incrementing the build number from the number of builds for a given project
# do we start with 1? # TODO: Replace with fastlane runner here # TODO: better error handling, don't catch all Exception # TODO: also handle failure
None
nil