Skip to content

Commit 85bfae5

Browse files
heyvitoofeefo
authored andcommitted
refactor(ci): Switch build step to matrix strategy
1 parent b411b70 commit 85bfae5

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

.github/workflows/go.yaml

+4-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ jobs:
5050
needs: test
5151

5252
runs-on: ubuntu-latest
53+
strategy:
54+
matrix:
55+
plugin: [golangci-lint, revive, staticcheck]
5356

5457
steps:
5558
- name: Check out to repository
@@ -63,4 +66,4 @@ jobs:
6366

6467
- name: Run script/build
6568
run: |
66-
script/build --build-arg go_token=${{ secrets.GO_SDK_CLONE_TOKEN }}
69+
script/build ${{ matrix.plugin }} --build-arg go_token=${{ secrets.GO_SDK_CLONE_TOKEN }}

script/build

+10-8
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,14 @@
22

33
set -e
44

5-
projects=(golangci-lint revive staticcheck)
6-
for i in "${projects[@]}"; do
7-
docker build -f "${i}/Dockerfile" -t "cocov/${i}:$(cat "${i}/VERSION" | head -n 1)" $@ .
8-
done
9-
10-
for i in "${projects[@]}"; do
11-
docker push "cocov/${i}:$(cat "${i}/VERSION" | head -n 1)"
12-
done
5+
if [[ -z "$1" ]]; then
6+
echo "Usage: script/build PROJECTNAME"
7+
exit 1
8+
fi
9+
10+
proj="$1"
11+
shift
12+
13+
docker build -f "${proj}/Dockerfile" -t "cocov/${proj}:$(cat "${proj}/VERSION" | head -n 1)" $@ .
14+
docker push "cocov/${proj}:$(cat "${proj}/VERSION" | head -n 1)"
1315

0 commit comments

Comments
 (0)