Skip to content

Commit 2be8fb9

Browse files
committed
CI work
1 parent b07d22d commit 2be8fb9

8 files changed

Lines changed: 125 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
name: ci
2+
concurrency:
3+
group: "${{github.workflow}}-${{github.ref}}"
4+
cancel-in-progress: true
5+
on:
6+
workflow_dispatch:
7+
push:
8+
# branches:
9+
# - main
10+
# tags:
11+
# - v*.*.*
12+
pull_request:
13+
# types: [opened, synchronize]
14+
# branches:
15+
# - '*'
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
strategy:
21+
fail-fast: false
22+
matrix:
23+
ruby: ["3.1", "3.2", "3.3", "3.4", "head"]
24+
steps:
25+
- uses: actions/checkout@v4
26+
- run: rm Gemfile.lock
27+
- uses: ruby/setup-ruby@v1
28+
with:
29+
ruby-version: ${{matrix.ruby}}
30+
bundler: latest
31+
bundler-cache: true
32+
- name: Run tests
33+
run: bundle exec rake test
34+
35+
package:
36+
needs: [ "test" ]
37+
name: "package (${{ matrix.platform }})"
38+
strategy:
39+
fail-fast: false
40+
matrix:
41+
platform:
42+
- "ruby"
43+
- "arm64-darwin"
44+
- "arm64-linux"
45+
- "x86_64-darwin"
46+
- "x86_64-linux"
47+
runs-on: ubuntu-latest
48+
steps:
49+
- uses: actions/checkout@v4
50+
- run: rm Gemfile.lock
51+
- uses: ruby/setup-ruby@v1
52+
with:
53+
ruby-version: "3.2"
54+
bundler: latest
55+
bundler-cache: true
56+
- run: "bundle exec rake gem:${{matrix.platform}}"
57+
- uses: actions/upload-artifact@v4
58+
with:
59+
name: gem-${{matrix.platform}}
60+
path: pkg
61+
retention-days: 1
62+
63+
install-ruby:
64+
name: "install (ruby)"
65+
needs: [ "package" ]
66+
runs-on: ubuntu-latest
67+
steps:
68+
- uses: ruby/setup-ruby@v1
69+
with:
70+
ruby-version: "3.2"
71+
- uses: actions/download-artifact@v4
72+
with:
73+
name: gem-ruby
74+
path: pkg
75+
- run: "gem install pkg/ruby-stripe-cli-*.gem"
76+
- run: "stripe 2>&1 | fgrep 'ERROR: Cannot find the stripe cli executable'"
77+
78+
install-native:
79+
name: "install (${{ matrix.platform }})"
80+
needs: [ "package" ]
81+
strategy:
82+
fail-fast: false
83+
matrix:
84+
ruby: [ "3.4" ]
85+
platform:
86+
- "arm64-darwin"
87+
# - "arm64-linux"
88+
- "x86_64-darwin"
89+
- "x86_64-linux"
90+
include:
91+
- { platform: arm64-darwin, runs_on: macos-14 }
92+
# - { platform: arm64-linux, docker_platform: "--platform=linux/arm64/v8" }
93+
- { platform: x86_64-darwin, runs_on: macos-13 }
94+
- { platform: x86_64-linux, docker_tag: "-alpine", bootstrap: "apk add build-base &&" }
95+
runs-on: ${{ matrix.runs_on || 'ubuntu-latest' }}
96+
steps:
97+
- uses: actions/download-artifact@v4
98+
with:
99+
name: gem-${{ matrix.platform }}
100+
path: pkg
101+
- if: ${{ matrix.runs_on }}
102+
uses: ruby/setup-ruby@v1
103+
with:
104+
ruby-version: ${{ matrix.ruby }}
105+
- if: ${{ matrix.runs_on }}
106+
run: "gem install pkg/ruby-stripe-cli-*.gem"
107+
- if: ${{ matrix.runs_on }}
108+
run: "stripe --help"
109+
- if: ${{ (! matrix.runs_on) && matrix.docker_platform }}
110+
run: docker run --rm --privileged multiarch/qemu-user-static --reset -p yes
111+
- if: ${{ ! matrix.runs_on }}
112+
run: |
113+
docker run --rm -v $PWD:/ruby-strie-cli -w /ruby-strie-cli \
114+
${{ matrix.docker_platform }} ruby:${{ matrix.ruby }}${{ matrix.docker_tag }} \
115+
sh -c "
116+
${{ matrix.bootstrap }}
117+
gem install pkg/ruby-stripe-cli-*.gem
118+
stripe --help
119+
"

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Ruby
33
on:
44
push:
55
branches:
6-
- main
6+
# - main
77

88
pull_request:
99

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ If bundler is not being used to manage dependencies, install the gem by executin
2727
gem install ruby-stripe-cli
2828
```
2929

30-
## Forwaring events to your web server
30+
## Forwarding events to your web server
3131

3232
Make sure `Stripe.api_key` is set, e.g. in `config/initializers/stripe.rb`:
3333

lib/stripe_cli.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
require_relative "stripe_cli/signing_secret"
44
require_relative "stripe_cli/upstream"
55
require_relative "stripe_cli/version"
6-
require_relative "stripe_cli/puma/plugin"
76

87
module StripeCLI
98
DEFAULT_DIR = File.expand_path(File.join(__dir__, "..", "exe"))

lib/stripe_cli/puma/plugin.rb

Lines changed: 0 additions & 7 deletions
This file was deleted.

test/stripe_cli/test_puma_plugin.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ def teardown
4141
end
4242

4343
def test_registration
44+
skip "Skipping because Stripe.api_key is not present" unless ENV.key? "TEST_STRIPE_API_KEY"
45+
4446
`#{StripeCLI.executable} --api-key #{Stripe.api_key} trigger customer.created`
4547
sleep 2
4648
assert @called

test/stripe_cli/test_signing_secret.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
class StripeCLI::TestSigningSecret < Minitest::Test
99
def test_good_api_key
10+
skip "Skipping because Stripe.api_key is not present" unless ENV.key? "TEST_STRIPE_API_KEY"
11+
1012
assert StripeCLI.signing_secret(ENV["TEST_STRIPE_API_KEY"])
1113
end
1214

0 commit comments

Comments
 (0)