diff --git a/.github/workflows/build-test-publish.yml b/.github/workflows/build-test-publish.yml new file mode 100644 index 0000000..6b8d7f1 --- /dev/null +++ b/.github/workflows/build-test-publish.yml @@ -0,0 +1,42 @@ +name: Build & Test & Publish + +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: | + 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 + make build FILE=$file + tag=`dirname $file` + if [ $tag == "all" ]; then + versions="14 13 12 11 10 9 8" + for version in ${versions}; do + docker run clang-tools:$tag clang-format-$version --version | grep -E clang-format.*$version + docker run clang-tools:$tag clang-tidy-$version --version | grep "LLVM version $version" + done + else + docker run clang-tools:$tag clang-format --version | grep -E clang-format.*$tag + docker run clang-tools:$tag clang-tidy --version | grep "LLVM version $tag" + fi + docker tag clang-tools:$tag xianpengshen/clang-tools:$tag + docker push xianpengshen/clang-tools:$tag + fi + done diff --git a/12/Dockerfile b/12/Dockerfile index d663601..6d88abf 100644 --- a/12/Dockerfile +++ b/12/Dockerfile @@ -2,9 +2,8 @@ FROM ubuntu:20.04 ENV VERSION 12 -RUN tools="clang-format-$VERSION clang-tidy-$VERSION" \ - && apt-get update \ - && apt-get -y install $tools \ +RUN apt-get update \ + && apt-get -y install clang-format-$VERSION clang-tidy-$VERSION \ && rm -rf /var/lib/apt/lists/* RUN ln -s /usr/bin/clang-format-"$VERSION" /usr/bin/clang-format \