Skip to content

Commit 499b62b

Browse files
authored
feat: expose native-dev-drive as an option (#10)
1 parent 3c68011 commit 499b62b

12 files changed

Lines changed: 141 additions & 88 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ jobs:
6464
mount-path: ""
6565
mount-if-exists: false
6666
workspace-copy: true
67+
native-dev-drive: false
6768

6869
test-formats:
6970
strategy:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# 3.1.0
2+
3+
* Expose `native-dev-drive` as an option to turn off automatic native Dev Drive usage.
4+
* Documentation improvements.
5+
* Align package.json version.
6+
17
# 3.0.0
28

39
* Allow mounting dev drive in specified mount path (ReFS, NTFS only).

README.md

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,22 @@ You can optionally pass parameters to the action as follows:
3939
```yaml
4040
- uses: samypr100/setup-dev-drive@v3
4141
with:
42+
# Drive size in bytes (or as a PowerShell numeric literal). Defaults to 1GB.
4243
drive-size: 1GB
44+
# Drive file system (ReFS, NTFS, etc.). Defaults to ReFS.
4345
drive-format: ReFS
46+
# Drive allocation (Dynamic or Fixed). Defaults to Dynamic.
4447
drive-type: Dynamic
48+
# Path to VHDX file. Defaults to `/dev_drive.vhdx`
4549
drive-path: "dev_drive.vhdx"
50+
# Path to mount the drive. Defaults to creating a new arbitrary drive letter such as "E:".
4651
mount-path: "my_mount_path"
52+
# Mounts (rather than create) an existing VHDX in drive-path. Defaults to false.
4753
mount-if-exists: false
54+
# Copies ${{ github.workspace }} to your dev drive. Defaults to false.
4855
workspace-copy: false
56+
# Use native dev drive support when available. Defaults to true.
57+
native-dev-drive: true
4958
```
5059
5160
This action is [compatible](#runner-compatibility) with `windows-2022` runners or above.
@@ -56,19 +65,25 @@ For more examples, take a look in the dedicated [examples section](#examples).
5665

5766
### *drive-size*
5867

59-
Allows you to configure the dev drive size. This is subject to the limit of space
68+
By default, this option is set to `1GB`.
69+
70+
Allows you to configure the dev drive size in bytes. This is subject to the limit of space
6071
available on your runner. The default public runners roughly hold about 15GB of
6172
[space](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners/about-github-hosted-runners#standard-github-hosted-runners-for-public-repositories),
6273
so it's suggested you keep your drive size below that limit, or you may encounter errors.
6374

75+
You can use PowerShell built in [Numeric Literals](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_numeric_literals)
76+
functionality to automatically expand expressions like `1GB` to mean `1073741824`.
77+
6478
### *drive-format*
6579

66-
The format of the drive, by default `ReFS` but it can be any of `FAT, FAT32, exFAT, NTFS, ReFS`
80+
The format of the drive, by default `ReFS` but it can be any of `FAT`, `FAT32`, `exFAT`, `NTFS`, `ReFS`
6781
as provided by [Format-Volume](https://learn.microsoft.com/en-us/powershell/module/storage/format-volume).
6882

6983
### *drive-path*
7084

71-
The path to the dev drive VHDX file, defaults to the relative path `dev_drive.vhdx`.
85+
The path to the dev drive VHDX file, defaults to the relative path `dev_drive.vhdx` under the
86+
current system root.
7287

7388
When a relative path is provided, it will be relative to `C:\`, `D:\` or the default
7489
workspace drive letter on the runner. Hence, `dev_drive.vhdx` will likely resolve to
@@ -80,6 +95,8 @@ in such scenarios.
8095

8196
### *drive-type*
8297

98+
By default, this option is set to `Dynamic`.
99+
83100
Determines the type of drive, `Fixed` or `Dynamic`. There are performance tradeoffs between
84101
both. For the purposes of this action `Dynamic` is used by default for flexibility.
85102

@@ -90,7 +107,7 @@ payload to cache when the job ends.
90107

91108
### *mount-path*
92109

93-
By default, this option is not set.
110+
By default, this option is not set and defaults to a new arbitrary drive letter such as `E:`.
94111

95112
Mounts the dev drive at the specified `mount-path` location. This option can be
96113
useful when you want to mount your dev drive inside the GitHub workspace via
@@ -112,12 +129,16 @@ your mount path is outside `${{ github.workspace }}`.
112129

113130
### *mount-if-exists*
114131

132+
By default, this option is set to `false`.
133+
115134
Mounts the dev drive if it already exists at `drive-path` location. When it does not exist,
116135
it will fall back to creating one at that location instead. This is useful when your workflow
117136
caches the dev drive for further use in other jobs via `actions/cache`.
118137

119138
### *workspace-copy*
120139

140+
By default, this option is set to `false`.
141+
121142
This copies `${{ github.workspace }}` to your dev drive. Usually when you use `actions/checkout`
122143
it creates a shallow copy of your commit to `${{ github.workspace }}`. When `workspace-copy`
123144
is set to `true`, this action will copy your workspace into your dev drive allowing you move
@@ -129,6 +150,14 @@ See [actions/checkout#197](https://github.com/actions/checkout/issues/197).
129150
This option is compatible with `mount-path` as long as the mount path is not directly located inside your
130151
GitHub workspace (e.g. `${{ github.workspace }}/../my_mount_path`).
131152

153+
### *native-dev-drive*
154+
155+
By default, this option is set to `true`.
156+
157+
This action will automatically use the built-in [Windows Dev Drive](https://learn.microsoft.com/en-us/windows/dev-drive/)
158+
on your behalf when it's available on your Windows runner and `ReFS` is used.
159+
You can use this option to turn this automatic usage off.
160+
132161
## Environment Variables
133162

134163
These environment variables are meant to be used along `working-directory` to make sure

action.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
name: "Setup Dev Drive"
22
description: "A GitHub Action to setup a Windows Dev Drive."
33
author: "samypr100"
4+
branding:
5+
icon: hard-drive
6+
color: purple
47
inputs:
58
drive-size:
69
description: "Drive Size. Examples: 1GB, 3GB, 10GB."
@@ -23,10 +26,10 @@ inputs:
2326
workspace-copy:
2427
description: "Copy your GITHUB_WORKSPACE checkout to your Dev Drive. Examples: true, false."
2528
default: "false"
29+
native-dev-drive:
30+
description: "Use native dev drive support when available."
31+
default: "true"
2632
runs:
2733
using: "node20"
2834
main: "dist/setup/index.js"
2935
post: "dist/cleanup/index.js"
30-
branding:
31-
icon: hard-drive
32-
color: purple

dist/cleanup/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/setup/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)