Skip to content

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#2777
alvidofaisal wants to merge 1 commit intonektos:masterfrom
alvidofaisal:feat/arm-defaults-ci

Conversation

@alvidofaisal
Copy link
Copy Markdown

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 experience on ARM architectures and ensure more robust testing for these platforms.

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.
Comment thread README.md
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).

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.

this should be in docs, not README

@alvidofaisal alvidofaisal deleted the feat/arm-defaults-ci branch May 23, 2025 05:38
@alvidofaisal alvidofaisal restored the feat/arm-defaults-ci branch May 23, 2025 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants