Skip to content

Commit fdcfd30

Browse files
committed
chore: add disk usage checks throughout production workflow
- Introduced disk usage checks at various stages of the production workflow to monitor system resource usage. - Added checks after Docker image cleanup, node setup, dependency installation, cache restoration, and before/after deployment steps for better resource management.
1 parent a468ab2 commit fdcfd30

File tree

1 file changed

+33
-4
lines changed

1 file changed

+33
-4
lines changed

.github/workflows/production.yml

Lines changed: 33 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,21 @@ jobs:
3939
- name: Check disk usage
4040
run: df -h
4141
- name: Remove unused Docker images
42-
run: docker system prune -af
42+
run: |
43+
docker system prune -af
44+
df -h
4345
4446
- uses: actions/checkout@v3
4547
with:
4648
ref: "master"
49+
- name: Check disk usage after checkout
50+
run: df -h
4751
- uses: actions/setup-node@v4
4852
with:
4953
node-version: 22
5054
cache: "yarn"
55+
- name: Check disk usage after setup-node
56+
run: df -h
5157

5258
- name: Update submodule
5359
id: submodule
@@ -61,9 +67,12 @@ jobs:
6167
echo "submodule_status=$(git submodule status)" >> $GITHUB_OUTPUT
6268
echo "git_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
6369
echo "build_date=$(date)" >> $GITHUB_OUTPUT
70+
df -h
6471
6572
- name: Install deps
66-
run: yarn
73+
run: |
74+
yarn
75+
df -h
6776
6877
- name: Calc gatsby cache key
6978
id: calc-cache-key
@@ -74,6 +83,7 @@ jobs:
7483
else
7584
echo "key=${{ steps.submodule.outputs.submodule_sha }}" >> $GITHUB_OUTPUT
7685
fi
86+
df -h
7787
7888
- name: Restore gatsby cache
7989
uses: actions/cache@v3
@@ -85,16 +95,20 @@ jobs:
8595
key: ${{ runner.os }}-gatsby-cache-docs-staging-${{ steps.calc-cache-key.outputs.key }}
8696
restore-keys: |
8797
${{ runner.os }}-gatsby-cache-docs-staging-
98+
- name: Check disk usage after restore cache
99+
run: df -h
88100

89101
- name: Clean up temporary files
90102
run: |
91103
sudo rm -rf /tmp/*
92104
sudo rm -rf /home/runner/work/_temp/*
105+
df -h
93106
94107
- name: Clean cache
95108
if: ${{ inputs.nocache }}
96109
run: |
97110
yarn clean
111+
df -h
98112
99113
- name: Build website
100114
if: ${{ !inputs.fallback || (steps.gatsby-cache.outputs.cache-hit != 'true') }}
@@ -108,18 +122,21 @@ jobs:
108122
GATSBY_SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
109123
run: |
110124
yarn build
125+
df -h
111126
112127
- name: Check output
113128
id: check-output
114129
run: |
115130
sudo apt install tree
116131
tree public
132+
df -h
117133
118134
- name: Install coscli
119135
run: |
120136
wget https://cosbrowser.cloud.tencent.com/software/coscli/coscli-linux-amd64
121137
mv coscli-linux-amd64 coscli
122138
chmod 755 coscli
139+
df -h
123140
124141
- name: Deploy to COS
125142
if: ${{ !inputs.cos_backup }}
@@ -134,6 +151,7 @@ jobs:
134151
--delete \
135152
--exclude ".*\.(md|txt)$" \
136153
--force
154+
df -h
137155
138156
- name: Deploy md to COS
139157
if: ${{ !inputs.cos_backup }}
@@ -148,6 +166,7 @@ jobs:
148166
--include ".*\.(md|txt)$" \
149167
--meta "Content-Type:text/plain; charset=utf-8" \
150168
--force
169+
df -h
151170
152171
- name: Deploy to COS backup
153172
if: ${{ inputs.cos_backup }}
@@ -162,6 +181,7 @@ jobs:
162181
--delete \
163182
--exclude ".*\.(md|txt)$" \
164183
--force
184+
df -h
165185
166186
- name: Deploy md to COS backup
167187
if: ${{ inputs.cos_backup }}
@@ -176,6 +196,7 @@ jobs:
176196
--include ".*\.(md|txt)$" \
177197
--meta "Content-Type:text/plain; charset=utf-8" \
178198
--force
199+
df -h
179200
180201
cdn-refresh:
181202
needs: build
@@ -187,15 +208,23 @@ jobs:
187208
steps:
188209
- name: Checkout repository
189210
uses: actions/checkout@v4
211+
- name: Check disk usage after checkout
212+
run: df -h
190213

191214
- name: Set up Python environment
192215
uses: actions/setup-python@v5
193216
with:
194217
python-version: "3.12"
195218
architecture: "x64"
219+
- name: Check disk usage after setup-python
220+
run: df -h
196221

197222
- name: Install Tencent Cloud CLI
198-
run: pipx install tccli
223+
run: |
224+
pipx install tccli
225+
df -h
199226
200227
- name: Purge production CDN cache
201-
run: tccli cdn PurgePathCache --Paths '["https://docs.pingcap.com/"]' --FlushType flush
228+
run: |
229+
tccli cdn PurgePathCache --Paths '["https://docs.pingcap.com/"]' --FlushType flush
230+
df -h

0 commit comments

Comments
 (0)