|
2 | 2 |
|
3 | 3 | name: MLGO CI
|
4 | 4 |
|
5 |
| -on: [push] |
| 5 | +on: [push, repository_dispatch] |
6 | 6 |
|
7 | 7 | jobs:
|
8 |
| - build: |
| 8 | + LicenseCheck: |
9 | 9 | runs-on: ubuntu-latest
|
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v3 |
| 12 | + - run: ./check-license.sh |
| 13 | + Envvars: |
| 14 | + runs-on: ubuntu-latest |
| 15 | + outputs: |
| 16 | + version_matrix: ${{ steps.set-output.outputs.version_matrix }} |
| 17 | + do_cache: ${{ steps.set-output.outputs.do_cache }} |
| 18 | + steps: |
| 19 | + - id: set-output |
| 20 | + run: | |
| 21 | + if [ -z $ACT ] |
| 22 | + then |
| 23 | + _ver="[3.8, 3.9]" |
| 24 | + _cache="1" |
| 25 | + else |
| 26 | + _ver="[3.8]" |
| 27 | + _cache="0" |
| 28 | + fi |
| 29 | + echo "::set-output name=version_matrix::$_ver" |
| 30 | + echo "::set-output name=do_cache::$_cache" |
| 31 | + Checks: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + needs: [Envvars] |
10 | 34 | strategy:
|
11 | 35 | matrix:
|
12 |
| - python-version: ["3.8", "3.9"] |
| 36 | + python-version: ${{ fromJSON(needs.Envvars.outputs.version_matrix) }} |
| 37 | + task: [Typecheck, Lint, Yapf, Test] |
| 38 | + include: |
| 39 | + - task: Typecheck |
| 40 | + cmd: pytype -j auto . |
| 41 | + - task: Lint |
| 42 | + cmd: pylint --rcfile .pylintrc --recursive yes . |
| 43 | + - task: Yapf |
| 44 | + cmd: yapf . -drp |
| 45 | + - task: Test |
| 46 | + cmd: pytest |
13 | 47 | steps:
|
14 | 48 | - uses: actions/checkout@v3
|
15 |
| - - name: Set up Python ${{ matrix.python-version }} |
| 49 | + - name: Install Python With Cached pip Packages |
| 50 | + if: needs.Envvars.outputs.do_cache == '1' |
16 | 51 | uses: actions/setup-python@v3
|
17 | 52 | with:
|
18 | 53 | python-version: ${{ matrix.python-version }}
|
19 |
| - - name: Install dependencies |
20 |
| - run: | |
21 |
| - python -m pip install --upgrade pip |
22 |
| - pip install -r dev-requirements.txt |
23 |
| - pip install -r ./compiler_opt/benchmark/requirements.txt |
24 |
| - pylint --version |
25 |
| - - name: Type check |
26 |
| - run: | |
27 |
| - pytype -j auto . |
28 |
| - - name: Test |
29 |
| - run: | |
30 |
| - pytest |
31 |
| - - name: Lint |
32 |
| - run: | |
33 |
| - pylint --rcfile .pylintrc --recursive yes . |
34 |
| - - name: Check License Header |
35 |
| - run: | |
36 |
| - ./check-license.sh |
37 |
| - - name: yapf formatting check |
38 |
| - run: | |
39 |
| - yapf . -drp |
| 54 | + cache: 'pip' |
| 55 | + cache-dependency-path: '**/requirements*.txt' |
| 56 | + - name: Install Python, no cache |
| 57 | + if: needs.Envvars.outputs.do_cache == '0' |
| 58 | + uses: actions/setup-python@v3 |
| 59 | + with: |
| 60 | + python-version: ${{ matrix.python-version }} |
| 61 | + - run: pip install -r requirements-ci.txt -q |
| 62 | + - name: ${{ matrix.task }} |
| 63 | + run: ${{ matrix.cmd }} |
0 commit comments