-
Notifications
You must be signed in to change notification settings - Fork 51
98 lines (88 loc) · 3.9 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# Inspired from:
# - https://github.com/cockroachdb/sqlalchemy-cockroachdb/blob/master/.github/workflows/ci.yml
# - https://github.com/rgeo/activerecord-postgis-adapter/blob/master/.github/workflows/tests.yml
name: Test
on:
push:
branches: [master]
# Triggers the workflow on pull request events.
pull_request:
types: [opened, reopened, synchronize]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# This allows a subsequently queued workflow run to interrupt previous runs.
concurrency:
group: '${{ github.workflow }} @ ${{ github.ref }}'
cancel-in-progress: true
jobs:
# Since the name of the matrix job depends on the version, we define another job with a more stable name.
test_results:
if: ${{ always() }}
runs-on: ubuntu-latest
name: Test Results
needs: [test]
steps:
- run: |
result="${{ needs.test.result }}"
if [[ $result == "success" || $result == "skipped" ]]; then
exit 0
else
exit 1
fi
test:
runs-on: ubuntu-latest
strategy:
matrix:
crdb: [v23.1.11]
ruby: [head]
name: Test (crdb=${{ matrix.crdb }} ruby=${{ matrix.ruby }})
steps:
- name: Set Up Actions
uses: actions/checkout@v3
- name: Install GEOS
run: sudo apt-get install libgeos-dev
- name: Set Up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- name: Install and Start Cockroachdb
run: |
# Download CockroachDB
wget -qO- https://binaries.cockroachdb.com/cockroach-${{ matrix.crdb }}.linux-amd64.tgz | tar xvz
export PATH=./cockroach-${{ matrix.crdb }}.linux-amd64/:$PATH
readonly urlfile=cockroach-url
# Start a CockroachDB server and wait for it to become ready.
rm -f "$urlfile"
rm -rf cockroach-data
# Start CockroachDB.
cockroach start-single-node --max-sql-memory=25% --cache=25% --insecure --host=localhost --spatial-libs=./cockroach-${{ matrix.crdb }}.linux-amd64/lib --listening-url-file="$urlfile" >/dev/null 2>&1 &
# Ensure CockroachDB is stopped on script exit.
# Wait until CockroachDB has started.
for i in {0..3}; do
[[ -f "$urlfile" ]] && break
backoff=$((2 ** i))
echo "server not yet available; sleeping for $backoff seconds"
sleep $backoff
done
cockroach sql --insecure -e "
CREATE DATABASE activerecord_unittest;
CREATE DATABASE activerecord_unittest2;
SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false;
SET CLUSTER SETTING sql.stats.histogram_collection.enabled = false;
SET CLUSTER SETTING jobs.retention_time = '180s';
SET CLUSTER SETTING sql.defaults.experimental_alter_column_type.enabled = 'true';
ALTER RANGE default CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;
ALTER TABLE system.public.jobs CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;
ALTER RANGE meta CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;
ALTER RANGE system CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;
ALTER RANGE liveness CONFIGURE ZONE USING num_replicas = 1, gc.ttlseconds = 30;
SET CLUSTER SETTING kv.range_merge.queue_interval = '50ms';
SET CLUSTER SETTING kv.raft_log.disable_synchronization_unsafe = 'true';
SET CLUSTER SETTING jobs.registry.interval.cancel = '180s';
SET CLUSTER SETTING jobs.registry.interval.gc = '30s';
SET CLUSTER SETTING kv.range_split.by_load_merge_delay = '5s';
SET CLUSTER SETTING sql.defaults.experimental_temporary_tables.enabled = 'true';
"
- name: Test
run: bundle exec rake test