Skip to content
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

ci(test): Add 32-bit & ARM CI tests #2126

Merged
merged 1 commit into from
Jun 23, 2024
Merged

ci(test): Add 32-bit & ARM CI tests #2126

merged 1 commit into from
Jun 23, 2024

Conversation

hairyhenderson
Copy link
Owner

@hairyhenderson hairyhenderson commented Jun 22, 2024

#2121 only popped up because the Alpine build runs tests on all platforms. I should at least run tests on 32-bit platforms in CI to make sure I don't hit errors like this again.

Also adding emulated tests (with QEMU) for ARM64 and ARMv7. They take a bit longer (because of the crypto differences), but it'll probably be worth it.

Summary by CodeRabbit

  • New Features

    • Introduced a new build setup for 32-bit Linux platforms.
    • Added a dedicated Dockerfile (Dockerfile.test32bit) for 32-bit build environments.
  • Refactor

    • Updated the existing Dockerfile to use a multi-stage build process and set environment variables for cross-platform compatibility.
    • Enhanced testing commands in the Makefile with race detection for supported platforms.
  • Chores

    • Simplified the linting workflow by removing unnecessary arguments for a cleaner configuration.

@hairyhenderson hairyhenderson self-assigned this Jun 22, 2024
Copy link

coderabbitai bot commented Jun 22, 2024

Note

Reviews paused

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Walkthrough

The project introduces a new 32-bit testing workflow and modifies existing GitHub Actions and Docker configurations. Key changes include adding a new job to the build workflow for running tests on different platforms, simplifying the linting process, and upgrading the Docker setup for multi-platform builds. Additionally, the Makefile now includes race condition testing for supported platforms, enhancing robustness.

Changes

Files/Paths Change Summaries
.github/workflows/build.yml Added linux-32bit-build job with QEMU setup and platform matrix strategy.
.github/workflows/lint.yml Removed verbose arguments from a specific job to simplify lint configuration.
Dockerfile Switched base image directive and introduced a new build stage with environment variable settings.
Dockerfile.test32bit New 32-bit build environment Dockerfile for Go projects.
Makefile Added race detector flag -race for supported platforms in the test target.

Poem

In the realm of scripts and bytes,
A 32-bit build takes flight,
Docker stages join the quest,
Ensuring code is at its best.
With race detectors tested and true,
Our code will shine anew! 🌟


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
Dockerfile (1)

Line range hint 2-26: Optimize Dockerfile configuration and address static analysis warnings.

The multi-stage build setup is well-structured and enhances the maintainability of the Dockerfile. However, there are a few improvements and fixes needed:

  1. Pinning Versions in apk add - It's recommended to pin versions of packages to ensure reproducibility and avoid unexpected updates. Modify the apk add command to include specific versions of the packages.
  2. Avoid Platform Flags in Base Images - The use of --platform flag with FROM is flagged by Hadolint (DL3029). It's advisable to ensure that the platform is appropriately handled without explicitly setting it in the base image to avoid potential build issues on different architectures.
  3. Tag Versions Explicitly in Images - Always specify explicit versions for base images to avoid pulling unintended updates that could break the build.
- RUN apk add --no-cache make git
+ RUN apk add --no-cache make=4.3-r0 git=2.32.0-r0

- FROM --platform=windows/amd64 mcr.microsoft.com/windows/nanoserver:ltsc2022 AS gomplate-windows
+ FROM mcr.microsoft.com/windows/nanoserver:ltsc2022 AS gomplate-windows
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between e3b86e8 and fe46046.

Files selected for processing (3)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • Dockerfile (2 hunks)
Files skipped from review due to trivial changes (1)
  • .github/workflows/lint.yml
Additional context used
Hadolint
Dockerfile

[warning] 9-9: Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version> (DL3018)


[warning] 63-63: Do not use --platform flag with FROM (DL3029)


[warning] 69-69: Always tag the version of an image explicitly (DL3006)

Additional comments not posted (1)
.github/workflows/build.yml (1)

30-44: Review of the new linux-32bit-build job configuration.

The job setup looks appropriate for testing on 32-bit platforms using QEMU. The use of matrix strategy to test across multiple platforms (linux/386, linux/armhf) is a good practice to ensure broader compatibility.

However, ensure that the Docker image test32bit used in the testing step is correctly configured to handle the 32-bit architecture, as issues can arise when running 32-bit applications on 64-bit architectures without proper setup.

@hairyhenderson hairyhenderson force-pushed the test-32bit-linux branch 2 times, most recently from e59ad1d to 71f431e Compare June 22, 2024 20:32
@hairyhenderson
Copy link
Owner Author

@coderabbitai ignore

Copy link

@coderabbitai coderabbitai bot left a 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

Commits

Files that changed from the base of the PR and between fe46046 and 71f431e.

Files selected for processing (4)
  • .github/workflows/build.yml (1 hunks)
  • .github/workflows/lint.yml (1 hunks)
  • Dockerfile.test32bit (1 hunks)
  • Makefile (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/build.yml
  • .github/workflows/lint.yml
Additional context used
Hadolint
Dockerfile.test32bit

[warning] 8-8: Pin versions in apk add. Instead of apk add <package> use apk add <package>=<version> (DL3018)

Additional comments not posted (3)
Dockerfile.test32bit (2)

6-6: Environment variables set correctly.

The environment variables GOOS, GOARCH, and potentially GOARM are set correctly based on the build arguments, which is essential for cross-compilation.


10-16: Proper project setup in Docker.

The working directory is set correctly, and project files are properly copied to the Docker image. This setup is crucial for subsequent operations like dependency management and builds.

Makefile (1)

150-158: Enhanced testing with race condition detection.

The addition of race condition detection for supported platforms is a significant improvement. It helps in identifying potential concurrency issues in the code.

Copy link

coderabbitai bot commented Jun 22, 2024

@coderabbitai ignore

Actions performed

Reviews paused.

@hairyhenderson

This comment was marked as resolved.

@hairyhenderson hairyhenderson force-pushed the test-32bit-linux branch 14 times, most recently from beb364f to b360e90 Compare June 23, 2024 18:44
@hairyhenderson hairyhenderson force-pushed the test-32bit-linux branch 4 times, most recently from 8e97c23 to d049f01 Compare June 23, 2024 23:06
@hairyhenderson hairyhenderson force-pushed the test-32bit-linux branch 3 times, most recently from 88813e6 to 0b35c00 Compare June 23, 2024 23:41
Signed-off-by: Dave Henderson <[email protected]>
@hairyhenderson hairyhenderson changed the title ci(test): Add 32-bit CI tests ci(test): Add 32-bit & ARM CI tests Jun 23, 2024
@hairyhenderson hairyhenderson merged commit 36bafcf into main Jun 23, 2024
18 checks passed
@hairyhenderson hairyhenderson deleted the test-32bit-linux branch June 23, 2024 23:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant