Skip to content

Commit 4e85d18

Browse files
committed
ci: optimize CI/CD infrastructure and upgrade dependencies
- Align golangci-lint version to v1.63.4 across CI and Makefile - Upgrade Go from 1.20 (EOL) to 1.22 in go.mod, backend Dockerfile, and lake-builder Dockerfile - Upgrade GitHub Actions to latest major versions: checkout v4, cache v4, docker/build-push-action v6, setup-qemu v3, setup-buildx v3, login-action v3, setup-node v4, stale v9, super-linter v7, github-script v7 - Fix config-ui Dockerfile layer cache by copying package.json before yarn install - Consolidate backend Dockerfile apt-get layers and add Go module cache mount - Add backend/.dockerignore for smaller build context - Add concurrency control to 11 PR-triggered workflows - Extract free-disk-space composite action to reduce duplication in build.yml
1 parent 17e3ea4 commit 4e85d18

21 files changed

Lines changed: 146 additions & 110 deletions
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
# Licensed to the Apache Software Foundation (ASF) under one or more
2+
# contributor license agreements. See the NOTICE file distributed with
3+
# this work for additional information regarding copyright ownership.
4+
# The ASF licenses this file to You under the Apache License, Version 2.0
5+
# (the "License"); you may not use this file except in compliance with
6+
# the License. You may obtain a copy of the License at
7+
#
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
#
10+
# Unless required by applicable law or agreed to in writing, software
11+
# distributed under the License is distributed on an "AS IS" BASIS,
12+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
# See the License for the specific language governing permissions and
14+
# limitations under the License.
15+
16+
name: Free Disk Space
17+
description: Remove unnecessary software to free disk space for Docker builds
18+
runs:
19+
using: composite
20+
steps:
21+
- run: |
22+
sudo rm -rf /usr/share/dotnet
23+
sudo rm -rf /usr/local/lib/android
24+
sudo rm -rf /opt/ghc
25+
sudo rm -rf /opt/hostedtoolcache/CodeQL
26+
docker system prune -af
27+
docker volume prune -f
28+
shell: bash

.github/workflows/NOTICE-year-check.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717

1818
name: NOTICE-year-check
1919
on: [pull_request]
20-
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
2123
jobs:
2224
notice-year-check:
2325
runs-on: ubuntu-latest
2426
steps:
25-
- uses: actions/checkout@v3
27+
- uses: actions/checkout@v4
2628
- name: check the NOTICE file
2729
run: grep $(date +"%Y") NOTICE

.github/workflows/asf-header-check.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ name: check-Apache-license-header
2020
on:
2121
pull_request:
2222
branches: [ main ]
23-
23+
concurrency:
24+
group: ${{ github.workflow }}-${{ github.ref }}
25+
cancel-in-progress: true
2426
jobs:
2527
check-ASF-header:
2628
name: check Apache license header
2729
runs-on: ubuntu-24.04
2830
steps:
2931
- name: Checkout repository
30-
uses: actions/checkout@v2
32+
uses: actions/checkout@v4
3133

3234
- name: Check License Header
3335
uses: apache/skywalking-eyes@main

.github/workflows/auto-cherry-pick.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
if: github.event.pull_request.merged == true
2929
runs-on: ubuntu-latest
3030
steps:
31-
- uses: actions/checkout@v3
31+
- uses: actions/checkout@v4
3232
with:
3333
fetch-depth: 0
3434
- name: Auto Cherry Pick

.github/workflows/build-builder.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ jobs:
2525
name: Build lake-builder image
2626
runs-on: ubuntu-20.04
2727
steps:
28-
- uses: actions/checkout@v2
29-
- uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
28+
- uses: actions/checkout@v4
29+
- uses: docker/login-action@v3
3030
with:
3131
username: ${{ secrets.DOCKER_REGISTRY_USERNAME }}
3232
password: ${{ secrets.DOCKER_REGISTRY_PASSWORD }}

.github/workflows/build.yml

Lines changed: 34 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -33,26 +33,19 @@ jobs:
3333
name: Build and Push devlake builder
3434
runs-on: ubuntu-latest
3535
steps:
36-
- name: Free Disk Space
37-
run: |
38-
sudo rm -rf /usr/share/dotnet
39-
sudo rm -rf /usr/local/lib/android
40-
sudo rm -rf /opt/ghc
41-
sudo rm -rf /opt/hostedtoolcache/CodeQL
42-
docker system prune -af
43-
docker volume prune -f
44-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
37+
- uses: ./.github/actions/free-disk-space
4538
- name: Set up QEMU
46-
uses: docker/setup-qemu-action@v2
39+
uses: docker/setup-qemu-action@v3
4740
- name: Set up Docker Buildx
48-
uses: docker/setup-buildx-action@v2
41+
uses: docker/setup-buildx-action@v3
4942
- name: Login to DockerHub
50-
uses: docker/login-action@v2
43+
uses: docker/login-action@v3
5144
with:
5245
username: ${{ env.DOCKERHUB_USERNAME }}
5346
password: ${{ env.DOCKERHUB_TOKEN }}
5447
- name: Build and push lake image
55-
uses: docker/build-push-action@v3
48+
uses: docker/build-push-action@v6
5649
with:
5750
context: ./backend
5851
push: true
@@ -65,26 +58,19 @@ jobs:
6558
name: Build and Push devlake base
6659
runs-on: ubuntu-latest
6760
steps:
68-
- name: Free Disk Space
69-
run: |
70-
sudo rm -rf /usr/share/dotnet
71-
sudo rm -rf /usr/local/lib/android
72-
sudo rm -rf /opt/ghc
73-
sudo rm -rf /opt/hostedtoolcache/CodeQL
74-
docker system prune -af
75-
docker volume prune -f
76-
- uses: actions/checkout@v3
61+
- uses: actions/checkout@v4
62+
- uses: ./.github/actions/free-disk-space
7763
- name: Set up QEMU
78-
uses: docker/setup-qemu-action@v2
64+
uses: docker/setup-qemu-action@v3
7965
- name: Set up Docker Buildx
80-
uses: docker/setup-buildx-action@v2
66+
uses: docker/setup-buildx-action@v3
8167
- name: Login to DockerHub
82-
uses: docker/login-action@v2
68+
uses: docker/login-action@v3
8369
with:
8470
username: ${{ env.DOCKERHUB_USERNAME }}
8571
password: ${{ env.DOCKERHUB_TOKEN }}
8672
- name: Build and push lake image
87-
uses: docker/build-push-action@v3
73+
uses: docker/build-push-action@v6
8874
with:
8975
context: ./backend
9076
push: true
@@ -101,33 +87,26 @@ jobs:
10187
matrix:
10288
platform: ["arm64", "amd64"]
10389
steps:
104-
- name: Free Disk Space
105-
run: |
106-
sudo rm -rf /usr/share/dotnet
107-
sudo rm -rf /usr/local/lib/android
108-
sudo rm -rf /opt/ghc
109-
sudo rm -rf /opt/hostedtoolcache/CodeQL
110-
docker system prune -af
111-
docker volume prune -f
112-
- uses: actions/checkout@v3
90+
- uses: actions/checkout@v4
91+
- uses: ./.github/actions/free-disk-space
11392
- name: Get short sha
11493
id: get_short_sha
11594
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
11695
- name: Set up QEMU
117-
uses: docker/setup-qemu-action@v2
96+
uses: docker/setup-qemu-action@v3
11897
- name: Set up Docker Buildx
119-
uses: docker/setup-buildx-action@v2
98+
uses: docker/setup-buildx-action@v3
12099
- name: Login to DockerHub
121-
uses: docker/login-action@v2
100+
uses: docker/login-action@v3
122101
with:
123102
username: ${{ env.DOCKERHUB_USERNAME }}
124103
password: ${{ env.DOCKERHUB_TOKEN }}
125-
- uses: actions/cache@v3
104+
- uses: actions/cache@v4
126105
with:
127106
path: /tmp/devlake-build-cache-${{ matrix.platform }}
128107
key: buildx-devlake-build-cache-${{ github.run_id }}-${{ matrix.platform }}
129108
- name: Build and cache lake build
130-
uses: docker/build-push-action@v3
109+
uses: docker/build-push-action@v6
131110
with:
132111
context: ./backend
133112
push: false
@@ -153,32 +132,25 @@ jobs:
153132
name: Build and Push devlake image
154133
runs-on: ubuntu-latest
155134
steps:
156-
- name: Free Disk Space
157-
run: |
158-
sudo rm -rf /usr/share/dotnet
159-
sudo rm -rf /usr/local/lib/android
160-
sudo rm -rf /opt/ghc
161-
sudo rm -rf /opt/hostedtoolcache/CodeQL
162-
docker system prune -af
163-
docker volume prune -f
164-
- uses: actions/checkout@v3
135+
- uses: actions/checkout@v4
136+
- uses: ./.github/actions/free-disk-space
165137
- name: Get short sha
166138
id: get_short_sha
167139
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
168140
- name: Set up QEMU
169-
uses: docker/setup-qemu-action@v2
141+
uses: docker/setup-qemu-action@v3
170142
- name: Set up Docker Buildx
171-
uses: docker/setup-buildx-action@v2
143+
uses: docker/setup-buildx-action@v3
172144
- name: Login to DockerHub
173-
uses: docker/login-action@v2
145+
uses: docker/login-action@v3
174146
with:
175147
username: ${{ env.DOCKERHUB_USERNAME }}
176148
password: ${{ env.DOCKERHUB_TOKEN }}
177-
- uses: actions/cache@v3
149+
- uses: actions/cache@v4
178150
with:
179151
path: /tmp/devlake-build-cache-amd64
180152
key: buildx-devlake-build-cache-${{ github.run_id }}-amd64
181-
- uses: actions/cache@v3
153+
- uses: actions/cache@v4
182154
with:
183155
path: /tmp/devlake-build-cache-arm64
184156
key: buildx-devlake-build-cache-${{ github.run_id }}-arm64
@@ -194,7 +166,7 @@ jobs:
194166
echo "TAGS=${image_name}:${{ github.ref_name }}_${{ needs.get-timestamp.outputs.timestamp }}_${{ steps.get_short_sha.outputs.SHORT_SHA }}" >> $GITHUB_OUTPUT
195167
fi
196168
- name: Build and push lake image
197-
uses: docker/build-push-action@v3
169+
uses: docker/build-push-action@v6
198170
with:
199171
context: ./backend
200172
push: true
@@ -209,7 +181,7 @@ jobs:
209181
TAG=${{ github.ref_name }}
210182
SHA=${{ steps.get_short_sha.outputs.SHORT_SHA }}
211183
- name: Clear cache
212-
uses: actions/github-script@v6
184+
uses: actions/github-script@v7
213185
if: always()
214186
with:
215187
script: |
@@ -240,24 +212,17 @@ jobs:
240212
image: devlake-dashboard
241213
context: grafana
242214
steps:
243-
- name: Free Disk Space
244-
run: |
245-
sudo rm -rf /usr/share/dotnet
246-
sudo rm -rf /usr/local/lib/android
247-
sudo rm -rf /opt/ghc
248-
sudo rm -rf /opt/hostedtoolcache/CodeQL
249-
docker system prune -af
250-
docker volume prune -f
251-
- uses: actions/checkout@v3
215+
- uses: actions/checkout@v4
216+
- uses: ./.github/actions/free-disk-space
252217
- name: Get short sha
253218
id: get_short_sha
254219
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
255220
- name: Set up QEMU
256-
uses: docker/setup-qemu-action@v2
221+
uses: docker/setup-qemu-action@v3
257222
- name: Set up Docker Buildx
258-
uses: docker/setup-buildx-action@v2
223+
uses: docker/setup-buildx-action@v3
259224
- name: Login to DockerHub
260-
uses: docker/login-action@v2
225+
uses: docker/login-action@v3
261226
with:
262227
username: ${{ env.DOCKERHUB_USERNAME }}
263228
password: ${{ env.DOCKERHUB_TOKEN }}
@@ -273,7 +238,7 @@ jobs:
273238
echo "TAGS=${image_name}:${{ github.ref_name }}_${{ needs.get-timestamp.outputs.timestamp }}_${{ steps.get_short_sha.outputs.SHORT_SHA }}" >> $GITHUB_OUTPUT
274239
fi
275240
- name: Build and push ${{ matrix.build.name }} image
276-
uses: docker/build-push-action@v3
241+
uses: docker/build-push-action@v6
277242
with:
278243
context: ${{ matrix.build.context }}
279244
push: true

.github/workflows/codespell.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ on:
2626

2727
permissions:
2828
contents: read
29-
29+
concurrency:
30+
group: ${{ github.workflow }}-${{ github.ref }}
31+
cancel-in-progress: true
3032
jobs:
3133
codespell:
3234
name: Check for spelling errors

.github/workflows/commit-msg.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,19 @@
1717

1818
name: lint-commit-message
1919
on: [pull_request]
20-
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
2123
jobs:
2224
commit-msg:
2325
runs-on: ubuntu-latest
2426
steps:
25-
- uses: actions/checkout@v2
27+
- uses: actions/checkout@v4
2628
with:
2729
fetch-depth: 0
2830
- name: Cache lint-commit-message
2931
id: cache-lint-commit-message
30-
uses: actions/cache@v3
32+
uses: actions/cache@v4
3133
with:
3234
path: lint-commit-message
3335
key: ${{ runner.os }}-lint-commit-message

.github/workflows/config-ui.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,16 @@ on:
2121
branches: [ main ]
2222
paths:
2323
- 'config-ui/**'
24+
concurrency:
25+
group: ${{ github.workflow }}-${{ github.ref }}
26+
cancel-in-progress: true
2427
jobs:
2528
lint:
2629
runs-on: ubuntu-latest
2730
steps:
28-
- uses: actions/checkout@v2
31+
- uses: actions/checkout@v4
2932
- name: Set up Node.js
30-
uses: actions/setup-node@v3
33+
uses: actions/setup-node@v4
3134
with:
3235
node-version: '18'
3336
cache: 'yarn'

.github/workflows/golangci-lint.yml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,20 @@ on:
2323
branches:
2424
- main
2525
pull_request:
26+
concurrency:
27+
group: ${{ github.workflow }}-${{ github.ref }}
28+
cancel-in-progress: true
2629
jobs:
2730
golangci:
2831
name: lint
2932
runs-on: ubuntu-latest
33+
# TODO: Pin to specific version tag for reproducibility (e.g., mericodev/lake-builder:builder-vX.X.X)
3034
container: mericodev/lake-builder:latest
3135
steps:
32-
- uses: actions/checkout@v3
36+
- uses: actions/checkout@v4
3337
- name: Cache golangci-lint
3438
id: cache-golangci-lint
35-
uses: actions/cache@v3
39+
uses: actions/cache@v4
3640
with:
3741
path: golangci-lint
3842
key: ${{ runner.os }}-backend-golangci-lint
@@ -44,5 +48,5 @@ jobs:
4448
- name: golangci-lint
4549
uses: golangci/golangci-lint-action@v6
4650
with:
47-
version: v1.53.3
51+
version: v1.63.4
4852
working-directory: ./backend

0 commit comments

Comments
 (0)