|
| 1 | +name: "Setup ImDisk" |
| 2 | +if: runner.os == 'Windows' |
| 3 | +description: | |
| 4 | + Sets up the ImDisk toolkit for Windows and backs often-used paths with RAM disks |
| 5 | +runs: |
| 6 | + using: "composite" |
| 7 | + steps: |
| 8 | + - name: Download ImDisk |
| 9 | + if: runner.os == 'Windows' |
| 10 | + shell: bash |
| 11 | + run: | |
| 12 | + mkdir imdisk |
| 13 | + cd imdisk |
| 14 | + curl -L -o files.cab https://github.com/coder/imdisk-artifacts/raw/92a17839ebc0ee3e69be019f66b3e9b5d2de4482/files.cab |
| 15 | + curl -L -o install.bat https://github.com/coder/imdisk-artifacts/raw/92a17839ebc0ee3e69be019f66b3e9b5d2de4482/install.bat |
| 16 | + cd .. |
| 17 | +
|
| 18 | + - name: Install ImDisk |
| 19 | + shell: cmd |
| 20 | + run: | |
| 21 | + cd imdisk |
| 22 | + install.bat /silent |
| 23 | +
|
| 24 | + - name: Create RAM Disks |
| 25 | + shell: bash |
| 26 | + run: | |
| 27 | + # RAM disk for postgres mounted on R: |
| 28 | + imdisk -a -s 4096M -m R: -p "/fs:ntfs /q /y" |
| 29 | +
|
| 30 | + # RAM disk for temp files. It's used by actions/cache, actions/setup-go, etc. |
| 31 | + # We need to persist the existing contents because some actions rely on it. |
| 32 | + mkdir "$RUNNER_TEMP"_tmp |
| 33 | + cp -r "$RUNNER_TEMP"/. "$RUNNER_TEMP"_tmp |
| 34 | + rm -rf "$RUNNER_TEMP"/* |
| 35 | + imdisk -a -s 8192M -m "$RUNNER_TEMP" -p "/fs:ntfs /q /y" |
| 36 | + cp -r "$RUNNER_TEMP"_tmp/. "$RUNNER_TEMP" |
| 37 | + rm -rf "$RUNNER_TEMP"_tmp |
| 38 | +
|
| 39 | + # RAM disk for go cache and mod cache |
| 40 | + # cd to another directory to ensure we're not inside a go project. |
| 41 | + # That'd trigger go to download the toolchain for that project. |
| 42 | + cd "$RUNNER_TEMP" |
| 43 | + export GOCACHE="$(go env GOCACHE)" |
| 44 | + export GOMODCACHE="$(go env GOMODCACHE)" |
| 45 | + rm -rf "$GOCACHE" |
| 46 | + rm -rf "$GOMODCACHE" |
| 47 | + mkdir -p "$GOCACHE" |
| 48 | + mkdir -p "$GOMODCACHE" |
| 49 | + imdisk -a -s 8192M -m "$GOCACHE" -p "/fs:ntfs /q /y" |
| 50 | + imdisk -a -s 8192M -m "$GOMODCACHE" -p "/fs:ntfs /q /y" |
| 51 | +
|
| 52 | + # RAM disk for the repository |
| 53 | + rm -rf "$GITHUB_WORKSPACE"/* |
| 54 | + # Use exfat instead of ntfs because ntfs creates an unremovable |
| 55 | + # "System Volume Information" directory that makes actions/checkout fail. |
| 56 | + # exfat is empty on creation |
| 57 | + imdisk -a -s 2048M -m "$GITHUB_WORKSPACE" -p "/fs:exfat /q /y" |
| 58 | + # node's fs.promises.readdir used by actions/checkout fails if the |
| 59 | + # directory is empty. |
| 60 | + touch "$GITHUB_WORKSPACE"/dummy.txt |
0 commit comments