|
1 | 1 |
|
2 | | -name: Tests |
| 2 | +name: Multi-Backend Tests |
3 | 3 |
|
4 | 4 | on: |
5 | 5 | workflow_dispatch: |
6 | 6 | pull_request: |
7 | 7 | branches: |
8 | 8 | - main |
9 | 9 | - dev |
| 10 | + - update-workflows |
10 | 11 | push: |
11 | 12 | branches: |
12 | 13 | - main |
13 | 14 | - dev |
| 15 | + - update-workflows |
14 | 16 |
|
| 17 | +defaults: |
| 18 | + run: |
| 19 | + shell: bash |
15 | 20 |
|
16 | | -jobs: |
17 | | - lint: |
18 | | - runs-on: ubuntu-latest |
19 | | - defaults: |
20 | | - run: |
21 | | - shell: bash -el {0} |
22 | | - |
23 | | - steps: |
24 | | - - name: Checkout code |
25 | | - uses: actions/checkout@v4 |
26 | | - |
27 | | - - name: Set up Conda |
28 | | - uses: conda-incubator/setup-miniconda@v3 |
29 | | - with: |
30 | | - environment-file: environment.yaml |
31 | | - python-version: "3.10" |
32 | | - |
33 | | - - name: Show Environment Info |
34 | | - run: | |
35 | | - conda info |
36 | | - conda list |
37 | | - conda config --show-sources |
38 | | - conda config --show |
39 | | - printenv | sort |
40 | | -
|
41 | | - - name: Run Linter |
42 | | - run: | |
43 | | - ruff check --config pyproject.toml --verbose |
44 | | -
|
45 | | - - name: Run Formatter |
46 | | - run: | |
47 | | - ruff format --check --config pyproject.toml --verbose |
48 | 21 |
|
| 22 | +jobs: |
49 | 23 | test: |
50 | | - runs-on: ${{ matrix.os }} |
| 24 | + name: Run Multi-Backend Tests |
| 25 | + |
51 | 26 | strategy: |
52 | | - fail-fast: false |
53 | 27 | matrix: |
54 | 28 | os: [ubuntu-latest, windows-latest] |
55 | 29 | python-version: ["3.10", "3.11"] |
56 | 30 | backend: ["jax", "tensorflow", "torch"] |
57 | | - defaults: |
58 | | - run: |
59 | | - shell: bash -el {0} |
| 31 | + |
| 32 | + runs-on: ${{ matrix.os }} |
| 33 | + |
60 | 34 | env: |
61 | 35 | KERAS_BACKEND: ${{ matrix.backend }} |
62 | 36 |
|
63 | 37 | steps: |
64 | | - - name: Checkout code |
| 38 | + - name: Checkout Repository |
65 | 39 | uses: actions/checkout@v4 |
66 | 40 |
|
67 | | - - name: Set up Conda |
68 | | - uses: conda-incubator/setup-miniconda@v3 |
| 41 | + - name: Set up Python |
| 42 | + uses: actions/setup-python@v5 |
69 | 43 | with: |
70 | | - environment-file: environment.yaml |
71 | 44 | python-version: ${{ matrix.python-version }} |
72 | 45 |
|
| 46 | + - name: Install Dependencies |
| 47 | + run: | |
| 48 | + pip install -U pip setuptools wheel |
| 49 | + pip install .[test] |
| 50 | +
|
73 | 51 | - name: Install JAX |
74 | 52 | if: ${{ matrix.backend == 'jax' }} |
75 | 53 | run: | |
76 | 54 | pip install -U jax |
77 | | - - name: Install NumPy |
78 | | - if: ${{ matrix.backend == 'numpy' }} |
79 | | - run: | |
80 | | - conda install numpy |
81 | | - - name: Install Tensorflow |
| 55 | +
|
| 56 | + - name: Install TensorFlow |
82 | 57 | if: ${{ matrix.backend == 'tensorflow' }} |
83 | 58 | run: | |
84 | 59 | pip install -U tensorflow |
| 60 | +
|
85 | 61 | - name: Install PyTorch |
86 | 62 | if: ${{ matrix.backend == 'torch' }} |
87 | 63 | run: | |
88 | | - conda install pytorch torchvision torchaudio cpuonly -c pytorch |
| 64 | + pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu |
89 | 65 |
|
90 | 66 | - name: Show Environment Info |
91 | 67 | run: | |
92 | | - conda info |
93 | | - conda list |
94 | | - conda config --show-sources |
95 | | - conda config --show |
| 68 | + python --version |
| 69 | + pip --version |
96 | 70 | printenv | sort |
97 | | - conda env export |
| 71 | + pip list |
98 | 72 |
|
99 | 73 | - name: Run Tests |
100 | 74 | run: | |
101 | 75 | pytest -x |
102 | 76 |
|
| 77 | + - name: Upload test results to Codecov |
| 78 | + if: ${{ !cancelled() }} |
| 79 | + uses: codecov/codecov-action@v4 |
| 80 | + with: |
| 81 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 82 | + |
103 | 83 | - name: Create Coverage Report |
104 | 84 | run: | |
105 | 85 | coverage xml |
|
0 commit comments