Skip to content

Dispatch integration tests when deploying to heroku test env - #971

Merged
zetter-rpf merged 2 commits into
mainfrom
test-dispatch
Aug 19, 2026
Merged

Dispatch integration tests when deploying to heroku test env#971
zetter-rpf merged 2 commits into
mainfrom
test-dispatch

Conversation

@zetter-rpf

@zetter-rpf zetter-rpf commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Status

What's changed?

Trigger the learner experience tests while app is deploying to the test environment.

See commit for more

Testing

I have tested this locally by setting the relevant environment variables, can see the test here:

https://github.com/RaspberryPiFoundation/learner-experience-integration-tests/actions/runs/32142867344/job/95729480208

Steps to perform before deploying to production

Set new LEARNER_EXPERIENCE_TESTS_DISPATCH_TOKEN env var in editor API - https://github.com/RaspberryPiFoundation/terraform/pull/1458

@cla-bot cla-bot Bot added the cla-signed label Aug 18, 2026
@zetter-rpf
zetter-rpf marked this pull request as ready for review August 18, 2026 13:44
Copilot AI lite review requested due to automatic review settings August 18, 2026 13:44
@zetter-rpf zetter-rpf changed the title Add integration_tests:dispatch rake task Dispatch integration tests when deployed to heroku Aug 18, 2026
@github-actions

github-actions Bot commented Aug 18, 2026

Copy link
Copy Markdown

Test coverage

93.34% line coverage reported by SimpleCov.
Run: https://github.com/RaspberryPiFoundation/editor-api/actions/runs/32146672931

@zetter-rpf zetter-rpf changed the title Dispatch integration tests when deployed to heroku Dispatch integration tests when deploying to heroku test env Aug 18, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new integration_tests:dispatch rake task to trigger the external “learner experience” integration test workflow during Heroku’s release phase, so tests can run against the freshly deployed test environment.

Changes:

  • Introduces integration_tests:dispatch rake task that calls GitHub’s repository dispatch API with deploy metadata.
  • Wires the task into the Heroku release process via Procfile.
  • Adds RSpec coverage for dispatch/skipping/error-reporting behavior and documents the new env var in .env.example.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
lib/tasks/integration_tests.rake New rake task that conditionally dispatches the external GitHub Actions workflow and reports failures to Sentry.
Procfile Runs integration_tests:dispatch during Heroku release (after migrations and existing seed task).
spec/lib/tasks/integration_tests_spec.rb Adds task specs covering dispatch payload/header, skip behavior, and error reporting.
.env.example Documents LEARNER_EXPERIENCE_TESTS_DISPATCH_TOKEN for local/dev configuration.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread lib/tasks/integration_tests.rake
Comment thread lib/tasks/integration_tests.rake
Comment thread spec/lib/tasks/integration_tests_spec.rb Outdated
Comment thread spec/lib/tasks/integration_tests_spec.rb
@zetter-rpf
zetter-rpf marked this pull request as draft August 18, 2026 13:51
Triggers the learner-experience-integration-tests GitHub Actions
workflow via repository_dispatch after a deploy to the editor-api-test
Heroku app, so end-to-end tests run automatically against the test
environment. Errors are reported to Sentry rather than failing the
deploy step.

Using the release step isn't perfect as the app won't have switched over until after it completes, but since this is the last release step and the integration tests take a while to start I think this is safe.

It's not easy to get the git commit message in heroku so I'm linking to the commit on github instead

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
In CI the app is fully loaded already including tasks. This might cause the tasks to be loaded (and run) twice.

This line still needs to be here for running tests locally.
@raspberrypiherokubot
raspberrypiherokubot temporarily deployed to editor-api-p-test-dispa-byf3aq August 18, 2026 14:19 Inactive
@zetter-rpf
zetter-rpf marked this pull request as ready for review August 18, 2026 14:21

@mwtrew mwtrew left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice

@zetter-rpf
zetter-rpf merged commit c5a1a7a into main Aug 19, 2026
8 checks passed
@zetter-rpf
zetter-rpf deleted the test-dispatch branch August 19, 2026 07:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants