-
Notifications
You must be signed in to change notification settings - Fork 26
164 lines (154 loc) · 4.8 KB
/
format-and-lint.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Format & lint
on:
push:
branches: [ master, submission-v* ]
pull_request:
types: [ opened, synchronize, reopened ]
jobs:
build-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/mlcommons/mobile_app_open-formatter
flavor: latest=true
tags: type=raw,value=${{ github.run_number }}
- name: Build and push Docker image
uses: docker/build-push-action@v5
with:
context: tools/formatter
file: tools/formatter/Dockerfile
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
bazel:
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: bazel
run: make lint/bazel
cpp:
name: C++
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: clang
run: make lint/clang
dart:
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Cache Flutter packages
uses: actions/cache@v4
with:
path: /home/mlperf/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }}
restore-keys: ${{ runner.os }}-pub-cache-
- name: flutter/prepare
run: make flutter/prepare
- name: pub-get
run: make format/dart/pub-get
- name: lint/dart
run: make lint/dart
- name: result-schema
run: make lint/result-schema
swift:
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: swift
run: make lint/swift
markdown:
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: markdown-format
run: make lint/markdown
yaml:
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: yaml
run: make lint/yaml
ts:
name: TypeScript
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: typescripts
run: make lint/ts
misc:
needs: build-image
runs-on: ubuntu-latest
container:
image: ghcr.io/mlcommons/mobile_app_open-formatter:${{ github.run_number }}
timeout-minutes: 10
steps:
- uses: actions/checkout@v3
- name: configure Git
run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: prohibited-extensions
run: make lint/prohibited-extensions
- name: big-files
run: make lint/big-files
- name: line-endings
run: make lint/line-endings