diff --git a/.github/workflows/style.yaml b/.github/workflows/style.yaml new file mode 100644 index 000000000..a451ac89d --- /dev/null +++ b/.github/workflows/style.yaml @@ -0,0 +1,40 @@ +name: Check Code Style + +on: + workflow_dispatch: + pull_request: + branches: + - main + - dev + - update-workflows + push: + branches: + - main + - dev + - update-workflows + +jobs: + check-code-style: + name: Check Code Style + + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.10" + + - name: Install Ruff + run: | + pip install -U pip setuptools wheel + pip install ruff + + - name: Run Linter + run: ruff check --config pyproject.toml --verbose + + - name: Run Formatter + run: ruff format --config pyproject.toml --check --verbose diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 82bc493de..d9f63d604 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -1,5 +1,5 @@ -name: Tests +name: Multi-Backend Tests on: workflow_dispatch: @@ -7,99 +7,79 @@ on: branches: - main - dev + - update-workflows push: branches: - main - dev + - update-workflows +defaults: + run: + shell: bash -jobs: - lint: - runs-on: ubuntu-latest - defaults: - run: - shell: bash -el {0} - - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Set up Conda - uses: conda-incubator/setup-miniconda@v3 - with: - environment-file: environment.yaml - python-version: "3.10" - - - name: Show Environment Info - run: | - conda info - conda list - conda config --show-sources - conda config --show - printenv | sort - - - name: Run Linter - run: | - ruff check --config pyproject.toml --verbose - - - name: Run Formatter - run: | - ruff format --check --config pyproject.toml --verbose +jobs: test: - runs-on: ${{ matrix.os }} + name: Run Multi-Backend Tests + strategy: - fail-fast: false matrix: os: [ubuntu-latest, windows-latest] python-version: ["3.10", "3.11"] backend: ["jax", "tensorflow", "torch"] - defaults: - run: - shell: bash -el {0} + + runs-on: ${{ matrix.os }} + env: KERAS_BACKEND: ${{ matrix.backend }} steps: - - name: Checkout code + - name: Checkout Repository uses: actions/checkout@v4 - - name: Set up Conda - uses: conda-incubator/setup-miniconda@v3 + - name: Set up Python + uses: actions/setup-python@v5 with: - environment-file: environment.yaml python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + pip install -U pip setuptools wheel + pip install .[test] + - name: Install JAX if: ${{ matrix.backend == 'jax' }} run: | pip install -U jax - - name: Install NumPy - if: ${{ matrix.backend == 'numpy' }} - run: | - conda install numpy - - name: Install Tensorflow + + - name: Install TensorFlow if: ${{ matrix.backend == 'tensorflow' }} run: | pip install -U tensorflow + - name: Install PyTorch if: ${{ matrix.backend == 'torch' }} run: | - conda install pytorch torchvision torchaudio cpuonly -c pytorch + pip install -U torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cpu - name: Show Environment Info run: | - conda info - conda list - conda config --show-sources - conda config --show + python --version + pip --version printenv | sort - conda env export + pip list - name: Run Tests run: | pytest -x + - name: Upload test results to Codecov + if: ${{ !cancelled() }} + uses: codecov/codecov-action@v4 + with: + token: ${{ secrets.CODECOV_TOKEN }} + - name: Create Coverage Report run: | coverage xml