Skip to content

Commit 6e4c003

Browse files
committed
tidy gha
1 parent 144251f commit 6e4c003

10 files changed

Lines changed: 144 additions & 122 deletions

File tree

.github/actions/free-disk-space-windows/action.yaml

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ description: >-
77
jlumbroso/free-disk-space on Linux, which doesn't have a Windows path.
88
Logs disk-free before + after so the reclaimed space is visible.
99
10+
Enabling all makes approximately 10Gb free.
11+
1012
Caller is responsible for the `if: runner.os == 'Windows'` guard --
1113
every step here uses Git Bash with `C:\` mounted at `/c`; running this
1214
on a non-Windows runner will silently no-op (no /c mount) at best.
@@ -40,23 +42,29 @@ inputs:
4042
Strawberry Perl) -- ~1 GB combined.
4143
required: false
4244
default: "true"
45+
keep-image:
46+
description: >-
47+
Docker image (repo:tag) to preserve during the docker prune.
48+
Empty (default) removes every image.
49+
required: false
50+
default: ""
4351

4452
runs:
4553
using: composite
4654
steps:
47-
- name: before
55+
- name: Disk usage before
4856
shell: bash --noprofile --norc -euo pipefail {0}
4957
run: df -h /c
5058

51-
- name: Android SDK
59+
- name: Remove Android SDK
5260
if: inputs.android == 'true'
5361
shell: bash --noprofile --norc -euo pipefail {0}
5462
run: |
5563
for p in "/c/Android" "/c/Program Files (x86)/Android"; do
5664
[ -e "$p" ] && { echo "removing $p"; rm -rf -- "$p"; } || true
5765
done
5866
59-
- name: hostedtoolcache old Pythons
67+
- name: Remove hostedtoolcache old Pythons
6068
if: inputs.hostedtoolcache-old-pythons == 'true'
6169
shell: bash --noprofile --norc -euo pipefail {0}
6270
run: |
@@ -66,7 +74,7 @@ runs:
6674
rm -rf -- "$p"
6775
done
6876
69-
- name: hostedtoolcache old JDKs
77+
- name: Remove hostedtoolcache old JDKs
7078
if: inputs.hostedtoolcache-old-jdks == 'true'
7179
shell: bash --noprofile --norc -euo pipefail {0}
7280
run: |
@@ -76,7 +84,7 @@ runs:
7684
rm -rf -- "$p"
7785
done
7886
79-
- name: old .NET SDKs
87+
- name: Remove old .NET SDKs
8088
if: inputs.old-dotnet-sdks == 'true'
8189
shell: bash --noprofile --norc -euo pipefail {0}
8290
run: |
@@ -86,7 +94,7 @@ runs:
8694
rm -rf -- "$p"
8795
done
8896
89-
- name: misc SDKs
97+
- name: Remove misc SDKs
9098
if: inputs.misc-sdks == 'true'
9199
shell: bash --noprofile --norc -euo pipefail {0}
92100
run: |
@@ -96,6 +104,21 @@ runs:
96104
[ -e "$p" ] && { echo "removing $p"; rm -rf -- "$p"; } || true
97105
done
98106
99-
- name: after
107+
- name: Prune docker images and builder cache
108+
shell: bash --noprofile --norc -euo pipefail {0}
109+
env:
110+
KEEP_IMAGE: ${{ inputs.keep-image }}
111+
run: |
112+
docker images
113+
for img in $(docker images --format '{{.Repository}}:{{.Tag}}'); do
114+
if [ "$img" != "$KEEP_IMAGE" ]; then
115+
docker rmi -f "$img" || true
116+
fi
117+
done
118+
docker container prune -f
119+
docker network prune -f
120+
docker builder prune -af
121+
122+
- name: Disk usage after
100123
shell: bash --noprofile --norc -euo pipefail {0}
101124
run: df -h /c

.github/actions/install-mise-tools/action.yaml

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
---
22
name: Install mise tools
33
description: >-
4-
Install mise (via install-mise), then trust the .mise config, and install
5-
the toolchain named by the workflow's MISE_ENV (with one retry on transient
4+
Runs `install-mise` action, then installs all of the tools in the per-language
5+
toolchains named by the workflow's MISE_ENV (with one retry on transient
66
HTTP flakes). Shared by check.yaml and test.yaml; the caller must run
77
`actions/checkout` before this so .mise/config*.toml exists for `mise trust`.
88
99
inputs:
1010
github-token:
1111
description: >-
12-
GitHub token forwarded as `$GITHUB_TOKEN` to the mise/preinstall steps.
13-
Raises the api.github.com rate-limit ceiling on aqua's attestation
14-
lookups + tool-asset fetches.
12+
GitHub token forwarded as `$GITHUB_TOKEN` to the mise install steps.
1513
required: true
16-
extra-tools:
14+
install-action-tools:
1715
description: >-
1816
Comma-separated tools to co-install via taiki-e/install-action in the
1917
same step as mise. Forwarded to install-mise's `extra-tools` input.
@@ -31,11 +29,7 @@ runs:
3129
- name: Install mise binary
3230
uses: ./.github/actions/install-mise
3331
with:
34-
extra-tools: ${{ inputs.extra-tools }}
35-
36-
- name: Show MISE_ENV
37-
shell: bash --noprofile --norc -euo pipefail {0}
38-
run: echo "MISE_ENV=$MISE_ENV"
32+
install-action: ${{ inputs.install-action-tools }}
3933

4034
# Optional npm backend, installed before the main `mise install`.
4135
# Only useful when js env is loaded (it's the backend for npm:* tools, all
@@ -51,15 +45,23 @@ runs:
5145
run: mise run setup-aube
5246

5347
- name: Install mise tools
48+
id: install-mise-tools
49+
continue-on-error: true
5450
shell: bash --noprofile --norc -euo pipefail {0}
5551
env:
5652
GITHUB_TOKEN: ${{ inputs.github-token }}
5753
run: |
5854
mise run preinstall
59-
# Retry once on transient api.github.com 5xx during the aqua attestation
60-
# / asset fetches: the first attempt re-uses what's already on disk, so
61-
# the retry usually clears single-tool HTTP flakes in seconds.
62-
mise install || { echo "::warning::mise install failed, retrying once"; mise install; }
55+
mise install
56+
57+
- name: Install mise tools (retry)
58+
if: steps.install-mise-tools.outcome == 'failure'
59+
shell: bash --noprofile --norc -euo pipefail {0}
60+
env:
61+
GITHUB_TOKEN: ${{ inputs.github-token }}
62+
run: |
63+
sleep 20
64+
mise install
6365
6466
# Delete mise's auto-generated `mise.cmd` shim on Windows so cmd's PATH
6567
# search falls through to the real `mise.exe` at `~/.cargo/bin/mise.exe`
Lines changed: 17 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,31 @@
11
---
22
name: Install mise
33
description: >-
4-
Install the mise binary (and cargo-binstall as its source-build backend)
5-
via taiki-e/install-action, and on Windows add mise's file-shim dir to
6-
PATH so subsequent steps can resolve mise-managed tools by bare name.
7-
Shared by every workflow that runs `mise` on the runner. For the heavier
8-
"also install everything named by MISE_ENV" flow, use install-mise-tools.
4+
Install the mise binary via taiki-e/install-action, and on Windows add mise's
5+
file-shim dir to PATH so subsequent steps can resolve mise-managed tools by
6+
bare name.
97
108
inputs:
11-
extra-tools:
9+
install-action-tools:
1210
description: >-
13-
Comma-separated tools to co-install via taiki-e/install-action in the
14-
same step as mise (cheaper than a second install-action call). Use the
15-
same syntax as install-action's `tool:` input.
11+
Comma-separated tools to co-install via taiki-e/install-action.
1612
required: false
1713
default: ""
1814

1915
runs:
2016
using: composite
2117
steps:
18+
- name: Verify actions/checkout has run
19+
shell: bash --noprofile --norc -euo pipefail {0}
20+
run: git rev-parse --is-inside-work-tree >/dev/null
21+
2222
- name: Install mise (and any extra tools)
2323
uses: taiki-e/install-action@v2
2424
with:
25-
tool: cargo-binstall,mise@2026.6.5${{ inputs.extra-tools && ',' || '' }}${{ inputs.extra-tools }}
25+
tool: |
26+
cargo-binstall
27+
mise@2026.6.5
28+
${{ inputs.install-action-tools }}
2629
2730
# taiki-e/install-action's mise manifest stages only `mise.exe`; mise's
2831
# per-tool `.cmd` "file" shims under `%LOCALAPPDATA%\mise\shims` aren't
@@ -42,10 +45,10 @@ runs:
4245
# arbitrary-code-execution shape doesn't apply.
4346
run: echo "$LOCALAPPDATA\mise\shims" >> "$GITHUB_PATH" # zizmor: ignore[github-env]
4447

45-
# Marks the checked-out .mise/config*.toml as trusted so subsequent mise
46-
# invocations don't error out with "Config files are not trusted". The
47-
# caller must run actions/checkout BEFORE this composite action so the
48-
# config files are on disk.
4948
- name: Trust mise config
5049
shell: bash --noprofile --norc -euo pipefail {0}
5150
run: mise trust
51+
52+
- name: Show MISE_ENV
53+
shell: bash --noprofile --norc -euo pipefail {0}
54+
run: echo "MISE_ENV=$MISE_ENV"

.github/workflows/dependencies.yaml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,7 @@ jobs:
4747
- name: Install mise + dependency-scan tools
4848
uses: ./.github/actions/install-mise
4949
with:
50-
extra-tools: cargo-deny,cargo-unmaintained,coreutils,osv-scanner,ripgrep
51-
52-
- name: Show MISE_ENV
53-
run: echo "MISE_ENV=$MISE_ENV"
50+
install-action-tools: cargo-deny,cargo-unmaintained,coreutils,osv-scanner,ripgrep
5451

5552
- name: Generate config/osv-scanner.toml from config/deny.toml
5653
run: mise run gen:osv-scanner

.github/workflows/docker-windows.yaml

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,19 @@ jobs:
3030
strategy:
3131
fail-fast: false
3232
matrix:
33-
# `base` controls which Dockerfile is built; `runner` picks the host
34-
# GHA runner. `nanoserver` is the minimal ~120 MB lane; `servercore`
35-
# is the heavier ~1.25 GB lane with a fuller Windows runtime (used
36-
# by Dockerfile.windows). Both run on each Windows runner version
37-
# so we exercise the ltsc2022/ltsc2025 base-image pair against the
38-
# matching runner kernel. Workflow-level MISE_ENV is the standard
39-
# set; Dockerfile.nanoserver pins its own narrower MISE_ENV via an
40-
# ENV that overrides the inherited ARG (Nano can't install python
41-
# or dotnet).
4233
include:
4334
- runner: windows-2022
4435
base: nanoserver
36+
windows_version: ltsc2022
4537
- runner: windows-2025
4638
base: nanoserver
47-
build_arg: "--build-arg WINDOWS_VERSION=ltsc2025"
39+
windows_version: ltsc2025
4840
- runner: windows-2022
4941
base: servercore
42+
windows_version: ltsc2022
5043
- runner: windows-2025
5144
base: servercore
52-
build_arg: "--build-arg WINDOWS_VERSION=ltsc2025"
45+
windows_version: ltsc2025
5346
name: build (${{ matrix.runner }}, ${{ matrix.base }})
5447
timeout-minutes: 120
5548
env:
@@ -65,6 +58,7 @@ jobs:
6558
persist-credentials: false
6659

6760
- name: Show MISE_ENV
61+
if: matrix.base == 'servercore'
6862
run: echo "MISE_ENV=$MISE_ENV"
6963

7064
# Hosted Windows runners don't reliably leave the Docker daemon running, so
@@ -75,40 +69,10 @@ jobs:
7569
sc query docker | grep -q RUNNING || net start docker
7670
docker version
7771
78-
# Reclaim runner C:\ before any docker work. Windows `docker build`
79-
# stages HCS layer scratch under `C:\Windows\SystemTemp`, so every GB
80-
# we free here is a GB that doesn't go to disk-pressure failures
81-
# inside the build. Preinstalled trees we never touch (Android, old
82-
# Python / JDK versions, old .NET SDKs, misc DB SDKs) come out first;
83-
# the docker-prune step below clears any layer-cache leftovers.
8472
- name: Free disk space on Windows runner
8573
uses: ./.github/actions/free-disk-space-windows
86-
87-
# Free runner disk before the build. The Server Core lane has been hitting
88-
# "There is not enough space on the disk" during the conda-clang-tools
89-
# install inside `mise install`. `docker system prune -af` clears any
90-
# unused images/containers from earlier matrix entries on the same
91-
# runner; `docker builder prune -af` clears BuildKit's layer cache.
92-
# Disk-free is logged before + after so we can see how much each prune
93-
# actually reclaims on this runner image -- adjust the cleanup set up or
94-
# down based on the delta.
95-
- name: Free disk space before docker build
96-
env:
97-
PS_DISKFREE: Get-PSDrive C | Select-Object -Property Used,Free | Format-List
98-
run: |
99-
freespace() { powershell.exe -NoProfile -Command "$PS_DISKFREE"; }
100-
echo "::group::disk-free BEFORE prune"
101-
freespace
102-
echo "::endgroup::"
103-
echo "::group::docker system prune -af"
104-
docker system prune -af
105-
echo "::endgroup::"
106-
echo "::group::docker builder prune -af"
107-
docker builder prune -af
108-
echo "::endgroup::"
109-
echo "::group::disk-free AFTER prune"
110-
freespace
111-
echo "::endgroup::"
74+
with:
75+
keep-image: mcr.microsoft.com/windows/${{ matrix.base }}:${{ matrix.windows_version }}
11276

11377
- name: Prepare mise and Github token for the build context
11478
run: |
@@ -139,7 +103,10 @@ jobs:
139103
DOCKERFILE: ${{ steps.dockerfile.outputs.dockerfile }}
140104
IMAGE_TAG: ${{ steps.dockerfile.outputs.tag }}
141105
run: |
142-
args="-f $DOCKERFILE ${{ matrix.build_arg }} --build-arg MISE_ENV"
106+
args="-f $DOCKERFILE --build-arg MISE_ENV"
107+
if [ "${{ matrix.runner }}" != "windows-2022" ]; then
108+
args="$args --build-arg WINDOWS_VERSION=${{ matrix.windows_version }}"
109+
fi
143110
args="$args --target build-minimal -t $IMAGE_TAG"
144111
docker build $args .
145112
@@ -181,7 +148,10 @@ jobs:
181148
target=precompile
182149
tag=""
183150
fi
184-
args="-f $DOCKERFILE ${{ matrix.build_arg }} --build-arg MISE_ENV"
151+
args="-f $DOCKERFILE --build-arg MISE_ENV"
152+
if [ "${{ matrix.runner }}" != "windows-2022" ]; then
153+
args="$args --build-arg WINDOWS_VERSION=${{ matrix.windows_version }}"
154+
fi
185155
args="$args --target $target $tag"
186156
docker build $args .
187157

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
if: runner.os == 'Linux'
108108
run: |
109109
sudo apt-get update
110-
sudo apt-get install -y mesa-vulkan-drivers
110+
sudo apt-get install -y --no-install-recommends mesa-vulkan-drivers
111111
112112
- name: Install mise + tools
113113
uses: ./.github/actions/install-mise-tools

0 commit comments

Comments
 (0)