diff --git a/.github/workflows/e2e_test.yml b/.github/workflows/e2e_test.yml index 434f7a213..ae22b76ff 100644 --- a/.github/workflows/e2e_test.yml +++ b/.github/workflows/e2e_test.yml @@ -19,7 +19,6 @@ jobs: ruby: [ jruby, ruby-3.2.5 ] neo4j: [ 5.22.0 ] active_model: [ 7.1.3 ] - # jruby will fail till bug https://github.com/jruby/jruby-openssl/issues/290 is fixed include: - ruby: jruby java-version: 17 @@ -48,7 +47,15 @@ jobs: run: while [ $((curl localhost:7474/ > /dev/null 2>&1); echo $?) -ne 0 ]; do sleep 1; done - name: Setup test rails app - run: ./e2e_tests/setup.sh + run: | + if [ "${{ github.event_name }}" == "pull_request" ]; then + # For pull requests, get the SHA of the last commit in the PR + COMMIT_SHA=$(jq -r '.pull_request.head.sha' < "${{ github.event_path }}") + else + # For push events (like master branch), use the commit SHA + COMMIT_SHA="${{ github.sha }}" + fi + ./e2e_tests/setup.sh $COMMIT_SHA - name: Install dependencies run: bundle update diff --git a/e2e_tests/setup.sh b/e2e_tests/setup.sh index f8b3ec97c..7a7556801 100755 --- a/e2e_tests/setup.sh +++ b/e2e_tests/setup.sh @@ -1,13 +1,13 @@ #!/bin/sh +# Example values of environment variables ACTIVE_MODEL_VERSION=7.1.3 ACTIVEGRAPH_PATH=../ E2E_PORT=7687 E2E_NO_CRED=true gem install rails -v $ACTIVE_MODEL_VERSION --no-document if [[ -n "$ACTIVEGRAPH_PATH" ]] then sed 's|.*gem '"'"'activegraph'"'"'.*|gem '"'"'activegraph'"'"', path: "'"$ACTIVEGRAPH_PATH"'"|' docs/activegraph.rb > template.tmp else - echo "SHA=$(git rev-parse "$GITHUB_SHA")" >> $GITHUB_ENV - sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$(git rev-parse "$GITHUB_SHA")"'"/' docs/activegraph.rb > template.tmp + sed 's/.*gem '"'"'activegraph'"'"'.*/gem '"'"'activegraph'"'"', github: "neo4jrb\/activegraph", ref: "'"$1"'"/' docs/activegraph.rb > template.tmp fi rails \_$ACTIVE_MODEL_VERSION\_ new myapp -O -m ./template.tmp @@ -28,18 +28,23 @@ then mv dev_env.tmp config/environments/development.rb fi +echo "Generating model" bundle exec rails generate model User name:string +echo "Generating migration" bundle exec rails generate migration BlahMigration +echo "Running migration" bundle exec rake neo4j:migrate -if echo 'puts "hi"' | bundle exec rails c +if echo 'puts "Starting rails console"' | bundle exec rails c then - echo "rails console works correctly" + echo "Rails console works correctly" else + echo "Rails console didn't start" exit 1 fi -bundle exec rails s -d +echo "Starting rails server" +bundle exec rails s & until $(curl --output /dev/null --silent --head --fail localhost:3000); do printf '.' sleep 1 diff --git a/lib/active_graph/migrations/runner.rb b/lib/active_graph/migrations/runner.rb index a7821db08..0a536f994 100644 --- a/lib/active_graph/migrations/runner.rb +++ b/lib/active_graph/migrations/runner.rb @@ -96,7 +96,7 @@ def handle_incomplete_states! return unless incomplete_states.any? incomplete_versions = incomplete_states.map(&:migration_id) fail MigrationError, <<-MSG -There are migrations struck in an incomplete states, that could not be fixed automatically: +There are migrations stuck in an incomplete states, that could not be fixed automatically: #{incomplete_versions.join('\n')} This can happen when there's a critical error inside a migration.