5

How can I specify the architecture (something like x86 or arm64) in Github Actions?

mingpepe
  • 489
  • 5
  • 10

3 Answers3

6

No you cannot set the architecture for the GitHub hosted runner. These VMs run x64. There is currently no way to specify or request another architecture.

If you need runners on arm64 or x86 you'll need to setup your own host/ VM and install the runner into it along with any other tools your build process needs.

You can use the GitHub/virtual-environments repo to borrow the setup scripts, but you'll need to make the proper adjustments to support the architecture of your choice.

jessehouwing
  • 106,458
  • 22
  • 256
  • 341
  • It looks like there is an [alpha version for supporting arm64](https://blog.travis-ci.com/2019-10-07-multi-cpu-architecture-support) (only on linux os) – David Wer May 29 '22 at 06:08
  • 2
    @DavidWer that link points to TravesCI, not GitHub Actions. I don't see ARM on the roadmap for the coming months. – jessehouwing May 29 '22 at 06:30
0

I believe you can specify architecture as an environment variable.

- name: Set up Python 3.8.5
  uses: actions/setup-python@v3
  with:
    architecture: 'x64'
    python-version: 3.8.5
Tasawer Nawaz
  • 927
  • 8
  • 19
0

As @jessehouwing said, you will need to use self-hosted runners. GitHub hosted runners don't support arm64 yet. You can create the runner yourself by spinning up an arm64 VM and installing actions/runner. You can also use a separate more complete solution that would create those runners on the fly. You have three solid options:

import { aws_codebuild as codebuild } from 'aws-cdk-lib';
import { Architecture, CodeBuildRunnerProvider } from '@cloudsnorkel/cdk-github-runners';

new GitHubRunners(this, 'runners', {
  providers: [
    new CodeBuildRunnerProvider(this, 'CodeBuild ARM64', {
      labels: ['codebuild', 'arm64'],
      computeType: codebuild.ComputeType.SMALL,
      imageBuilder: CodeBuildRunnerProvider.imageBuilder(this, 'Runner Image Builder', {
        architecture: Architecture.ARM64,
      }),
    }),
  ],
});

Your workflows should then use runs-on: [self-hosted, codebuild, arm64].

kichik
  • 33,220
  • 7
  • 94
  • 114