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