forked from pytorch/test-infra
-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (46 loc) · 1.88 KB
/
clang-tidy-linux.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
name: Custom clang-tidy build (linux)
on:
pull_request:
paths:
- 'tools/clang-tidy-checks/**'
- '!tools/clang-tidy-checks/README.md'
- '.github/workflows/clang-tidy-linux.yml'
push:
branches:
- main
paths:
- 'tools/clang-tidy-checks/**'
- '!tools/clang-tidy-checks/README.md'
- '.github/workflows/clang-tidy-linux.yml'
jobs:
build:
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Build docker image
run: |
set -ex
echo ${{ secrets.GITHUB_TOKEN }} | docker login ghcr.io -u "$GITHUB_ACTOR" --password-stdin
docker build ./tools/clang-tidy-checks --tag ghcr.io/pytorch/cilint-clang-tidy:"$GITHUB_SHA" -f tools/clang-tidy-checks/Dockerfile.cilint-clang-tidy
- name: Publish docker image and extract binary
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
run: |
set -ex
docker push ghcr.io/pytorch/cilint-clang-tidy:"$GITHUB_SHA"
# Copying files directly from a docker image is not supported
# As a workaround, we create a temporary container, copy the binary, and remove it
image_id=$(docker create ghcr.io/pytorch/cilint-clang-tidy:"$GITHUB_SHA")
docker cp "$image_id":/clang-tidy-checks/build/bin/clang-tidy ./clang-tidy
docker rm -v "$image_id"
- uses: driazati/upload-artifact-s3@50adbe4ef0b6d9221df25c18c5fc528dfcb7c3f8
name: Publish binary
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
with:
name: clang-tidy
if-no-files-found: error
s3-prefix: linux64
s3-bucket: oss-clang-format
path: clang-tidy
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}