Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 99 additions & 0 deletions .github/workflows/orm-integration-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
name: ORM Integration Test

# Runs the `//go:build integration` tagged suites from the optsqlite2 ORM
# line against a real Easysearch cluster:
#
# modules/elastic TestContract_Elastic, TestAggConformance_Elastic
# (backend contract + aggregation conformance)
# modules/sqlite TestAggParity_SQLite_Elastic
# (deep-compare sqlite vs elastic results)
#
# The suites bootstrap themselves from ES_ENDPOINT/ES_USERNAME/ES_PASSWORD
# (modules/elastic/integration_env_test.go + core/orm/ormtest) and skip
# gracefully when the cluster is unreachable, so this workflow stays green
# even if the Easysearch install flakes.

on:
pull_request:
branches: [ "main" ]
paths:
- "core/orm/**"
- "core/aggregate/**"
- "core/elastic/**"
- "modules/elastic/**"
- "modules/sqlite/**"
- ".github/workflows/orm-integration-test.yml"

jobs:
orm-integration-test:
timeout-minutes: 30
runs-on: ubuntu-latest
steps:
- name: Checkout current repository
uses: actions/checkout@v4
with:
path: framework

- name: Set up go toolchain
uses: actions/setup-go@v5
with:
go-version-file: framework/go.mod
check-latest: false
cache: true
cache-dependency-path: framework/go.sum

- name: Check go toolchain
run: go version

- name: Download GraalVM JDK 21
shell: bash
run: |
mkdir -p $HOME/jdk21
curl -sSL https://release.infinilabs.com/easysearch/jdk/21/graalvm-jdk-21_linux-x64_bin.tar.gz \
| tar -xz --strip-components=1 -C $HOME/jdk21

- name: Install and run easysearch
shell: bash
run: |
curl -sSL http://get.infini.cloud | bash -s -- -p easysearch -d $HOME/easysearch
ln -sfn $HOME/jdk21 $HOME/easysearch/jdk
# otherwise initialize.sh generates a random admin password
# (must be >=9 chars with upper/lower/digit/special)
export EASYSEARCH_INITIAL_ADMIN_PASSWORD='Admin@12345'
cd $HOME/easysearch && bin/initialize.sh -s
bin/easysearch -d

# wait for the cluster (curl -f: a 401 must not count as "up")
for i in $(seq 1 30); do
if curl -skf -u "admin:$EASYSEARCH_INITIAL_ADMIN_PASSWORD" https://127.0.0.1:9200/_cluster/health >/dev/null 2>&1; then
echo "easysearch is up"; exit 0
fi
sleep 2
done
echo "easysearch did not become ready in time"; exit 1

- name: ORM integration tests
shell: bash
env:
ES_ENDPOINT: https://127.0.0.1:9200
ES_USERNAME: admin
ES_PASSWORD: Admin@12345
run: |
export WORKBASE=$HOME/go/src/infini.sh
export WORK=$WORKBASE/framework

mkdir -p $WORKBASE
ln -sfn $GITHUB_WORKSPACE/framework $WORK

cd $WORK
go version

# config/generated_framework-info.go is gitignored and normally
# generated by the Makefile (same as the Unit Test workflow's `make tidy test`)
make restore-generated-file

echo Running ORM integration suites at $PWD ...
go test -tags integration -count=1 -timeout 20m \
./core/aggregate/... \
./modules/sqlite/... \
./modules/elastic/...
Loading
Loading