Skip to content

Commit 60cdc0d

Browse files
authored
Merge pull request #403 from hanazuki/ruby3.2
Ruby3.2
2 parents 87f4302 + d17449b commit 60cdc0d

10 files changed

Lines changed: 987 additions & 483 deletions

File tree

.github/workflows/test.yml

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ name: Test
22

33
on:
44
push:
5+
branches: [master]
56
pull_request:
67
schedule:
78
- cron: '0 15 * * 5'
@@ -13,14 +14,12 @@ jobs:
1314
- uses: actions/checkout@v2
1415
- uses: actions/setup-node@v2
1516
with:
16-
node-version: '16'
17+
node-version: '20'
1718
cache: npm
1819
cache-dependency-path: |
1920
package-lock.json
20-
example/package-lock.json
2121
- name: Setup corepack
2222
run: |
23-
type corepack || npm install -g corepack
2423
corepack enable npm
2524
- name: Install
2625
run: npm ci
@@ -31,7 +30,7 @@ jobs:
3130
strategy:
3231
fail-fast: false
3332
matrix:
34-
node: [14, 16]
33+
node: [18, 20]
3534
runs-on: ubuntu-latest
3635
steps:
3736
- uses: actions/checkout@v2
@@ -41,10 +40,13 @@ jobs:
4140
cache: npm
4241
cache-dependency-path: |
4342
package-lock.json
43+
example/package-lock.json
4444
- name: Setup corepack
4545
run: |
46-
type corepack || npm install -g corepack
4746
corepack enable npm
47+
- uses: aws-actions/setup-sam@v2
48+
with:
49+
use-installer: true
4850
- name: Install
4951
run: |
5052
npm ci
@@ -54,6 +56,11 @@ jobs:
5456
run: |
5557
cd example
5658
npm run cdk synth
59+
- name: Test
60+
run: |
61+
cd example
62+
sam local invoke -t ./cdk.out/LambdaRubyExample.template.json RubyFunction2_7
63+
sam local invoke -t ./cdk.out/LambdaRubyExample.template.json RubyFunction3_2
5764
5865
test-finish:
5966
runs-on: ubuntu-latest

example/app/Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
source 'https://rubygems.org'
22

3-
gem 'nokogiri'
3+
gem 'oj'
44

55
group :test do
66
gem 'minitest'

example/app/Gemfile.lock

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
GEM
22
remote: https://rubygems.org/
33
specs:
4-
mini_portile2 (2.4.0)
5-
minitest (5.14.2)
6-
nokogiri (1.10.10)
7-
mini_portile2 (~> 2.4.0)
4+
bigdecimal (3.1.5)
5+
minitest (5.20.0)
6+
oj (3.16.3)
7+
bigdecimal (>= 3.0)
88

99
PLATFORMS
1010
ruby
1111

1212
DEPENDENCIES
1313
minitest
14-
nokogiri
14+
oj
1515

1616
BUNDLED WITH
1717
2.3.7

example/app/main.rb

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
require 'nokogiri'
1+
p Dir.pwd
22

3-
def handler(*)
4-
{
5-
libxml: Nokogiri::LIBXML_VERSION,
6-
}
7-
end
3+
require 'bundler/setup'
4+
require 'oj'
85

9-
def handler2(*)
10-
"hi!"
6+
def handler(*)
7+
# This handler ensures the gem with a native extension is bundled properly
8+
Oj.dump({greeting: 'hi!'})
119
end

example/lib/example-stack.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,11 @@ export class ExampleStack extends cdk.Stack {
1717
sourceDirectory: path.join(__dirname, '../app'),
1818
handler: 'main.handler',
1919
});
20+
21+
new lambdaRuby.RubyFunction(this, 'RubyFunction3_2', {
22+
runtime: lambda.Runtime.RUBY_3_2,
23+
sourceDirectory: path.join(__dirname, '../app'),
24+
handler: 'main.handler',
25+
});
2026
}
2127
}

0 commit comments

Comments
 (0)