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

👷🏻‍♂️ Switch to self-hosted M1 Mac mini runner #382

Merged
merged 9 commits into from
Dec 26, 2021

Conversation

phatblat
Copy link
Member

@phatblat phatblat commented May 13, 2021

GitHub Actions only support "X64" architecture right now, so the current solution relies on Rosetta 2. Xcode builds (at least running XCUITests) require arch -arm64 prefixed to the commands, but it seems that Swift build & test do not.

Fixes #380

Scripts in https://github.com/mas-cli/m1-github-actions-runner

↪ ./start.sh

--------------------------------------------------------------------------------
|        ____ _ _   _   _       _          _        _   _                      |
|       / ___(_) |_| | | |_   _| |__      / \   ___| |_(_) ___  _ __  ___      |
|      | |  _| | __| |_| | | | | '_ \    / _ \ / __| __| |/ _ \| '_ \/ __|     |
|      | |_| | | |_|  _  | |_| | |_) |  / ___ \ (__| |_| | (_) | | | \__ \     |
|       \____|_|\__|_| |_|\__,_|_.__/  /_/   \_\___|\__|_|\___/|_| |_|___/     |
|                                                                              |
|                       Self-hosted runner registration                        |
|                                                                              |
--------------------------------------------------------------------------------

# Authentication

What is the URL of your repository? https://github.com/mas-cli/mas
What is your runner register token? *****************************

√ Connected to GitHub

# Runner Registration

Enter the name of runner: [press Enter for m1]

This runner will have the following labels: 'self-hosted', 'macOS', 'X64'
Enter any additional labels (ex. label-1,label-2): [press Enter to skip]

√ Runner successfully added
√ Runner connection is good

# Runner settings

Enter name of work folder: [press Enter for _work]

√ Settings Saved.


√ Connected to GitHub

2021-05-13 05:48:05Z: Listening for Jobs
2021-05-13 06:03:27Z: Running job: Build, Test, and Lint
2021-05-13 06:07:10Z: Job Build, Test, and Lint completed with result: Succeeded

TODO

  • Get runner app working with scripts run outside Rosetta
  • Configure code owners for .github files
  • Clean up experiments
  • Set the runner app to auto-launch on startup
  • Move mini back into DMZ vlan

@phatblat phatblat added the 🧽 chore Administrative task: documentation, build, test, release, git, etc. label May 13, 2021
@phatblat
Copy link
Member Author

phatblat commented May 13, 2021

Got it working tonight but need to configure the runner app to start as a service before this will be ready to merge.

script/test Outdated Show resolved Hide resolved
@chris-araman
Copy link
Contributor

Nice work! It'll be good to be ahead of the game with this.

chris-araman
chris-araman previously approved these changes May 13, 2021
@phatblat
Copy link
Member Author

Getting farther with a shell command wrapper to force scripts to run outside Rosetta.

@phatblat
Copy link
Member Author

The forced architecture for scripts worked to run brew commands in bootstrap but now it's failing on the version script, perhaps because of fetch-depth not being big enough to pick up any tags.

    - uses: actions/checkout@v2
      with:
        # Fetch tags for script/version
        fetch-depth: 0

@phatblat
Copy link
Member Author

I don't think the fetch-depth is a problem. Running the version script manually on the runner in actions-runner/_work/mas/mas works fine and I can see a lot of history in the cloned repo including the v1.8.6 tag from 4 days and 5 commits ago. Must be some other environment difference, perhaps affecting the SCRIPT_PATH variable.

@phatblat
Copy link
Member Author

Not sure why the version script failed that one time as the build is working perfectly now!

I want to do a little more cleanup after my experiments, set the runner app to autolaunch on startup and move the mini back into my DMZ vlan before we merge this PR.

@phatblat
Copy link
Member Author

FYI, m1 is running macOS Monterey 12.1 and Xcode 13.2.1 is the default. Homebrew needs to be run as an admin so I want to add codeowners requiring admin review of any workflow changes as well as not running actions without approval. There's nothing sensitive on this box but still don't want someone to be able to trash it.

@phatblat phatblat changed the title 👷🏻‍♂️ Switch to self-hosted runner 👷🏻‍♂️ Switch to self-hosted M1 Mac mini runner Dec 24, 2021
@phatblat phatblat added this to the Unreleased milestone Dec 25, 2021
@phatblat phatblat marked this pull request as ready for review December 25, 2021 00:33
@chris-araman
Copy link
Contributor

I don't think the fetch-depth is a problem.

A fetch-depth of 0 is supposed to fetch all history for all branches and tags.

chris-araman
chris-araman previously approved these changes Dec 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🧽 chore Administrative task: documentation, build, test, release, git, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

👷🏻 Set up M1 mini as GitHub self-hosted runner
2 participants