use custom action

This commit is contained in:
Osman Faruk Bayram 2025-09-15 17:03:56 +03:00
parent c813cb28ad
commit 05af1a15f1
2 changed files with 72 additions and 3 deletions

67
.github/actions/setup-nix/action.yml vendored Normal file
View file

@ -0,0 +1,67 @@
name: setup-nix
inputs:
system:
type: string
required: true
sandbox:
type: string
default: "true"
runs:
using: composite
steps:
- name: reclaim space (linux)
if: runner.os == 'Linux'
uses: wimpysworld/nothing-but-nix@main
with:
hatchet-protocol: rampage
- name: reclaim space (darwin)
if: runner.os == 'macOS'
shell: bash
run: |
echo "::group::disk space (before)"
sudo df -h
echo "::endgroup::"
echo "::group::disable mds"
sudo mdutil -i off -a || echo "mdutil failed"
sudo launchctl unload -w /System/Library/LaunchDaemons/com.apple.metadata.mds.plist \
|| echo "launchctl unload failed"
echo "::endgroup::"
echo "Background space expansion started. /nix will grow as space becomes available."
sudo rm -rf \
/Applications/Xcode_* \
/Library/Developer/CoreSimulator \
/Library/Frameworks \
/Users/runner/.dotnet \
/Users/runner/.rustup \
/Users/runner/Library/Android \
/Users/runner/Library/Caches \
/Users/runner/Library/Developer/CoreSimulator \
/Users/runner/hostedtoolcache &
- name: install nix
uses: cachix/install-nix-action@v31
with:
# Putting build-dir in /nix is a workaround for https://github.com/wimpysworld/nothing-but-nix/issues/18
extra_nix_config: |
build-dir = /nix/build
sandbox = ${{ inputs.sandbox }}
system = ${{ inputs.system }}
- name: create build-dir
shell: bash
run: sudo mkdir -p /nix/build
- name: post setup-nix
if: runner.os == 'macOS'
uses: srz-zumix/post-run-action@v2
with:
shell: bash -e {0}
post-run: |
echo "::group::disk space (after)"
sudo df -h
echo "::endgroup::"

View file

@ -24,9 +24,11 @@ jobs:
- name: Checkout the repository
uses: actions/checkout@v2
- name: Install nix
uses: cachix/install-nix-action@v27
- name: setup nix
uses: ./.github/actions/setup-nix
with:
system: ${{ matrix.system }}
- name: Login to tailscale
uses: tailscale/github-action@v3.2.3
with: