Skip to content

Commit 16ff158

Browse files
authored
Merge pull request #7 from useblacksmith/add-readme
README: update README with use cases and arch diagram
2 parents 60fc5d5 + 3d6bf16 commit 16ff158

7 files changed

Lines changed: 200 additions & 9 deletions

File tree

README.md

Lines changed: 79 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
A GitHub Action that helps persist state written to disk across jobs. Each sticky disk is hot-loaded into the runner and mounted at the specified path.
1212
The sticky disk is formatted as an ext4 filesystem.
1313

14-
A common use case of this action is to cache build artifacts such as NPM packages (egs: node_modules, yarn.lock, etc) across job runs.
15-
1614
## Usage
1715

1816
```yaml
@@ -28,3 +26,82 @@ jobs:
2826
```
2927
3028
Each sticky disk is uniquely identified by a key. The sticky disk will be mounted at the specified path. Once the job completes, the sticky disk will be unmounted and committed for future invocations. At the moment, customers can use up to 10 sticky disks in a single GitHub Action job.
29+
30+
# Use Cases
31+
32+
## Bazel Build Caching
33+
34+
Bazel's remote cache can significantly improve build times, but uploading and downloading cached artifacts can still be a bottleneck. Using sticky disks with Blacksmith runners provides near-instant access to your Bazel caches as they are bind mounted into your runners on demand. Our [`useblacksmith/setup-bazel@v2`](https://github.com/useblacksmith/setup-bazel) action is a zero-confg way to use sticky disks to store the disk, repository, and external cache.
35+
36+
```yaml
37+
jobs:
38+
build:
39+
runs-on: blacksmith
40+
steps:
41+
- uses: actions/checkout@v4
42+
43+
- name: Setup Bazel
44+
uses: useblacksmith/setup-bazel@v2
45+
with:
46+
version: '6.x'
47+
48+
- name: Build
49+
run: |
50+
bazel build //...
51+
```
52+
53+
### Cache Performance Comparison
54+
55+
| Caching Solution | Cache Size | Average Download Speed | Time to Access |
56+
|-----------------|------------|----------------|----------------|
57+
| GitHub Actions Cache | 6GB | 70 Mbps | ~11.5 minutes |
58+
| Blacksmith Cache | 6GB | 400 Mbps | ~2 minutes |
59+
| Sticky Disks | 6GB | N/A | 3 seconds |
60+
61+
62+
## NPM Package Caching
63+
64+
Node.js projects can have extensive dependency trees, leading to large `node_modules` directories. Sticky disks provide persistent, high-performance storage for your NPM packages.
65+
66+
```yaml
67+
jobs:
68+
build:
69+
runs-on: blacksmith
70+
steps:
71+
- uses: actions/checkout@v4
72+
73+
- name: Setup Node.js
74+
uses: actions/setup-node@v4
75+
with:
76+
node-version: '18.x'
77+
78+
- name: Mount NPM Cache
79+
uses: useblacksmith/stickydisk@v1
80+
with:
81+
key: ${{ github.repository }}-npm-cache
82+
path: ~/.npm
83+
84+
- name: Mount node_modules
85+
uses: useblacksmith/stickydisk@v1
86+
with:
87+
key: ${{ github.repository }}-node-modules
88+
path: ./node_modules
89+
90+
- name: Install Dependencies
91+
run: npm ci
92+
93+
- name: Build
94+
run: npm run build
95+
```
96+
97+
# Architecture
98+
99+
<p align="center">
100+
<picture>
101+
<!-- Dark mode -->
102+
<source media="(prefers-color-scheme: dark)" srcset="./arch-dark-mode.png" width="300">
103+
<!-- Light mode -->
104+
<source media="(prefers-color-scheme: light)" srcset="./arch-light.png" width="300">
105+
<img alt="Blacksmith Logo" src="./arch-light.png" width="300">
106+
</picture>
107+
</p>

arch-dark-mode.png

170 KB
Loading

arch-light.png

167 KB
Loading

dist/index.js

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/post/index.js

Lines changed: 57 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"dependencies": {
1212
"@actions/core": "^1.10.1",
13-
"@buf/blacksmith_vm-agent.connectrpc_es": "^1.6.1-20241213043610-906584953dd9.2",
13+
"@buf/blacksmith_vm-agent.connectrpc_es": "^1.6.1-20241220192643-e85a9caa965d.2",
1414
"@bufbuild/connect": "^0.13.0",
1515
"@bufbuild/connect-web": "^0.13.0",
1616
"@bufbuild/protobuf": "^1.4.2",

0 commit comments

Comments
 (0)