-
Notifications
You must be signed in to change notification settings - Fork 5
76 lines (62 loc) · 2.05 KB
/
static_checks.yaml
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
# Copyright (C) 2024 Mitsubishi Electric Research Laboratories (MERL)
#
# SPDX-License-Identifier: Apache-2.0
name: Static code checks
on: # yamllint disable-line rule:truthy
pull_request:
push:
branches:
- '**'
tags-ignore:
- '**'
env:
LICENSE: Apache-2.0
FETCH_DEPTH: 1
FULL_HISTORY: 0
SKIP_WORD_PRESENCE_CHECK: 0
jobs:
static-code-check:
if: endsWith(github.event.repository.name, 'private')
name: Run static code checks
runs-on: ubuntu-latest
defaults:
run:
shell: bash -l {0}
steps:
- name: Setup history
if: github.ref == 'refs/heads/oss'
run: |
echo "FETCH_DEPTH=0" >> $GITHUB_ENV
echo "FULL_HISTORY=1" >> $GITHUB_ENV
- name: Setup version
if: github.ref == 'refs/heads/melco'
run: |
echo "SKIP_WORD_PRESENCE_CHECK=1" >> $GITHUB_ENV
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: ${{ env.FETCH_DEPTH }} # '0' to check full history
- name: Set up environment
run: git config user.email [email protected]
- name: Set up python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: '.github/workflows/requirements-dev.txt'
- name: Install python packages
run: pip install -r .github/workflows/requirements-dev.txt
- name: Ensure lint and pre-commit steps have been run
uses: pre-commit/[email protected]
- name: Check files
uses: merl-oss-private/merl-file-check-action@v1
with:
license: ${{ env.LICENSE }}
full-history: ${{ env.FULL_HISTORY }} # If true, use fetch-depth 0 above
skip-word-presence-check: ${{ env.SKIP_WORD_PRESENCE_CHECK }}
- name: Check license compatibility
if: github.ref != 'refs/heads/melco'
uses: merl-oss-private/merl_license_compatibility_checker@v1
with:
input-filename: requirements.txt
license: ${{ env.LICENSE }}