Skip to content

chore: bump activerecord #286

chore: bump activerecord

chore: bump activerecord #286

Workflow file for this run

# 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:
fail-fast: false
matrix:
# https://www.cockroachlabs.com/docs/releases/release-support-policy
crdb: [v23.2, v24.1, v24.2]
ruby: [head]
name: Test (crdb=${{ matrix.crdb }} ruby=${{ matrix.ruby }})
steps:
- name: Set Up Actions
uses: actions/checkout@v4
- name: Install GEOS
run: sudo apt-get install -yqq 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
readonly full_version=$(ruby -rnet/http -ruri -ryaml -e '
link = "https://raw.githubusercontent.com/cockroachdb/docs/main/src/current/_data/releases.yml"
puts YAML.safe_load(Net::HTTP.get(URI(link))).reverse.find {
_1["major_version"] == "${{ matrix.crdb }}" &&
_1["release_type"] == "Production" &&
!_1["cloud_only"] &&
!_1["withdrawn"] &&
!_1["release_name"].include?("-") # Pre-release
}["release_name"]
')
echo "Downloading $full_version..."
wget -qO- "https://binaries.cockroachdb.com/cockroach-$full_version.linux-amd64.tgz" | tar xvz
export PATH=./cockroach-$full_version.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-$full_version.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
cat ${{ github.workspace }}/setup.sql | cockroach sql --insecure
- name: Test
run: bundle exec rake test TESTOPTS='--profile=3'