Skip to content

Commit 73cb4a8

Browse files
authored
Merge pull request #3 from juicermv/cache
Build Cache
2 parents 3e6877a + 450a1aa commit 73cb4a8

File tree

9 files changed

+894
-367
lines changed

9 files changed

+894
-367
lines changed

.github/workflows/rust.yml

Lines changed: 80 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@ on:
44
workflow_dispatch:
55

66
push:
7-
branches: [ "main" ]
8-
7+
98
pull_request:
109
branches: [ "main" ]
1110

@@ -20,15 +19,30 @@ jobs:
2019
runs-on: ubuntu-latest
2120

2221
permissions:
23-
contents: write
22+
contents: write
2423

2524
steps:
2625
- uses: actions/checkout@v4
2726

27+
- name: Restore build cache
28+
uses: actions/cache/restore@v4
29+
with:
30+
path: 'target'
31+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
32+
restore-keys: |
33+
${{runner.os}}-${{runner.arch}}-build-cache-
34+
2835
- name: build
2936
run: cargo build --verbose --target x86_64-unknown-linux-gnu --release
3037

38+
- name: Cache Build Output
39+
uses: actions/cache/save@v4
40+
with:
41+
path: 'target'
42+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
43+
3144
- name: Update indev release
45+
if: github.ref_name == 'main'
3246
run: gh release upload indev ./target/x86_64-unknown-linux-gnu/release/numake --clobber
3347

3448
- name: Upload artifact
@@ -45,9 +59,23 @@ jobs:
4559
steps:
4660
- uses: actions/checkout@v4
4761

62+
- name: Restore build cache
63+
uses: actions/cache/restore@v4
64+
with:
65+
path: 'target'
66+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
67+
restore-keys: |
68+
${{runner.os}}-${{runner.arch}}-build-cache-
69+
4870
- name: build
4971
run: cargo build --verbose --target x86_64-unknown-linux-gnu
5072

73+
- name: Cache Build Output
74+
uses: actions/cache/save@v4
75+
with:
76+
path: 'target'
77+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
78+
5179
- name: Upload artifact
5280
uses: actions/upload-artifact@v4
5381
with:
@@ -60,20 +88,35 @@ jobs:
6088
runs-on: windows-latest
6189

6290
permissions:
63-
contents: write
91+
contents: write
6492

6593
steps:
6694
- uses: actions/checkout@v4
67-
95+
6896
- name: Install toolchain
6997
run: rustup target add x86_64-pc-windows-gnu
70-
98+
99+
- name: Restore build cache
100+
uses: actions/cache/restore@v4
101+
with:
102+
path: 'target'
103+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
104+
restore-keys: |
105+
${{runner.os}}-${{runner.arch}}-build-cache-
106+
71107
- name: build
72108
run: cargo build --verbose --target x86_64-pc-windows-gnu --release
73109

110+
- name: Cache Build Output
111+
uses: actions/cache/save@v4
112+
with:
113+
path: 'target'
114+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
115+
74116
- name: Update indev release
117+
if: github.ref_name == 'main'
75118
run: gh release upload indev ./target/x86_64-pc-windows-gnu/release/numake.exe --clobber
76-
119+
77120
- name: Upload artifact
78121
uses: actions/upload-artifact@v4
79122
with:
@@ -89,10 +132,24 @@ jobs:
89132

90133
- name: Install toolchain
91134
run: rustup target add x86_64-pc-windows-gnu
92-
135+
136+
- name: Restore build cache
137+
uses: actions/cache/restore@v4
138+
with:
139+
path: 'target'
140+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
141+
restore-keys: |
142+
${{runner.os}}-${{runner.arch}}-build-cache-
143+
93144
- name: build
94145
run: cargo build --verbose --target x86_64-pc-windows-gnu
95-
146+
147+
- name: Cache Build Output
148+
uses: actions/cache/save@v4
149+
with:
150+
path: 'target'
151+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
152+
96153
- name: Upload artifact
97154
uses: actions/upload-artifact@v4
98155
with:
@@ -110,9 +167,23 @@ jobs:
110167
- name: Install toolchain
111168
run: rustup target add x86_64-pc-windows-msvc
112169

170+
- name: Restore build cache
171+
uses: actions/cache/restore@v4
172+
with:
173+
path: 'target'
174+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
175+
restore-keys: |
176+
${{runner.os}}-${{runner.arch}}-build-cache-
177+
113178
- name: build
114179
run: cargo build --verbose --target x86_64-pc-windows-msvc
115180

181+
- name: Cache Build Output
182+
uses: actions/cache/save@v4
183+
with:
184+
path: 'target'
185+
key: ${{runner.os}}-${{runner.arch}}-build-cache-${{hashFiles('target/')}}
186+
116187
- name: Upload artifact
117188
uses: actions/upload-artifact@v4
118189
with:

0 commit comments

Comments
 (0)