Skip to content

Commit 81b6ced

Browse files
committed
Add apt package caching and optimize checkout
- Add apt package cache to speed up mysql-client installation - Use fetch-depth: 1 for faster git checkout - Use -qq flag for quieter apt-get update - Use --no-install-recommends to reduce package size Expected to save ~45-70 seconds per workflow run.
1 parent 0528047 commit 81b6ced

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

.github/workflows/main.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ jobs:
2727
steps:
2828
- name: Checkout Git repo
2929
uses: actions/checkout@v4
30+
with:
31+
fetch-depth: 1
3032

3133
- name: Set up Go
3234
uses: actions/setup-go@v4
@@ -82,6 +84,8 @@ jobs:
8284
steps:
8385
- name: Checkout Git repo
8486
uses: actions/checkout@v4
87+
with:
88+
fetch-depth: 1
8589

8690
- name: Set up Go
8791
uses: actions/setup-go@v4
@@ -103,10 +107,18 @@ jobs:
103107
- name: Make Terraform executable
104108
run: chmod +x bin/terraform
105109

110+
- name: Cache apt packages
111+
uses: actions/cache@v4
112+
with:
113+
path: /var/cache/apt
114+
key: ${{ runner.os }}-apt-${{ hashFiles('**/.github/workflows/main.yml') }}
115+
restore-keys: |
116+
${{ runner.os }}-apt-
117+
106118
- name: Install mysql client
107119
run: |
108-
sudo apt-get update
109-
sudo apt-get -f -y install mysql-client
120+
sudo apt-get update -qq
121+
sudo apt-get install -y --no-install-recommends mysql-client
110122
111123
- name: Run tests {{ matrix.target }}
112124
env:

0 commit comments

Comments
 (0)