forked from keras-team/keras-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
107 lines (101 loc) · 3.45 KB
/
Copy pathactions.yml
File metadata and controls
107 lines (101 loc) · 3.45 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
name: Tests
on:
push:
pull_request:
workflow_call:
release:
types: [created]
permissions:
contents: read
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
run_tests:
name: Test the code
strategy:
fail-fast: false
matrix:
backend: [tensorflow, jax, torch]
version: [keras-stable]
include:
- backend: jax
version: keras-3.15
- backend: jax
version: keras-nightly
- backend: openvino
version: keras-nightly
container:
image: python:3.11-slim
runs-on: linux-x86-n2-16
timeout-minutes: 120
env:
KERAS_BACKEND: ${{ matrix.backend }}
steps:
- name: Install binary dependencies
# build-essential for C extensions (tokenizers, torch)
# curl, git, gnupg for checkout and other actions
run: |
apt-get update
apt-get -y install build-essential curl git gnupg
git config --global --add safe.directory '*'
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Install dependencies
run: |
pip install -r requirements.txt --progress-bar off
pip install --no-deps -e "." --progress-bar off
- name: Pin Keras 3.15
if: ${{ matrix.version == 'keras-3.15'}}
run: |
pip uninstall -y keras jaxlib jax
pip install keras==3.15.0 --progress-bar off
pip install jax==0.6.0 --progress-bar off
- name: Pin Keras Nightly
if: ${{ matrix.version == 'keras-nightly'}}
run: |
pip uninstall -y keras
pip install keras-nightly --no-cache-dir --progress-bar off
- name: Test with pytest
run: |
pytest keras_hub/ -n auto --dist loadfile --durations=50
- name: Run integration tests
run: |
python pip_build.py --install
cd integration_tests && pytest . -k "not NoTensorflow"
- name: Run no tensorflow integration test
if: ${{ matrix.backend != 'tensorflow'}}
run: |
pip uninstall -y tensorflow-text tensorflow
cd integration_tests && pytest . -k "NoTensorflow"
check_format:
name: Check the code format
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- name: Set up Python 3.11
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # v6
with:
python-version: '3.11'
- name: Get pip cache dir
id: pip-cache
run: |
python -m pip install --upgrade pip setuptools
echo "::set-output name=dir::$(pip cache dir)"
- name: pip cache
# zizmor: ignore[cache-poisoning]
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('requirements-common.txt') }}-${{ hashFiles('requirements.txt') }}-${{ hashFiles('pyproject.toml') }}
- name: Install dependencies
run: |
pip install -r requirements.txt --progress-bar off
pip install --no-deps -e "." --progress-bar off
- name: Install pre-commit
run: pip install pre-commit && pre-commit install
- name: Run pre-commit
run: pre-commit run --all-files --hook-stage manual