Skip to content

Commit

Permalink
Use the new method for running super scaffolding tests in the starter…
Browse files Browse the repository at this point in the history
… repo (#994)

* Use the new method for running super scaffolding tests in the starter repo

* need to use the starter repo for this

* clean up
  • Loading branch information
jagthedrummer authored Dec 20, 2024
1 parent 613f21a commit b53cf98
Showing 1 changed file with 29 additions and 22 deletions.
51 changes: 29 additions & 22 deletions .github/workflows/_run_super_scaffolding_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,24 +7,41 @@ on:
workflow_dispatch:

jobs:
# NOTE: This is here just to make the workflow visualization layout better.
# Without it the layout is really bad and confusing.
calculate_matrix:
name: 🤷 Fake Matrix
name: 🏗️ Generate Test List
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.generate-test-list.outputs.result }}
steps:
- name: Do Nothing
run: echo "This is a useless step that just helps things look nicer..."
shell: bash
- name: Checkout Starter Repo
uses: bullet-train-co/checkout-repo-with-matching-branch@v1
with:
#target_dir: tmp/starter
repository: bullet-train-co/bullet_train

- uses: actions/github-script@v7
id: generate-test-list
name: Generate Test List
with:
script: |
const globber = await glob.create('test/system/super_scaffolding/**/setup.rb')
const tests = []
for await (const file of globber.globGenerator()) {
console.log(file)
var fileParts = file.split("/")
var test_dir_name = fileParts[fileParts.length - 2];
console.log("test_dir_name =", test_dir_name)
tests.push(test_dir_name)
}
return tests
test:
name: "🏗️"
runs-on: ubuntu-latest
needs: calculate_matrix
strategy:
fail-fast: false
matrix:
# For super scaffolding tests we need to have exactly 5 runners.
ci_runners: ["TestSite, Project", "Project::Step, Insight", "Personality::Disposition, Personality::Observation", "TestFile, PartialTest", Webhook]
test: ${{ fromJson(needs.calculate_matrix.outputs.tests) }}
services:
postgres:
image: postgres:11-alpine
Expand Down Expand Up @@ -89,28 +106,18 @@ jobs:
application_dir: tmp/starter
core_dir: tmp/starter/local/bullet_train-core

# TODO: This might be a bad idea. Maybe we should just have spring in the Gemfile all the time.
- name: Allow adding of spring
run: bundle config unset deployment
working-directory: tmp/starter

- name: Add spring
run: bundle add spring
working-directory: tmp/starter

- name: 'Setup Super Scaffolding System Test'
run: bundle exec test/bin/setup-super-scaffolding-system-test
run: bundle exec test/system/super_scaffolding/${{ matrix.test }}/setup.rb --allow-dirty-workspace
working-directory: tmp/starter
env:
CIRCLE_NODE_INDEX: ${{ strategy.job-index }}

- name: 'Run Super Scaffolding Test'
run: bin/rails test test/system/super_scaffolding/
run: bin/rails test test/system/super_scaffolding/${{ matrix.test }}/ test/system/super_scaffolding/open_api_test.rb
working-directory: tmp/starter

- name: 'Run Super Scaffolding Webhook Test'
run: bin/rails test test/controllers/webhooks/incoming/some_provider_webhooks_controller_test.rb
if: ${{ strategy.job-index == 5 }}
if: ${{ matrix.test == 'webhook' }}
working-directory: tmp/starter

- name: Upload Test Summary Logs
uses: actions/upload-artifact@v4
Expand Down

0 comments on commit b53cf98

Please sign in to comment.