-
Notifications
You must be signed in to change notification settings - Fork 8
91 lines (89 loc) · 3.01 KB
/
_prepare.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
---
name: _prepare
on:
workflow_call:
inputs:
builder_ref:
description: Git ref to checkout of build-emacs-for-macos
required: false
type: string
default: ""
outputs:
builder_ref:
description: Git ref of build-emacs-for-macos at builder_ref
value: ${{ jobs.builder-sha.outputs.ref }}
builder_sha:
description: Git commit SHA of build-emacs-for-macos at builder_ref
value: ${{ jobs.builder-sha.outputs.sha }}
jobs:
builder-sha:
runs-on: "macos-13"
outputs:
ref: ${{ steps.ref.outputs.ref }}
sha: ${{ steps.sha.outputs.sha }}
steps:
- name: Default git ref check
id: ref
run: |
DEFAULT_BUILDER_REF="v0.6.57"
BUILDER_REF="${{ inputs.builder_ref }}"
echo "ref=${BUILDER_REF:-$DEFAULT_BUILDER_REF}" >> "$GITHUB_OUTPUT"
- name: Checkout build-emacs-for-macos repo
uses: actions/checkout@v4
with:
repository: jimeh/build-emacs-for-macos
ref: ${{ steps.ref.outputs.ref }}
- name: Store builder Git SHA
id: sha
run: |
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: build-emacs-for-macos-git-sha
path: build-emacs-for-macos-git-sha.txt
if-no-files-found: error
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: ${{ needs.builder-sha.outputs.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-${{ runner.arch }}
path: bin/emacs-builder
if-no-files-found: error