feat: Default to host architecture for containers and enhance ARM CI#2777
Closed
alvidofaisal wants to merge 1 commit intonektos:masterfrom
alvidofaisal:feat/arm-defaults-ci
Closed
feat: Default to host architecture for containers and enhance ARM CI#2777alvidofaisal wants to merge 1 commit intonektos:masterfrom alvidofaisal:feat/arm-defaults-ci
alvidofaisal wants to merge 1 commit intonektos:masterfrom
alvidofaisal:feat/arm-defaults-ci
Conversation
This commit introduces several improvements for ARM/M1 support:
1. **Default Container Architecture to Host:**
`act` now attempts to detect the host's Docker OS/architecture (e.g., `linux/arm64`) and uses this as the default for running containers if the `--container-architecture` flag is not specified. This simplifies usage for you on ARM-based systems like Apple Silicon, allowing `act` to use native ARM images more seamlessly.
2. **Enhanced CI for `linux/arm64`:**
The `test-linux` job within the `checks.yml` CI workflow has been updated to include `linux/arm64` in its test matrix. This ensures that tests are executed natively on both `amd64` and `arm64` for Linux, improving test coverage for ARM platforms.
3. **Updated Documentation:**
The `README.md` has been updated to:
- Explain the new default container architecture behavior.
- Provide clearer guidance for you on ARM/M1 systems.
- Document the `--container-architecture` flag.
4. **Removed Outdated M1 Warning:**
The specific warning message previously displayed to M1 users when no container architecture was specified has been removed from `cmd/root.go`. This warning is now redundant due to the new default behavior and comprehensive documentation.
These changes aim to provide a better out-of-the-box experience for you on ARM architectures and ensure more robust testing for these platforms.
panekj
reviewed
May 22, 2025
Comment on lines
+24
to
+49
| ## Running on Different Architectures (e.g., Apple Silicon/ARM) | ||
|
|
||
| `act` is designed to work with Docker to run your GitHub Actions. This means it can run actions compiled for different CPU architectures. | ||
|
|
||
| * **Automatic Host Architecture Detection (New Default):** | ||
| By default, `act` now attempts to detect your host system's architecture (e.g., `linux/arm64` on an Apple Silicon M1/M2 Mac, or `linux/amd64` on a typical x86-64 Linux/Windows machine). It will then try to use this as the default architecture for the Docker containers it runs. This means for many users, especially on Apple Silicon, `act` should work out-of-the-box using native ARM containers if your workflows support them. | ||
|
|
||
| * **Specifying Container Architecture (`--container-architecture`):** | ||
| If you need to run containers for a specific architecture different from your host's default (e.g., running an `x86_64` container on an M1 Mac via Rosetta 2), you can use the `--container-architecture` flag: | ||
| ```bash | ||
| act --container-architecture linux/amd64 | ||
| ``` | ||
| Common values include `linux/amd64` and `linux/arm64`. | ||
|
|
||
| * **Persistent Configuration (`.actrc`):** | ||
| If you consistently need to set a specific architecture or other flags, you can add them to a `.actrc` file in your repository or home directory. For example, to always default to `linux/amd64`: | ||
| ``` | ||
| --container-architecture linux/amd64 | ||
| ``` | ||
| (Refer to the [full act user guide](https://nektosact.com/usage/index.html#configuration-file) for more on `.actrc` files.) | ||
|
|
||
| * **Guidance for Apple Silicon (M1/M2) Users:** | ||
| With the new default behavior, the explicit terminal warning you might have seen previously about specifying `--container-architecture` is less critical. `act` will attempt to use `linux/arm64` by default. If you have workflows that require x86_64 images, you can use `--container-architecture linux/amd64`. | ||
|
|
||
| For more detailed information on configuration and flags, please consult the [full act user guide](https://nektosact.com). | ||
|
|
Contributor
There was a problem hiding this comment.
this should be in docs, not README
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit introduces several improvements for ARM/M1 support:
Default Container Architecture to Host:
actnow attempts to detect the host's Docker OS/architecture (e.g.,linux/arm64) and uses this as the default for running containers if the--container-architectureflag is not specified. This simplifies usage for you on ARM-based systems like Apple Silicon, allowingactto use native ARM images more seamlessly.Enhanced CI for
linux/arm64: Thetest-linuxjob within thechecks.ymlCI workflow has been updated to includelinux/arm64in its test matrix. This ensures that tests are executed natively on bothamd64andarm64for Linux, improving test coverage for ARM platforms.Updated Documentation: The
README.mdhas been updated to:--container-architectureflag.Removed Outdated M1 Warning: The specific warning message previously displayed to M1 users when no container architecture was specified has been removed from
cmd/root.go. This warning is now redundant due to the new default behavior and comprehensive documentation.These changes aim to provide a better experience on ARM architectures and ensure more robust testing for these platforms.