Skip to content

Commit 6ff14fd

Browse files
Restore CI Workflow
I accidentally deleted the main CI workflow as a part of b4c1fed. This patch restores the CI workflow.
1 parent 41dfda9 commit 6ff14fd

File tree

1 file changed

+67
-0
lines changed

1 file changed

+67
-0
lines changed

.github/workflows/main.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: MLGO CI
4+
5+
on: [push, repository_dispatch, pull_request]
6+
7+
jobs:
8+
LicenseCheck:
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', '3.10']"
24+
_cache="1"
25+
else
26+
# 3.8 instead of '3.8' to make github act work.
27+
_ver="[3.8]"
28+
_cache="0"
29+
fi
30+
echo "version_matrix=$_ver" >> $GITHUB_OUTPUT
31+
echo "do_cache=$_cache" >> $GITHUB_OUTPUT
32+
Checks:
33+
runs-on: ubuntu-latest
34+
needs: [Envvars]
35+
strategy:
36+
matrix:
37+
python-version: ${{ fromJSON(needs.Envvars.outputs.version_matrix) }}
38+
task: [Typecheck, Lint, Yapf, Test]
39+
include:
40+
- task: Typecheck
41+
cmd: pytype -j auto --overriding-parameter-count-checks .
42+
- task: Lint
43+
cmd: pylint --rcfile .pylintrc --recursive yes .
44+
- task: Yapf
45+
cmd: yapf . -drp
46+
- task: Test
47+
cmd: pytest
48+
steps:
49+
- uses: actions/checkout@v3
50+
- name: Install Python With Cached pip Packages
51+
if: needs.Envvars.outputs.do_cache == '1'
52+
uses: actions/setup-python@v4
53+
with:
54+
python-version: ${{ matrix.python-version }}
55+
cache: 'pipenv'
56+
cache-dependency-path: Pipfile.lock
57+
- name: Install Python, no cache
58+
if: needs.Envvars.outputs.do_cache == '0'
59+
uses: actions/setup-python@v4
60+
with:
61+
python-version: ${{ matrix.python-version }}
62+
- name: Install Pipenv
63+
run: pip3 install pipenv
64+
- name: Install Python Dependencies
65+
run: pipenv sync --categories="packages dev-packages ci" --verbose
66+
- name: ${{ matrix.task }}
67+
run: pipenv run ${{ matrix.cmd }}

0 commit comments

Comments
 (0)