63 lines
2.0 KiB
YAML
63 lines
2.0 KiB
YAML
|
# Copyright 2022 Google LLC
|
||
|
#
|
||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||
|
# you may not use this file except in compliance with the License.
|
||
|
# You may obtain a copy of the License at
|
||
|
#
|
||
|
# https://www.apache.org/licenses/LICENSE-2.0
|
||
|
#
|
||
|
# Unless required by applicable law or agreed to in writing, software
|
||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
|
# See the License for the specific language governing permissions and
|
||
|
# limitations under the License.
|
||
|
|
||
|
# A workflow to lint Shaka Packager.
|
||
|
name: Lint
|
||
|
|
||
|
# Runs when called from another workflow.
|
||
|
on:
|
||
|
workflow_call:
|
||
|
inputs:
|
||
|
ref:
|
||
|
required: true
|
||
|
type: string
|
||
|
|
||
|
# By default, run all commands in a bash shell. On Windows, the default would
|
||
|
# otherwise be powershell.
|
||
|
defaults:
|
||
|
run:
|
||
|
shell: bash
|
||
|
|
||
|
jobs:
|
||
|
lint:
|
||
|
name: Lint
|
||
|
runs-on: ubuntu-latest
|
||
|
steps:
|
||
|
- name: Checkout code
|
||
|
uses: actions/checkout@v2
|
||
|
with:
|
||
|
ref: ${{ inputs.ref }}
|
||
|
# We must use 'fetch-depth: 2', or else the linter won't have another
|
||
|
# revision to compare to.
|
||
|
fetch-depth: 2
|
||
|
|
||
|
- name: Lint
|
||
|
shell: bash
|
||
|
run: |
|
||
|
wget https://raw.githubusercontent.com/llvm-mirror/clang/master/tools/clang-format/git-clang-format
|
||
|
sudo install -m 755 git-clang-format /usr/local/bin/git-clang-format
|
||
|
rm git-clang-format
|
||
|
|
||
|
python3 -m pip install --upgrade pylint==2.8.3
|
||
|
|
||
|
# NOTE: Must use base.sha instead of base.ref, since we don't have
|
||
|
# access to the branch name that base.ref would give us.
|
||
|
# NOTE: Must also use fetch-depth: 2 in actions/checkout to have access
|
||
|
# to the base ref for comparison.
|
||
|
packager/tools/git/check_formatting.py \
|
||
|
--binary /usr/bin/clang-format \
|
||
|
${{ github.event.pull_request.base.sha || 'HEAD^' }}
|
||
|
|
||
|
packager/tools/git/check_pylint.py
|