Skip to content

Commit fd8deb8

Browse files
committed
Add CI
1 parent 90fea2e commit fd8deb8

3 files changed

Lines changed: 64 additions & 4 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [master, dev]
6+
pull_request:
7+
branches: [master]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
fail-fast: false
15+
matrix:
16+
ruby-version: ['3.0', '3.1', '3.4', '4.0']
17+
18+
env:
19+
S3_ENDPOINT: http://localhost:9000
20+
S3_BUCKET: test
21+
GCS_ENDPOINT: http://localhost:8080/
22+
GCS_BUCKET: some-bucket
23+
24+
steps:
25+
- uses: actions/checkout@v4
26+
27+
- name: Start MinIO
28+
run: |
29+
docker run -d --name minio \
30+
-p 9000:9000 \
31+
minio/minio:RELEASE.2025-04-22T22-12-26Z \
32+
sh -c 'mkdir -p /data/test && minio server /data --json'
33+
34+
- name: Start fake-gcs-server
35+
run: |
36+
docker run -d --name gcs \
37+
-p 8080:8080 \
38+
--entrypoint sh \
39+
fsouza/fake-gcs-server \
40+
-c 'mkdir -p /data/some-bucket && /bin/fake-gcs-server -port 8080 -scheme http -external-url=http://localhost:8080 -public-host=localhost:8080 -filesystem-root /data'
41+
42+
- name: Wait for services
43+
run: |
44+
for i in $(seq 1 30); do
45+
curl -sf http://localhost:9000/minio/health/live && curl -sf http://localhost:8080/ && break
46+
sleep 1
47+
done
48+
49+
- name: Set up Ruby ${{ matrix.ruby-version }}
50+
uses: ruby/setup-ruby@v1
51+
with:
52+
ruby-version: ${{ matrix.ruby-version }}
53+
bundler-cache: true
54+
55+
- name: Rubocop
56+
run: bundle exec rubocop --display-style-guide --extra-details
57+
58+
- name: RSpec
59+
run: bundle exec rspec

.rubocop.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ AllCops:
1111
Exclude:
1212
- 'bin/**/*'
1313
- 'uploads/**/*'
14+
- 'vendor/**/*'
1415

1516
Layout/LineLength:
1617
Max: 120

lib/cloud_storage/wrappers/s3.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,6 @@ def resource
9999
@resource ||= Aws::S3::Resource.new(@options)
100100
end
101101

102-
def transfer_manager
103-
@transfer_manager ||= Aws::S3::TransferManager.new(client: client)
104-
end
105-
106102
def upload_file_or_io(key, file_or_io, **opts)
107103
if file_or_io.respond_to?(:path)
108104
transfer_manager.upload_file(file_or_io.path, bucket: @bucket_name, key: key, **opts)
@@ -112,6 +108,10 @@ def upload_file_or_io(key, file_or_io, **opts)
112108
end
113109
end
114110
end
111+
112+
def transfer_manager
113+
@transfer_manager ||= Aws::S3::TransferManager.new(client: client)
114+
end
115115
end
116116
end
117117
end

0 commit comments

Comments
 (0)