-
Notifications
You must be signed in to change notification settings - Fork 0
54 lines (50 loc) · 1.95 KB
/
build-test-publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
name: CI
on:
push:
branches: [ master ]
paths:
- '**Dockerfile'
pull_request:
branches: [ master ]
paths:
- '**Dockerfile'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v18.4
- name: Build & Test (Publish)
run: |
pip install pre-commit && pre-commit install
docker login -u '${{ secrets.DOCKER_USERNAME }}' -p '${{ secrets.DOCKER_PASSWORD }}'
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ "$file" == *"Dockerfile" ]]; then
set -e
echo "start to build ..."
make prune
make build FILE=$file
docker images
echo "start to test ..."
tag=`dirname $file`
if [ $tag == "all" ]; then
clang_versions="16 15 14 13 12 11 10 9 8"
for clang_version in ${clang_versions}; do
docker run clang-tools:$tag clang-format-$clang_version --version | grep -E "clang-format version $clang_version"
docker run clang-tools:$tag clang-tidy-$clang_version --version | grep "LLVM version $clang_version"
done
elif [[ "$tag" == *"alpine"* ]]; then
docker run clang-tools:$tag clang-format --version | grep -E "clang-format version"
docker run clang-tools:$tag clang-tidy --version | grep "LLVM version"
else
docker run clang-tools:$tag clang-format --version | grep -E "clang-format version $tag"
docker run clang-tools:$tag clang-tidy --version | grep "LLVM version $tag"
fi
if [[ $GITHUB_EVENT_NAME == 'push' ]]; then
echo "start to publish ..."
make publish FILE=$file
fi
fi
done