Skip to content

Commit 96dd755

Browse files
committed
Add GitHub Actions workflows and configuration for PR agent and TA-Lib installation
- Introduced a new configuration file `.pr_agent.toml` for the PR agent with model settings and GitHub action configurations. - Updated the main GitHub Actions workflow to support multiple operating systems (Ubuntu, macOS, Windows) for Ruby builds. - Added steps to install TA-Lib on each OS within the CI workflow. - Created a new workflow file `.github/workflows/pr_agent.yml` to automate responses to pull requests and issue comments using the PR agent. Refactor GitHub Actions workflows for improved Ruby setup and PR agent configuration - Reorganized the main workflow to include Ruby setup after TA-Lib installation steps. - Added the `OPENAI_KEY` environment variable to the PR agent workflow for enhanced functionality. - Ensured consistency in Ruby environment setup across different operating systems. Update Gemfile.lock and ta_lib_ffi.gemspec; enhance GitHub Actions workflow - Removed the 'debase' dependency from Gemfile.lock and ta_lib_ffi.gemspec to streamline development dependencies. - Updated the GitHub Actions workflow to include a step for setting up a tmate session, improving debugging capabilities during CI runs. - Modified the Windows installation command for TA-Lib to use PowerShell's Invoke-WebRequest for better compatibility. Refactor TA-Lib library to support dynamic library loading based on platform - Updated the library loading mechanism in `lib/ta_lib.rb` to determine the appropriate file extension for the TA-Lib shared library based on the operating system (macOS, Linux, Windows). - This change enhances compatibility and ensures that the correct library is loaded in different environments. Update GitHub Actions workflow to streamline tmate session setup - Added a step to set up a tmate session in the main workflow for improved debugging during CI runs. - Removed the redundant tmate setup step that was previously included, ensuring a cleaner workflow configuration. Refactor GitHub Actions workflow and TA-Lib library loading - Removed the tmate session setup step from the GitHub Actions workflow to streamline the CI process. - Updated the library loading mechanism in `lib/ta_lib.rb` to dynamically determine the correct path for the TA-Lib shared library based on the operating system, enhancing compatibility across macOS, Linux, and Windows. Add tmate session setup to GitHub Actions workflow for improved debugging Fix library path for TA-Lib in `lib/ta_lib.rb` to ensure correct loading on macOS and Windows. Updated file names to use hyphens instead of underscores for consistency with platform conventions. Enhance GitHub Actions workflow with optional tmate debugging - Added a `workflow_dispatch` trigger to the GitHub Actions workflow, allowing manual execution with an optional `debug_enabled` input. - The tmate session setup step is now conditionally executed based on the `debug_enabled` input, improving flexibility for debugging during CI runs.
1 parent 7e3c663 commit 96dd755

File tree

6 files changed

+87
-13
lines changed

6 files changed

+87
-13
lines changed

.github/workflows/main.yml

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,53 @@ on:
44
push:
55
branches:
66
- main
7-
87
pull_request:
9-
8+
workflow_dispatch:
9+
inputs:
10+
debug_enabled:
11+
type: boolean
12+
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)'
13+
required: false
14+
default: false
1015
jobs:
1116
build:
12-
runs-on: ubuntu-latest
13-
name: Ruby ${{ matrix.ruby }}
1417
strategy:
1518
matrix:
16-
ruby:
17-
- '3.2.3'
19+
os: [ubuntu-latest, macos-latest, windows-latest]
20+
ruby: ['3.2.3']
21+
22+
runs-on: ${{ matrix.os }}
23+
name: Ruby ${{ matrix.ruby }} on ${{ matrix.os }}
1824

1925
steps:
2026
- uses: actions/checkout@v4
27+
28+
- name: Setup tmate session
29+
uses: mxschmitt/action-tmate@v3
30+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }}
31+
32+
- name: Install TA-Lib on Ubuntu
33+
if: matrix.os == 'ubuntu-latest'
34+
run: |
35+
mkdir -p ta-lib
36+
wget -P ta-lib https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib_0.6.4_amd64.deb
37+
sudo dpkg -i ta-lib/ta-lib_0.6.4_amd64.deb
38+
39+
- name: Install TA-Lib on macOS
40+
if: matrix.os == 'macos-latest'
41+
run: brew install ta-lib
42+
43+
- name: Install TA-Lib on Windows
44+
if: matrix.os == 'windows-latest'
45+
run: |
46+
Invoke-WebRequest -Uri "https://github.com/ta-lib/ta-lib/releases/download/v0.6.4/ta-lib-0.6.4-windows-x86_64.msi" -OutFile "ta-lib.msi"
47+
msiexec /i ta-lib.msi /quiet /norestart
48+
2149
- name: Set up Ruby
2250
uses: ruby/setup-ruby@v1
2351
with:
2452
ruby-version: ${{ matrix.ruby }}
2553
bundler-cache: true
54+
2655
- name: Run the default task
2756
run: bundle exec rake

.github/workflows/pr_agent.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
name: PR Agent
2+
on:
3+
pull_request:
4+
types: [opened, reopened, ready_for_review, review_requested]
5+
issue_comment:
6+
jobs:
7+
pr_agent_job:
8+
if: ${{ github.event.sender.type != 'Bot' }}
9+
runs-on: ubuntu-latest
10+
permissions:
11+
issues: write
12+
pull-requests: write
13+
contents: write
14+
name: Run pr agent on every pull request, respond to user comments
15+
steps:
16+
- name: PR Agent action step
17+
id: pragent
18+
uses: Codium-ai/pr-agent@main
19+
env:
20+
OPENAI_KEY: ${{ secrets.OPENAI_KEY }}
21+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
22+
DEEPSEEK_API_KEY: ${{ secrets.DEEPSEEK_API_KEY }}
23+
github_action_config.auto_review: "true" # enable\disable auto review
24+
github_action_config.auto_describe: "true" # enable\disable auto describe
25+
github_action_config.auto_improve: "true" # enable\disable auto improve
26+
github_action_config.pr_actions: '["opened", "reopened", "ready_for_review", "review_requested"]'

.pr_agent.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
[config]
2+
model="deepseek/deepseek-chat"
3+
fallback_models=["deepseek/deepseek-chat"]
4+
custom_model_max_tokens=64000
5+
max_model_tokens=64000
6+
7+
[github_action_config]
8+
# auto_review = true # set as env var in .github/workflows/pr-agent.yaml
9+
# auto_describe = true # set as env var in .github/workflows/pr-agent.yaml
10+
# auto_improve = true # set as env var in .github/workflows/pr-agent.yaml
11+
# pr_actions = ['opened', 'reopened', 'ready_for_review', 'review_requested']

Gemfile.lock

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ GEM
99
specs:
1010
ast (2.4.2)
1111
byebug (11.1.3)
12-
debase (0.2.8)
13-
debase-ruby_core_source (>= 3.3.6)
14-
debase-ruby_core_source (3.4.1)
1512
diff-lcs (1.5.1)
1613
fiddle (1.1.6)
1714
json (2.9.1)
@@ -74,7 +71,6 @@ PLATFORMS
7471

7572
DEPENDENCIES
7673
byebug (~> 11.1)
77-
debase (~> 0.2.8)
7874
rake (~> 13.2)
7975
rspec (~> 3.13)
8076
rubocop-rspec (~> 3.3)

lib/ta_lib.rb

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,20 @@ module TALib
55
VERSION = "0.1.0".freeze
66

77
extend Fiddle::Importer
8-
dlload "libta-lib.so"
8+
9+
lib_path = case RUBY_PLATFORM
10+
when /darwin/
11+
brew_prefix = `brew --prefix`.chomp
12+
"#{brew_prefix}/lib/libta-lib.dylib"
13+
when /linux/
14+
"libta-lib.so"
15+
when /win32|mingw32/
16+
"C:/Program Files/TA-Lib/bin/ta-lib.dll"
17+
else
18+
raise "Unsupported platform"
19+
end
20+
21+
dlload lib_path
922

1023
class TALibError < StandardError; end
1124

ta_lib_ffi.gemspec

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,8 @@ Gem::Specification.new do |spec|
2929
spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
3030
spec.require_paths = ["lib"]
3131

32-
spec.add_development_dependency "byebug", "~> 11.1"
33-
spec.add_development_dependency "debase", "~> 0.2.8"
3432
spec.add_dependency "fiddle", "~> 1.1"
33+
spec.add_development_dependency "byebug", "~> 11.1"
3534
spec.add_development_dependency "rake", "~> 13.2"
3635
spec.add_development_dependency "rspec", "~> 3.13"
3736
spec.add_development_dependency "rubocop-rspec", "~> 3.3"

0 commit comments

Comments
 (0)