-
Notifications
You must be signed in to change notification settings - Fork 15
fix: Fix test workflow and add more platforms #34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces multi-platform testing support in the GitHub Actions workflow by implementing a matrix strategy covering amd64, arm64, arm/v7, and ppc64le architectures. The workflow now derives environment variables from the matrix platform, installs dependencies, configures QEMU for cross-platform emulation, and builds Docker images with platform-specific tags targeting linux/\{matrix.platform\}. Test dispatch logic is updated to use matrix-platform-specific branches instead of architecture detection. Additionally, docker-compose.yml is modified to include an explicit image directive for the tests service, referencing a platform-derived tag (database-dev:\${PLATFORM}). Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes
Pre-merge checks and finishing touches✅ Passed checks (5 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| strategy: | ||
| matrix: | ||
| platform: [amd64, arm64, arm/v7, ppc64le] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added parallel running and more platforms to the workflow
| env: | ||
| PLATFORM: ${{ matrix.platform == 'arm/v7' && 'armv7' || matrix.platform }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting an env for use by docker-compose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should matrix platform just be armv7 so we dont have to add this check for it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The platform param under the build-push-action expects linux/arm/v7 and will not work with armv7.
We could set it as armv7 and add a check there to set it as arm/v7 if that would be preferred
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err ok, this is fine for now
| - name: Install dependencies | ||
| run: composer install --ignore-platform-reqs --no-interaction --prefer-dist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Installing composer dependencies before is necessary because of how the container volumes are mounted by docker-compose
| - name: Set up QEMU | ||
| uses: docker/setup-qemu-action@v3 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setting up Qemu to run other platforms on an amd64 machine
| - name: Build image for ${{ matrix.platform }} | ||
| uses: docker/build-push-action@v3 | ||
| with: | ||
| context: . | ||
| push: false | ||
| tags: database-dev | ||
| tags: database-dev:${{ matrix.platform == 'arm/v7' && 'armv7' || matrix.platform }} | ||
| load: true | ||
| cache-from: type=gha | ||
| cache-to: type=gha,mode=max | ||
| platforms: linux/${{ matrix.platform }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Conditionally spin up instances for specific architectures
| context: . | ||
| push: false | ||
| tags: database-dev | ||
| tags: database-dev:${{ matrix.platform == 'arm/v7' && 'armv7' || matrix.platform }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tags cannot have slashes so added a special check
| tests: | ||
| build: | ||
| context: . | ||
| image: database-dev:${PLATFORM} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Necessary to ensure docker always builds the container with the right architecture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how is PLATFORM set here? should there be a fallback?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
compose fetches PLATFORM from env variables, which are set in the workflow. No matter what strategy is running, an env var will aways be set, so the fallback is intrinsic. The same var is used as the tag while building the containers so the compose step will never fail
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if i run docker compose locally
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You will have to set the env var and build the container with the correct tag. If you would prefer another approach, I can duplicate the compose and make one specifically for CI that is used in the CI and keep the default compose unchanged
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah either works, as long as we dont break local setup without extra steps
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.github/workflows/tests.yml(3 hunks)docker-compose.yml(1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.9)
.github/workflows/tests.yml
32-32: the runner of "docker/setup-buildx-action@v2" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
35-35: the runner of "docker/build-push-action@v3" action is too old to run on GitHub Actions. update the action's version to fix this issue
(action)
🔇 Additional comments (2)
docker-compose.yml (1)
7-7: Verify PLATFORM variable is exported and image exists.The
imagedirective depends on thePLATFORMenvironment variable being available whendocker composeruns. Ensure that the workflow properly exports this variable. Additionally, this directive assumes the Docker image was successfully built and loaded—which has implications for multi-platform testing (see critical issue in the workflow file)..github/workflows/tests.yml (1)
51-60: Test dispatch logic is sound, but depends on above fixes.The conditional checks on
matrix.platform(lines 52–59) correctly replace the broken architecture detection from issue #33. Each platform dispatches to the appropriate PHPUnit test suite. However, this logic will only execute if the Docker image successfully loads and containers start (see critical issue in lines 34–43).Once the multi-platform docker build issue is resolved, verify that the test suites X86, ARM64, ARMV7, and PPC are properly defined in
phpunit.xmland that test execution completes without error.
This PR Fixes #33
Summary by CodeRabbit
✏️ Tip: You can customize this high-level summary in your review settings.