feat(builds): improve build speeds and use free arm64 runners

Improves a few things:

- Use the free macos-14 runners for arm64 builds. They are not as fast
  the macos-13-xlarge runners used before, but they are free for public
  repositories, meaning we can start doing nightly arm64 builds.
- Use different nix install and cache actions which are faster, and uses
  a single action cache key, which avoids cache rate limit errors
  which was slowing down cache create/restore times.
- Generally refactor and tidy up various bits and pieces in workflows.
This commit is contained in:
2024-11-30 18:09:26 +00:00
parent bc0082e4a8
commit d52095babb
7 changed files with 448 additions and 522 deletions

View File

@@ -3,24 +3,20 @@ name: _prepare
on:
workflow_call:
inputs:
os:
description: GitHub Actions runner OS
type: string
required: false
default: "macos-12"
builder_ref:
description: Git ref to checkout of build-emacs-for-macos
required: false
type: string
default: "v0.6.50"
secrets:
TAP_REPO_TOKEN:
description: Personal Access Token for Homebrew Tap repo
required: true
type: string
outputs:
builder_sha:
description: Git SHA of build-emacs-for-macos at builder_ref
value: ${{ jobs.builder-sha.outputs.sha }}
jobs:
emacs-builder:
runs-on: ${{ inputs.os }}
builder-sha:
runs-on: "macos-13"
outputs:
sha: ${{ steps.builder_sha.outputs.sha }}
steps:
- name: Checkout build-emacs-for-macos repo
uses: actions/checkout@v4
@@ -28,22 +24,57 @@ jobs:
repository: jimeh/build-emacs-for-macos
ref: ${{ inputs.builder_ref }}
- name: Store builder Git SHA
id: builder_sha
run: |
git rev-parse HEAD > emacs-builder-git-sha.txt
BUILDER_SHA="$(git rev-parse HEAD)"
echo "$BUILDER_SHA" > build-emacs-for-macos-git-sha.txt
echo "sha=$BUILDER_SHA" >> $GITHUB_OUTPUT
echo "Builder ref ${{ inputs.builder_ref }} resolved to" \
"commit SHA: $BUILDER_SHA"
- name: Upload builder git SHA artifact
uses: actions/upload-artifact@v4
with:
name: emacs-builder-git-sha
path: emacs-builder-git-sha.txt
name: build-emacs-for-macos-git-sha
path: build-emacs-for-macos-git-sha.txt
if-no-files-found: error
- uses: actions/setup-go@v5
emacs-builder:
needs: [builder-sha]
strategy:
matrix:
os:
- macos-13 # Only macos-13 and earlier are x86_64.
- macos-14 # Only macos-14 and later are ARM64.
runs-on: ${{ matrix.os }}
steps:
- name: Cache emacs-builder (${{ runner.arch }})
id: cache
uses: actions/cache@v4
with:
path: bin/emacs-builder
key: emacs-builder-${{ runner.arch }}-${{ needs.builder-sha.outputs.sha }}-bin
- name: Checkout build-emacs-for-macos repo
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/checkout@v4
with:
repository: jimeh/build-emacs-for-macos
ref: ${{ inputs.builder_ref }}
fetch-depth: 0
- name: Setup Go
if: steps.cache.outputs.cache-hit != 'true'
uses: actions/setup-go@v5
with:
go-version: "1.23"
- name: Build emacs-builder tool
if: steps.cache.outputs.cache-hit != 'true'
run: make build
- name: Ensure emacs-builder is executable
if: steps.cache.outputs.cache-hit != 'true'
run: chmod +x bin/emacs-builder
- run: bin/emacs-builder --version
- name: Upload emacs-builder artifact
uses: actions/upload-artifact@v4
with:
name: emacs-builder
name: emacs-builder-${{ runner.arch }}
path: bin/emacs-builder
if-no-files-found: error