Skip to content

Commit 1d591f6

Browse files
authored
Merge pull request #31 from divnix/mac-fixes
fix: use recent enough bash on Mac runners
2 parents 5603f18 + c5773af commit 1d591f6

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

discover/action.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ runs:
4848
env:
4949
TMPDIR: ${{ runner.temp }}
5050
FLAKE: "github:${{ github.repository }}/${{ github.sha }}"
51+
OS: ${{ runner.os }}
52+
SCRIPT: ${{ github.action_path }}/eval.sh
5153
run: |
52-
${{ github.action_path }}/eval.sh
54+
if [[ $OS == macOS ]]; then
55+
nix run nixpkgs/nixpkgs-22.11-darwin#bash -- "$SCRIPT"
56+
else
57+
"$SCRIPT"
58+
fi
5359
shell: bash

run/action.yaml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ runs:
7676

7777
- name: Restore Cache & Discovery Results
7878
id: restore-cache
79-
if: inputs.discovery_ssh == 'none'
79+
if: inputs.discovery_ssh == 'none' && runner.os != 'macOS'
8080
uses: divnix/[email protected]
8181
with:
8282
path: |
@@ -96,6 +96,17 @@ runs:
9696
secret-key-files = ${{ env.NIX_KEY_PATH }}
9797
${{ inputs.extra_nix_config }}
9898
99+
- name: Restore Cache & Discovery Results
100+
id: restore-cache-mac
101+
if: inputs.discovery_ssh == 'none' && runner.os == 'macOS'
102+
uses: divnix/[email protected]
103+
with:
104+
path: |
105+
/nix
106+
~/.cache/nix
107+
~root/.cache/nix
108+
key: discovery-${{ runner.os }}-${{ runner.arch }}-${{ github.ref }}-${{ github.sha }}
109+
99110
- name: Pull Derivations from Discovery Runner
100111
if: inputs.discovery_ssh != 'none'
101112
env:
@@ -117,8 +128,14 @@ runs:
117128
BUILDER: ${{ inputs.builder }}
118129
SSH_AUTH_SOCK: ${{ runner.temp }}/ssh_agent.sock
119130
JSON: ${{ inputs.json }}
131+
OS: ${{ runner.os }}
132+
SCRIPT: ${{ github.action_path }}/build.sh
120133
run: |
121-
${{ github.action_path }}/build.sh
134+
if [[ $OS == macOS ]]; then
135+
nix run nixpkgs/nixpkgs-22.11-darwin#bash -- "$SCRIPT"
136+
else
137+
"$SCRIPT"
138+
fi
122139
shell: bash
123140

124141
- name: ${{ fromJSON(inputs.json).action }} ${{ fromJSON(inputs.json).name }}
@@ -130,8 +147,14 @@ runs:
130147
JSON: ${{ inputs.json }}
131148
PRJ_ROOT: ${{ github.workspace }}
132149
PRJ_DATA_DIR: ${{ github.workspace }}/.std
150+
OS: ${{ runner.os }}
151+
SCRIPT: ${{ github.action_path }}/run.sh
133152
run: |
134-
${{ github.action_path }}/run.sh
153+
if [[ $OS == macOS ]]; then
154+
nix run nixpkgs/nixpkgs-22.11-darwin#bash -- "$SCRIPT"
155+
else
156+
"$SCRIPT"
157+
fi
135158
shell: bash
136159

137160
- name: Populate Cache
@@ -140,7 +163,13 @@ runs:
140163
BUILDER: ${{ inputs.builder }}
141164
UNCACHED: ${{ steps.build.outputs.uncached }}
142165
SSH_AUTH_SOCK: ${{ runner.temp }}/ssh_agent.sock
166+
OS: ${{ runner.os }}
167+
SCRIPT: ${{ github.action_path }}/cache.sh
143168
if: always() && env.CACHE != 'auto' && env.UNCACHED != '' && steps.build.conclusion == 'success'
144169
run: |
145-
${{ github.action_path }}/cache.sh
170+
if [[ $OS == macOS ]]; then
171+
nix run nixpkgs/nixpkgs-22.11-darwin#bash -- "$SCRIPT"
172+
else
173+
"$SCRIPT"
174+
fi
146175
shell: bash

0 commit comments

Comments
 (0)