activerecord-spanner-adapter 0.3.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/CODEOWNERS +7 -0
- data/.github/sync-repo-settings.yaml +16 -0
- data/.github/workflows/acceptance-tests-on-emulator.yaml +45 -0
- data/.github/workflows/acceptance-tests-on-production.yaml +36 -0
- data/.github/workflows/ci.yaml +33 -0
- data/.github/workflows/nightly-acceptance-tests-on-emulator.yaml +52 -0
- data/.github/workflows/nightly-acceptance-tests-on-production.yaml +35 -0
- data/.github/workflows/nightly-unit-tests.yaml +40 -0
- data/.github/workflows/release-please-label.yml +25 -0
- data/.github/workflows/release-please.yml +39 -0
- data/.github/workflows/rubocop.yaml +31 -0
- data/.gitignore +67 -5
- data/.kokoro/populate-secrets.sh +77 -0
- data/.kokoro/release.cfg +33 -0
- data/.kokoro/release.sh +15 -0
- data/.kokoro/trampoline_v2.sh +489 -0
- data/.rubocop.yml +46 -0
- data/.toys/release.rb +18 -0
- data/.trampolinerc +48 -0
- data/.yardopts +11 -0
- data/CHANGELOG.md +26 -0
- data/CODE_OF_CONDUCT.md +40 -0
- data/CONTRIBUTING.md +79 -0
- data/Gemfile +9 -4
- data/LICENSE +6 -6
- data/README.md +67 -30
- data/Rakefile +79 -3
- data/SECURITY.md +7 -0
- data/acceptance/cases/associations/has_many_associations_test.rb +119 -0
- data/acceptance/cases/associations/has_many_through_associations_test.rb +63 -0
- data/acceptance/cases/associations/has_one_associations_test.rb +79 -0
- data/acceptance/cases/associations/has_one_through_associations_test.rb +98 -0
- data/acceptance/cases/interleaved_associations/has_many_associations_using_interleaved_test.rb +211 -0
- data/acceptance/cases/migration/change_schema_test.rb +433 -0
- data/acceptance/cases/migration/change_table_test.rb +115 -0
- data/acceptance/cases/migration/column_attributes_test.rb +122 -0
- data/acceptance/cases/migration/column_positioning_test.rb +48 -0
- data/acceptance/cases/migration/columns_test.rb +201 -0
- data/acceptance/cases/migration/command_recorder_test.rb +406 -0
- data/acceptance/cases/migration/create_join_table_test.rb +216 -0
- data/acceptance/cases/migration/ddl_batching_test.rb +80 -0
- data/acceptance/cases/migration/foreign_key_test.rb +297 -0
- data/acceptance/cases/migration/index_test.rb +211 -0
- data/acceptance/cases/migration/references_foreign_key_test.rb +259 -0
- data/acceptance/cases/migration/references_index_test.rb +135 -0
- data/acceptance/cases/migration/references_statements_test.rb +166 -0
- data/acceptance/cases/migration/rename_column_test.rb +96 -0
- data/acceptance/cases/models/calculation_query_test.rb +128 -0
- data/acceptance/cases/models/generated_column_test.rb +126 -0
- data/acceptance/cases/models/mutation_test.rb +122 -0
- data/acceptance/cases/models/query_test.rb +147 -0
- data/acceptance/cases/sessions/session_not_found_test.rb +121 -0
- data/acceptance/cases/transactions/optimistic_locking_test.rb +141 -0
- data/acceptance/cases/transactions/read_only_transactions_test.rb +67 -0
- data/acceptance/cases/transactions/read_write_transactions_test.rb +248 -0
- data/acceptance/cases/type/all_types_test.rb +152 -0
- data/acceptance/cases/type/binary_test.rb +59 -0
- data/acceptance/cases/type/boolean_test.rb +31 -0
- data/acceptance/cases/type/date_test.rb +32 -0
- data/acceptance/cases/type/date_time_test.rb +30 -0
- data/acceptance/cases/type/float_test.rb +27 -0
- data/acceptance/cases/type/integer_test.rb +44 -0
- data/acceptance/cases/type/numeric_test.rb +27 -0
- data/acceptance/cases/type/string_test.rb +79 -0
- data/acceptance/cases/type/text_test.rb +30 -0
- data/acceptance/cases/type/time_test.rb +87 -0
- data/acceptance/models/account.rb +13 -0
- data/acceptance/models/address.rb +9 -0
- data/acceptance/models/album.rb +12 -0
- data/acceptance/models/all_types.rb +8 -0
- data/acceptance/models/author.rb +11 -0
- data/acceptance/models/club.rb +12 -0
- data/acceptance/models/comment.rb +9 -0
- data/acceptance/models/customer.rb +9 -0
- data/acceptance/models/department.rb +9 -0
- data/acceptance/models/firm.rb +10 -0
- data/acceptance/models/member.rb +13 -0
- data/acceptance/models/member_type.rb +9 -0
- data/acceptance/models/membership.rb +10 -0
- data/acceptance/models/organization.rb +9 -0
- data/acceptance/models/post.rb +10 -0
- data/acceptance/models/singer.rb +10 -0
- data/acceptance/models/track.rb +20 -0
- data/acceptance/models/transaction.rb +9 -0
- data/acceptance/schema/schema.rb +143 -0
- data/acceptance/test_helper.rb +260 -0
- data/activerecord-spanner-adapter.gemspec +32 -17
- data/assets/solidus-db.png +0 -0
- data/benchmarks/README.md +17 -0
- data/benchmarks/Rakefile +14 -0
- data/benchmarks/application.rb +308 -0
- data/benchmarks/config/database.yml +8 -0
- data/benchmarks/config/environment.rb +12 -0
- data/benchmarks/db/migrate/01_create_tables.rb +25 -0
- data/benchmarks/db/schema.rb +29 -0
- data/benchmarks/models/album.rb +9 -0
- data/benchmarks/models/singer.rb +9 -0
- data/bin/console +6 -7
- data/examples/rails/README.md +262 -0
- data/examples/snippets/README.md +29 -0
- data/examples/snippets/Rakefile +57 -0
- data/examples/snippets/array-data-type/README.md +45 -0
- data/examples/snippets/array-data-type/Rakefile +13 -0
- data/examples/snippets/array-data-type/application.rb +45 -0
- data/examples/snippets/array-data-type/config/database.yml +8 -0
- data/examples/snippets/array-data-type/db/migrate/01_create_tables.rb +24 -0
- data/examples/snippets/array-data-type/db/schema.rb +26 -0
- data/examples/snippets/array-data-type/db/seeds.rb +5 -0
- data/examples/snippets/array-data-type/models/entity_with_array_types.rb +18 -0
- data/examples/snippets/bin/create_emulator_instance.rb +18 -0
- data/examples/snippets/bulk-insert/README.md +21 -0
- data/examples/snippets/bulk-insert/Rakefile +13 -0
- data/examples/snippets/bulk-insert/application.rb +64 -0
- data/examples/snippets/bulk-insert/config/database.yml +8 -0
- data/examples/snippets/bulk-insert/db/migrate/01_create_tables.rb +21 -0
- data/examples/snippets/bulk-insert/db/schema.rb +26 -0
- data/examples/snippets/bulk-insert/db/seeds.rb +5 -0
- data/examples/snippets/bulk-insert/models/album.rb +9 -0
- data/examples/snippets/bulk-insert/models/singer.rb +9 -0
- data/examples/snippets/commit-timestamp/README.md +18 -0
- data/examples/snippets/commit-timestamp/Rakefile +13 -0
- data/examples/snippets/commit-timestamp/application.rb +53 -0
- data/examples/snippets/commit-timestamp/config/database.yml +8 -0
- data/examples/snippets/commit-timestamp/db/migrate/01_create_tables.rb +26 -0
- data/examples/snippets/commit-timestamp/db/schema.rb +29 -0
- data/examples/snippets/commit-timestamp/db/seeds.rb +5 -0
- data/examples/snippets/commit-timestamp/models/album.rb +9 -0
- data/examples/snippets/commit-timestamp/models/singer.rb +9 -0
- data/examples/snippets/config/environment.rb +21 -0
- data/examples/snippets/create-records/README.md +12 -0
- data/examples/snippets/create-records/Rakefile +13 -0
- data/examples/snippets/create-records/application.rb +42 -0
- data/examples/snippets/create-records/config/database.yml +8 -0
- data/examples/snippets/create-records/db/migrate/01_create_tables.rb +21 -0
- data/examples/snippets/create-records/db/schema.rb +26 -0
- data/examples/snippets/create-records/db/seeds.rb +5 -0
- data/examples/snippets/create-records/models/album.rb +9 -0
- data/examples/snippets/create-records/models/singer.rb +9 -0
- data/examples/snippets/date-data-type/README.md +19 -0
- data/examples/snippets/date-data-type/Rakefile +13 -0
- data/examples/snippets/date-data-type/application.rb +35 -0
- data/examples/snippets/date-data-type/config/database.yml +8 -0
- data/examples/snippets/date-data-type/db/migrate/01_create_tables.rb +20 -0
- data/examples/snippets/date-data-type/db/schema.rb +21 -0
- data/examples/snippets/date-data-type/db/seeds.rb +16 -0
- data/examples/snippets/date-data-type/models/singer.rb +8 -0
- data/examples/snippets/generated-column/README.md +41 -0
- data/examples/snippets/generated-column/Rakefile +13 -0
- data/examples/snippets/generated-column/application.rb +37 -0
- data/examples/snippets/generated-column/config/database.yml +8 -0
- data/examples/snippets/generated-column/db/migrate/01_create_tables.rb +23 -0
- data/examples/snippets/generated-column/db/schema.rb +21 -0
- data/examples/snippets/generated-column/db/seeds.rb +18 -0
- data/examples/snippets/generated-column/models/singer.rb +8 -0
- data/examples/snippets/interleaved-tables/README.md +152 -0
- data/examples/snippets/interleaved-tables/Rakefile +13 -0
- data/examples/snippets/interleaved-tables/application.rb +109 -0
- data/examples/snippets/interleaved-tables/config/database.yml +8 -0
- data/examples/snippets/interleaved-tables/db/migrate/01_create_tables.rb +44 -0
- data/examples/snippets/interleaved-tables/db/schema.rb +32 -0
- data/examples/snippets/interleaved-tables/db/seeds.rb +40 -0
- data/examples/snippets/interleaved-tables/models/album.rb +15 -0
- data/examples/snippets/interleaved-tables/models/singer.rb +20 -0
- data/examples/snippets/interleaved-tables/models/track.rb +25 -0
- data/examples/snippets/migrations/README.md +43 -0
- data/examples/snippets/migrations/Rakefile +13 -0
- data/examples/snippets/migrations/application.rb +26 -0
- data/examples/snippets/migrations/config/database.yml +8 -0
- data/examples/snippets/migrations/db/migrate/01_create_tables.rb +28 -0
- data/examples/snippets/migrations/db/schema.rb +33 -0
- data/examples/snippets/migrations/db/seeds.rb +5 -0
- data/examples/snippets/migrations/models/album.rb +10 -0
- data/examples/snippets/migrations/models/singer.rb +10 -0
- data/examples/snippets/migrations/models/track.rb +9 -0
- data/examples/snippets/mutations/README.md +34 -0
- data/examples/snippets/mutations/Rakefile +13 -0
- data/examples/snippets/mutations/application.rb +47 -0
- data/examples/snippets/mutations/config/database.yml +8 -0
- data/examples/snippets/mutations/db/migrate/01_create_tables.rb +22 -0
- data/examples/snippets/mutations/db/schema.rb +27 -0
- data/examples/snippets/mutations/db/seeds.rb +25 -0
- data/examples/snippets/mutations/models/album.rb +9 -0
- data/examples/snippets/mutations/models/singer.rb +9 -0
- data/examples/snippets/optimistic-locking/README.md +12 -0
- data/examples/snippets/optimistic-locking/Rakefile +13 -0
- data/examples/snippets/optimistic-locking/application.rb +48 -0
- data/examples/snippets/optimistic-locking/config/database.yml +8 -0
- data/examples/snippets/optimistic-locking/db/migrate/01_create_tables.rb +26 -0
- data/examples/snippets/optimistic-locking/db/schema.rb +29 -0
- data/examples/snippets/optimistic-locking/db/seeds.rb +25 -0
- data/examples/snippets/optimistic-locking/models/album.rb +9 -0
- data/examples/snippets/optimistic-locking/models/singer.rb +9 -0
- data/examples/snippets/quickstart/README.md +26 -0
- data/examples/snippets/quickstart/Rakefile +13 -0
- data/examples/snippets/quickstart/application.rb +51 -0
- data/examples/snippets/quickstart/config/database.yml +8 -0
- data/examples/snippets/quickstart/db/migrate/01_create_tables.rb +21 -0
- data/examples/snippets/quickstart/db/schema.rb +26 -0
- data/examples/snippets/quickstart/db/seeds.rb +24 -0
- data/examples/snippets/quickstart/models/album.rb +9 -0
- data/examples/snippets/quickstart/models/singer.rb +9 -0
- data/examples/snippets/read-only-transactions/README.md +13 -0
- data/examples/snippets/read-only-transactions/Rakefile +13 -0
- data/examples/snippets/read-only-transactions/application.rb +49 -0
- data/examples/snippets/read-only-transactions/config/database.yml +8 -0
- data/examples/snippets/read-only-transactions/db/migrate/01_create_tables.rb +21 -0
- data/examples/snippets/read-only-transactions/db/schema.rb +26 -0
- data/examples/snippets/read-only-transactions/db/seeds.rb +24 -0
- data/examples/snippets/read-only-transactions/models/album.rb +9 -0
- data/examples/snippets/read-only-transactions/models/singer.rb +9 -0
- data/examples/snippets/read-write-transactions/README.md +12 -0
- data/examples/snippets/read-write-transactions/Rakefile +13 -0
- data/examples/snippets/read-write-transactions/application.rb +39 -0
- data/examples/snippets/read-write-transactions/config/database.yml +8 -0
- data/examples/snippets/read-write-transactions/db/migrate/01_create_tables.rb +22 -0
- data/examples/snippets/read-write-transactions/db/schema.rb +27 -0
- data/examples/snippets/read-write-transactions/db/seeds.rb +25 -0
- data/examples/snippets/read-write-transactions/models/album.rb +9 -0
- data/examples/snippets/read-write-transactions/models/singer.rb +9 -0
- data/examples/snippets/timestamp-data-type/README.md +17 -0
- data/examples/snippets/timestamp-data-type/Rakefile +13 -0
- data/examples/snippets/timestamp-data-type/application.rb +42 -0
- data/examples/snippets/timestamp-data-type/config/database.yml +8 -0
- data/examples/snippets/timestamp-data-type/db/migrate/01_create_tables.rb +21 -0
- data/examples/snippets/timestamp-data-type/db/schema.rb +21 -0
- data/examples/snippets/timestamp-data-type/db/seeds.rb +6 -0
- data/examples/snippets/timestamp-data-type/models/meeting.rb +19 -0
- data/examples/solidus/README.md +172 -0
- data/lib/active_record/connection_adapters/spanner/database_statements.rb +224 -269
- data/lib/active_record/connection_adapters/spanner/quoting.rb +42 -50
- data/lib/active_record/connection_adapters/spanner/schema_cache.rb +43 -0
- data/lib/active_record/connection_adapters/spanner/schema_creation.rb +125 -9
- data/lib/active_record/connection_adapters/spanner/schema_definitions.rb +122 -0
- data/lib/active_record/connection_adapters/spanner/schema_dumper.rb +19 -0
- data/lib/active_record/connection_adapters/spanner/schema_statements.rb +553 -139
- data/lib/active_record/connection_adapters/spanner/type_metadata.rb +37 -0
- data/lib/active_record/connection_adapters/spanner_adapter.rb +182 -78
- data/lib/active_record/tasks/spanner_database_tasks.rb +74 -0
- data/lib/active_record/type/spanner/array.rb +32 -0
- data/lib/active_record/type/spanner/bytes.rb +26 -0
- data/lib/active_record/type/spanner/spanner_active_record_converter.rb +32 -0
- data/lib/active_record/type/spanner/time.rb +37 -0
- data/lib/activerecord-spanner-adapter.rb +23 -0
- data/lib/activerecord_spanner_adapter/base.rb +217 -0
- data/lib/activerecord_spanner_adapter/connection.rb +324 -0
- data/lib/activerecord_spanner_adapter/errors.rb +13 -0
- data/lib/activerecord_spanner_adapter/foreign_key.rb +29 -0
- data/lib/activerecord_spanner_adapter/index/column.rb +38 -0
- data/lib/activerecord_spanner_adapter/index.rb +80 -0
- data/lib/activerecord_spanner_adapter/information_schema.rb +261 -0
- data/lib/activerecord_spanner_adapter/primary_key.rb +31 -0
- data/lib/activerecord_spanner_adapter/table/column.rb +59 -0
- data/lib/activerecord_spanner_adapter/table.rb +61 -0
- data/lib/activerecord_spanner_adapter/transaction.rb +113 -0
- data/lib/activerecord_spanner_adapter/version.rb +9 -0
- data/lib/arel/visitors/spanner.rb +35 -0
- data/lib/spanner_client_ext.rb +82 -0
- data/renovate.json +5 -0
- metadata +387 -34
- data/.travis.yml +0 -5
- data/lib/active_record/connection_adapters/spanner/client.rb +0 -190
- data/lib/active_record/connection_adapters/spanner.rb +0 -10
- data/lib/activerecord-spanner-adapter/version.rb +0 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3761fdcb057da7fcec3150ec38e865bdb61d50eff368634146eefff6fb2bea27
|
4
|
+
data.tar.gz: cebbacfbbce4943f0d4cc799dfa2abc6deb352c2069059e6aac869293063eb6c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6aeefe0da3b1c627a2e5319b84f7d1519630421d773420197810b3e619e3f766e02ccd67cc89e9daf7ddee14985eb7aec371d1a685a5ff27004a57864f5e7ef4
|
7
|
+
data.tar.gz: 0c807717d9d42ee7624a4e0710626718a89f0a51a2e3c968001f3d01587dd13448ac57c5569af3d82d417305bfa63f46cb932cae8d007735f68fde080d4e119e
|
data/.github/CODEOWNERS
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
# Code owners file.
|
2
|
+
# This file controls who is tagged for review for any given pull request.
|
3
|
+
#
|
4
|
+
# For syntax help see:
|
5
|
+
# https://help.github.com/en/github/creating-cloning-and-archiving-repositories/about-code-owners#codeowners-syntax
|
6
|
+
|
7
|
+
* @jiren @skuruppu @dazuma @hengfengli @olavloite @xiangshen-dk
|
@@ -0,0 +1,16 @@
|
|
1
|
+
rebaseMergeAllowed: true
|
2
|
+
squashMergeAllowed: true
|
3
|
+
mergeCommitAllowed: false
|
4
|
+
branchProtectionRules:
|
5
|
+
- pattern: master
|
6
|
+
isAdminEnforced: true
|
7
|
+
requiredStatusCheckContexts:
|
8
|
+
- 'cla/google'
|
9
|
+
requiredApprovingReviewCount: 1
|
10
|
+
requiresCodeOwnerReviews: true
|
11
|
+
requiresStrictStatusChecks: true
|
12
|
+
permissionRules:
|
13
|
+
- team: yoshi-ruby
|
14
|
+
permission: push
|
15
|
+
- team: yoshi-ruby-admins
|
16
|
+
permission: admin
|
@@ -0,0 +1,45 @@
|
|
1
|
+
on:
|
2
|
+
push:
|
3
|
+
branches:
|
4
|
+
- master
|
5
|
+
pull_request:
|
6
|
+
name: acceptance tests on emulator
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
services:
|
12
|
+
emulator:
|
13
|
+
image: gcr.io/cloud-spanner-emulator/emulator:latest
|
14
|
+
ports:
|
15
|
+
- 9010:9010
|
16
|
+
- 9020:9020
|
17
|
+
|
18
|
+
strategy:
|
19
|
+
max-parallel: 4
|
20
|
+
matrix:
|
21
|
+
ruby: [2.6, 2.7, 3.0]
|
22
|
+
ar: [6.0.4, 6.1.4]
|
23
|
+
# Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
|
24
|
+
exclude:
|
25
|
+
- ruby: 3.0
|
26
|
+
ar: 6.0.4
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- name: Set up Ruby
|
30
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
|
31
|
+
# (see https://github.com/ruby/setup-ruby#versioning):
|
32
|
+
uses: ruby/setup-ruby@v1
|
33
|
+
with:
|
34
|
+
bundler-cache: false
|
35
|
+
ruby-version: ${{ matrix.ruby }}
|
36
|
+
- name: Set ActiveRecord version
|
37
|
+
run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
|
38
|
+
- name: Install dependencies
|
39
|
+
run: bundle install
|
40
|
+
- name: Run acceptance tests on emulator
|
41
|
+
run: bundle exec rake acceptance
|
42
|
+
env:
|
43
|
+
SPANNER_EMULATOR_HOST: localhost:9010
|
44
|
+
SPANNER_TEST_PROJECT: test-project
|
45
|
+
SPANNER_TEST_INSTANCE: test-instance
|
@@ -0,0 +1,36 @@
|
|
1
|
+
on:
|
2
|
+
push:
|
3
|
+
branches:
|
4
|
+
- master
|
5
|
+
pull_request:
|
6
|
+
name: acceptance tests on production
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
|
11
|
+
strategy:
|
12
|
+
max-parallel: 4
|
13
|
+
matrix:
|
14
|
+
ruby: [3.0]
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v2
|
17
|
+
- name: Set up Ruby
|
18
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
|
19
|
+
# (see https://github.com/ruby/setup-ruby#versioning):
|
20
|
+
uses: ruby/setup-ruby@v1
|
21
|
+
with:
|
22
|
+
bundler-cache: true
|
23
|
+
ruby-version: ${{ matrix.ruby }}
|
24
|
+
- name: Setup GCloud
|
25
|
+
uses: google-github-actions/setup-gcloud@master
|
26
|
+
with:
|
27
|
+
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
28
|
+
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
29
|
+
export_default_credentials: true
|
30
|
+
- name: Install dependencies
|
31
|
+
run: bundle install
|
32
|
+
- name: Run acceptance tests on production
|
33
|
+
run: bundle exec rake acceptance\[,,,"exclude cases/migration"\]
|
34
|
+
env:
|
35
|
+
SPANNER_TEST_PROJECT: ${{ secrets.GCP_PROJECT_ID }}
|
36
|
+
SPANNER_TEST_INSTANCE: ruby-activerecord-test
|
@@ -0,0 +1,33 @@
|
|
1
|
+
on:
|
2
|
+
push:
|
3
|
+
branches:
|
4
|
+
- master
|
5
|
+
pull_request:
|
6
|
+
name: ci
|
7
|
+
jobs:
|
8
|
+
test:
|
9
|
+
runs-on: ubuntu-latest
|
10
|
+
strategy:
|
11
|
+
max-parallel: 4
|
12
|
+
matrix:
|
13
|
+
ruby: [2.6, 2.7, 3.0]
|
14
|
+
ar: [6.0.4, 6.1.4]
|
15
|
+
# Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
|
16
|
+
exclude:
|
17
|
+
- ruby: 3.0
|
18
|
+
ar: 6.0.4
|
19
|
+
steps:
|
20
|
+
- uses: actions/checkout@v2
|
21
|
+
- name: Set up Ruby
|
22
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
|
23
|
+
# (see https://github.com/ruby/setup-ruby#versioning):
|
24
|
+
uses: ruby/setup-ruby@v1
|
25
|
+
with:
|
26
|
+
bundler-cache: false
|
27
|
+
ruby-version: ${{ matrix.ruby }}
|
28
|
+
- name: Set ActiveRecord version
|
29
|
+
run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
|
30
|
+
- name: Install dependencies
|
31
|
+
run: bundle install
|
32
|
+
- name: Run tests
|
33
|
+
run: bundle exec rake test
|
@@ -0,0 +1,52 @@
|
|
1
|
+
on:
|
2
|
+
schedule:
|
3
|
+
# 06:00 UTC
|
4
|
+
- cron: '0 6 * * *'
|
5
|
+
name: nightly acceptance tests on emulator
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
services:
|
11
|
+
emulator:
|
12
|
+
image: gcr.io/cloud-spanner-emulator/emulator:latest
|
13
|
+
ports:
|
14
|
+
- 9010:9010
|
15
|
+
- 9020:9020
|
16
|
+
|
17
|
+
strategy:
|
18
|
+
max-parallel: 4
|
19
|
+
matrix:
|
20
|
+
# Run acceptance tests all supported combinations of Ruby and ActiveRecord.
|
21
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
22
|
+
ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.0, 6.1.1, 6.1.2.1, 6.1.3.2, 6.1.4]
|
23
|
+
# Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
|
24
|
+
exclude:
|
25
|
+
- ruby: 3.0
|
26
|
+
ar: 6.0.0
|
27
|
+
- ruby: 3.0
|
28
|
+
ar: 6.0.1
|
29
|
+
- ruby: 3.0
|
30
|
+
ar: 6.0.2.2
|
31
|
+
- ruby: 3.0
|
32
|
+
ar: 6.0.3.7
|
33
|
+
- ruby: 3.0
|
34
|
+
ar: 6.0.4
|
35
|
+
steps:
|
36
|
+
- uses: actions/checkout@v2
|
37
|
+
- name: Set up Ruby
|
38
|
+
uses: ruby/setup-ruby@v1
|
39
|
+
with:
|
40
|
+
# Disable caching as we are overriding the ActiveRecord below.
|
41
|
+
bundler-cache: false
|
42
|
+
ruby-version: ${{ matrix.ruby }}
|
43
|
+
- name: Set ActiveRecord version
|
44
|
+
run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
|
45
|
+
- name: Install dependencies
|
46
|
+
run: bundle install
|
47
|
+
- name: Run acceptance tests on emulator
|
48
|
+
run: bundle exec rake acceptance
|
49
|
+
env:
|
50
|
+
SPANNER_EMULATOR_HOST: localhost:9010
|
51
|
+
SPANNER_TEST_PROJECT: test-project
|
52
|
+
SPANNER_TEST_INSTANCE: test-instance
|
@@ -0,0 +1,35 @@
|
|
1
|
+
on:
|
2
|
+
schedule:
|
3
|
+
# 02:00 UTC
|
4
|
+
- cron: '0 2 * * *'
|
5
|
+
name: nightly acceptance tests on production
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
|
10
|
+
strategy:
|
11
|
+
max-parallel: 4
|
12
|
+
matrix:
|
13
|
+
ruby: [3.0]
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: Set up Ruby
|
17
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby
|
18
|
+
# (see https://github.com/ruby/setup-ruby#versioning):
|
19
|
+
uses: ruby/setup-ruby@v1
|
20
|
+
with:
|
21
|
+
bundler-cache: true
|
22
|
+
ruby-version: ${{ matrix.ruby }}
|
23
|
+
- name: Setup GCloud
|
24
|
+
uses: google-github-actions/setup-gcloud@master
|
25
|
+
with:
|
26
|
+
project_id: ${{ secrets.GCP_PROJECT_ID }}
|
27
|
+
service_account_key: ${{ secrets.GCP_SA_KEY }}
|
28
|
+
export_default_credentials: true
|
29
|
+
- name: Install dependencies
|
30
|
+
run: bundle install
|
31
|
+
- name: Run acceptance tests on production
|
32
|
+
run: bundle exec rake acceptance
|
33
|
+
env:
|
34
|
+
SPANNER_TEST_PROJECT: ${{ secrets.GCP_PROJECT_ID }}
|
35
|
+
SPANNER_TEST_INSTANCE: ruby-activerecord-test
|
@@ -0,0 +1,40 @@
|
|
1
|
+
on:
|
2
|
+
schedule:
|
3
|
+
# 05:30 UTC
|
4
|
+
- cron: '30 5 * * *'
|
5
|
+
name: nightly-unit-tests
|
6
|
+
jobs:
|
7
|
+
test:
|
8
|
+
runs-on: ubuntu-latest
|
9
|
+
strategy:
|
10
|
+
max-parallel: 4
|
11
|
+
matrix:
|
12
|
+
# Run unit tests all supported combinations of Ruby and ActiveRecord.
|
13
|
+
ruby: [2.5, 2.6, 2.7, 3.0]
|
14
|
+
ar: [6.0.0, 6.0.1, 6.0.2.2, 6.0.3.7, 6.0.4, 6.1.0, 6.1.1, 6.1.2.1, 6.1.3.2, 6.1.4]
|
15
|
+
# Exclude Ruby 3.0 and ActiveRecord 6.0.x as that combination is not supported.
|
16
|
+
exclude:
|
17
|
+
- ruby: 3.0
|
18
|
+
ar: 6.0.0
|
19
|
+
- ruby: 3.0
|
20
|
+
ar: 6.0.1
|
21
|
+
- ruby: 3.0
|
22
|
+
ar: 6.0.2.2
|
23
|
+
- ruby: 3.0
|
24
|
+
ar: 6.0.3.7
|
25
|
+
- ruby: 3.0
|
26
|
+
ar: 6.0.4
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v2
|
29
|
+
- name: Set up Ruby
|
30
|
+
uses: ruby/setup-ruby@v1
|
31
|
+
with:
|
32
|
+
# Disable caching as we are overriding the ActiveRecord below.
|
33
|
+
bundler-cache: false
|
34
|
+
ruby-version: ${{ matrix.ruby }}
|
35
|
+
- name: Set ActiveRecord version
|
36
|
+
run: sed -i "s/\"activerecord\", \"~> 6.1.4\"/\"activerecord\", \"${{ matrix.ar }}\"/" activerecord-spanner-adapter.gemspec
|
37
|
+
- name: Install dependencies
|
38
|
+
run: bundle install
|
39
|
+
- name: Run tests
|
40
|
+
run: bundle exec rake test
|
@@ -0,0 +1,25 @@
|
|
1
|
+
name: release-please-label
|
2
|
+
on:
|
3
|
+
pull_request_target:
|
4
|
+
branches:
|
5
|
+
- master
|
6
|
+
types:
|
7
|
+
- opened
|
8
|
+
jobs:
|
9
|
+
release-please-label:
|
10
|
+
if: "${{ github.event.sender.login == 'yoshi-code-bot' && startsWith(github.event.pull_request.title, 'chore: release ') }}"
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
steps:
|
13
|
+
- name: ReleaseLabel
|
14
|
+
uses: actions/github-script@v4
|
15
|
+
with:
|
16
|
+
github-token: ${{secrets.YOSHI_APPROVER_TOKEN}}
|
17
|
+
script: |
|
18
|
+
core.info('Labeling release');
|
19
|
+
await github.issues.addLabels({
|
20
|
+
owner: context.repo.owner,
|
21
|
+
repo: context.repo.repo,
|
22
|
+
issue_number: context.payload.pull_request.number,
|
23
|
+
labels: ['autorelease: pending']
|
24
|
+
});
|
25
|
+
core.info('Labeled');
|
@@ -0,0 +1,39 @@
|
|
1
|
+
name: Release-Please
|
2
|
+
on:
|
3
|
+
schedule:
|
4
|
+
- cron: '27 8 * * *'
|
5
|
+
workflow_dispatch:
|
6
|
+
inputs:
|
7
|
+
gem:
|
8
|
+
description: "Name of single gem to release. Leave blank to check all gems."
|
9
|
+
required: false
|
10
|
+
args:
|
11
|
+
description: "Extra command line arguments."
|
12
|
+
required: false
|
13
|
+
|
14
|
+
jobs:
|
15
|
+
release-please:
|
16
|
+
if: ${{ github.repository == 'googleapis/ruby-spanner-activerecord' }}
|
17
|
+
runs-on: ubuntu-latest
|
18
|
+
env:
|
19
|
+
GITHUB_TOKEN: ${{ secrets.YOSHI_CODE_BOT_TOKEN }}
|
20
|
+
RELEASE_PLEASE_DISABLE: ${{ secrets.RELEASE_PLEASE_DISABLE }}
|
21
|
+
steps:
|
22
|
+
- name: Checkout repo
|
23
|
+
uses: actions/checkout@v2
|
24
|
+
- name: Install Ruby 2.7
|
25
|
+
uses: ruby/setup-ruby@v1
|
26
|
+
with:
|
27
|
+
ruby-version: "2.7"
|
28
|
+
- name: Install NodeJS 12.x
|
29
|
+
uses: actions/setup-node@v2
|
30
|
+
with:
|
31
|
+
node-version: "12.x"
|
32
|
+
- name: Install tools
|
33
|
+
run: "gem install --no-document toys && npm install release-please"
|
34
|
+
- name: execute
|
35
|
+
run: |
|
36
|
+
toys release please -v --fork \
|
37
|
+
--github-event-name=${{ github.event_name }} \
|
38
|
+
--version-file=lib/activerecord_spanner_adapter/version.rb \
|
39
|
+
${{ github.event.inputs.args }} -- ${{ github.event.inputs.gem }}
|
@@ -0,0 +1,31 @@
|
|
1
|
+
name: rubocop
|
2
|
+
|
3
|
+
on:
|
4
|
+
pull_request:
|
5
|
+
types: [opened, synchronize]
|
6
|
+
push:
|
7
|
+
branches: [ master ]
|
8
|
+
|
9
|
+
jobs:
|
10
|
+
build:
|
11
|
+
runs-on: ubuntu-latest
|
12
|
+
timeout-minutes: 10
|
13
|
+
|
14
|
+
steps:
|
15
|
+
- uses: actions/checkout@v2
|
16
|
+
- name: setup ruby
|
17
|
+
uses: ruby/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: '2.5'
|
20
|
+
- name: cache gems
|
21
|
+
uses: actions/cache@v1
|
22
|
+
with:
|
23
|
+
path: vendor/bundle
|
24
|
+
key: ${{ runner.os }}-rubocop-${{ hashFiles('**/Gemfile.lock') }}
|
25
|
+
restore-keys: ${{ runner.os }}-rubocop-
|
26
|
+
- name: install gems
|
27
|
+
run: |
|
28
|
+
bundle config set path vendor/bundle
|
29
|
+
bundle install --jobs 4 --retry 3
|
30
|
+
- name: exec rubocop
|
31
|
+
run: bundle exec rubocop --parallel
|
data/.gitignore
CHANGED
@@ -1,9 +1,71 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
/_yardoc/
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
/.config
|
5
4
|
/coverage/
|
6
|
-
/
|
5
|
+
/InstalledFiles
|
7
6
|
/pkg/
|
8
7
|
/spec/reports/
|
8
|
+
/spec/examples.txt
|
9
|
+
/test/tmp/
|
10
|
+
/test/version_tmp/
|
9
11
|
/tmp/
|
12
|
+
|
13
|
+
# Node-related
|
14
|
+
/node_modules/
|
15
|
+
/package-lock.json
|
16
|
+
|
17
|
+
# Used by dotenv library to load environment variables.
|
18
|
+
# .env
|
19
|
+
|
20
|
+
# Ignore Byebug command history file.
|
21
|
+
.byebug_history
|
22
|
+
|
23
|
+
## Specific to RubyMotion:
|
24
|
+
.dat*
|
25
|
+
.repl_history
|
26
|
+
build/
|
27
|
+
*.bridgesupport
|
28
|
+
build-iPhoneOS/
|
29
|
+
build-iPhoneSimulator/
|
30
|
+
|
31
|
+
## Specific to RubyMotion (use of CocoaPods):
|
32
|
+
#
|
33
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
34
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
35
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
36
|
+
#
|
37
|
+
# vendor/Pods/
|
38
|
+
|
39
|
+
# Ignore RubyMine project files
|
40
|
+
.idea
|
41
|
+
|
42
|
+
## Documentation cache and generated files:
|
43
|
+
/.yardoc/
|
44
|
+
/_yardoc/
|
45
|
+
/doc/
|
46
|
+
/rdoc/
|
47
|
+
|
48
|
+
## Environment normalization:
|
49
|
+
/.bundle/
|
50
|
+
/vendor/bundle
|
51
|
+
/lib/bundler/man/
|
52
|
+
|
53
|
+
# for a library or gem, you might want to ignore these files since the code is
|
54
|
+
# intended to run in multiple environments; otherwise, check them in:
|
55
|
+
Gemfile.lock
|
56
|
+
.ruby-version
|
57
|
+
.ruby-gemset
|
58
|
+
|
59
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
60
|
+
.rvmrc
|
61
|
+
|
62
|
+
# Used by RuboCop. Remote config files pulled in from inherit_from directive.
|
63
|
+
# .rubocop-https?--*
|
64
|
+
|
65
|
+
# Extra
|
66
|
+
.DS_Store
|
67
|
+
.DS_STORE
|
68
|
+
*.diff
|
69
|
+
*.swp
|
70
|
+
*.env*
|
71
|
+
byebug_history
|