-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create LiteRT pre-submit CI to GitHub actions.
LITERT_OSS_REV_ID: 715149733
- Loading branch information
1 parent
912d1a1
commit ce7f531
Showing
2 changed files
with
129 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
name: "Presubmit" | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
permissions: | ||
contents: read | ||
actions: write | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
lint_and_typecheck: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 5 | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
- name: Install pre-commit | ||
run: python -m pip install pre-commit | ||
- uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0 | ||
with: | ||
path: ~/.cache/pre-commit | ||
key: pre-commit-${{ env.pythonLocation }}-${{ hashFiles('ci/setup_with_binary.py') }} | ||
- name: Run pre-commit | ||
run: | | ||
pre-commit run --show-diff-on-failure --color=always --all-files | ||
echo "Lint and type check errors found above, please fix." | ||
continue-on-failure: true | ||
|
||
build: | ||
# ie. presubmit (py 3.11 on ubuntu-latest) | ||
name: "presubmit (py ${{ matrix.docker-python-version }} on ubuntu-latest" | ||
strategy: | ||
matrix: | ||
docker-python-version: ['3.11'] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Init submodule | ||
run: | | ||
git submodule update --init --recursive | ||
- name: Update submodule by commit | ||
if: ${{ inputs.tensorflow-commit != '' }} | ||
run: | | ||
git submodule update --remote | ||
cd ./third_party/tensorflow | ||
TF_COMMIT="${{ inputs.tensorflow-commit }}" | ||
echo "checking out tensorflow-commit=${TF_COMMIT}" | ||
git checkout -q ${TF_COMMIT} | ||
- name: Test CL | ||
run: | | ||
cat tflite/python/metrics/metrics_nonportable.py | ||
- name: Update submodule with latest | ||
if: ${{ inputs.tensorflow-tag == '' }} | ||
run: | | ||
git submodule update --remote --recursive | ||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip setuptools | ||
python -m pip install build wheel numpy twine auditwheel | ||
python -m pip list | ||
- name: Test PR | ||
run: | | ||
echo "test, we need a pool rather than ubuntu-latest" | ||
exit 0 | ||
# export DOCKER_PYTHON_VERSION="${{ matrix.docker-python-version }}" | ||
# export EXPERIMENTAL_TARGETS_ONLY="true" | ||
# echo "docker python version: ${DOCKER_PYTHON_VERSION}" | ||
# ./ci/run_bazel_test_with_docker.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Install the pre-commit hooks below with | ||
# 'pre-commit install' | ||
|
||
# Auto-update the version of the hooks with | ||
# 'pre-commit autoupdate' | ||
|
||
# Run the hooks on all files with | ||
# 'pre-commit run --all' | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: 2c9f875913ee60ca25ce70243dc24d5b6415598c # frozen: v4.6.0 | ||
hooks: | ||
- id: check-ast | ||
- id: check-merge-conflict | ||
- id: check-toml | ||
- id: check-yaml | ||
- id: end-of-file-fixer | ||
# only include python files | ||
files: \.py$ | ||
- id: debug-statements | ||
# only include python files | ||
files: \.py$ | ||
- id: trailing-whitespace | ||
# only include python files | ||
files: \.py$ | ||
|
||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: 8983acb92ee4b01924893632cf90af926fa608f0 # frozen: v0.7.0 | ||
hooks: | ||
- id: ruff | ||
|
||
- repo: https://github.com/mwouts/jupytext | ||
rev: 8ed836db64ad5d304f2315e6bfd9049c9142e190 # frozen: v1.16.4 | ||
hooks: | ||
- id: jupytext | ||
files: docs/ | ||
args: [--sync] |