Skip to content

Merge pull request #8 from fastmachinelearning/tutorials #37

Merge pull request #8 from fastmachinelearning/tutorials

Merge pull request #8 from fastmachinelearning/tutorials #37

Workflow file for this run

# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions
name: CI tests
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
jobs:
tests-tensorflow:
name: Tests (TensorFlow) - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/lib/android
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install hls4ml
pip install pytest pytest-cov
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .
- name: Show versions
run: |
python -m pip freeze | sort
python - <<'PY'
import keras, tensorflow as tf, numpy as np
print("keras", keras.__version__)
print("tensorflow", tf.__version__)
print("numpy", np.__version__)
PY
- name: Run tests
env:
KERAS_BACKEND: tensorflow
run: pytest tests/ --cov=qkeras --cov-report=xml
- name: Upload results to Codecov
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
tests-jax:
name: Tests (JAX) - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/lib/android
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install hls4ml
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .
- name: Show versions
run: |
python -m pip freeze | sort
python - <<'PY'
import keras, tensorflow as tf, numpy as np
print("keras", keras.__version__)
print("tensorflow", tf.__version__)
print("numpy", np.__version__)
PY
- name: Run tests
env:
KERAS_BACKEND: jax
run: pytest
tests-torch:
name: Tests (PyTorch) - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ["3.11", "3.12"]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Free disk space
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf /usr/local/lib/android
sudo apt-get clean
sudo rm -rf /var/lib/apt/lists/* /var/cache/apt/archives/*
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install hls4ml
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install .
- name: Show versions
run: |
python -m pip freeze | sort
python - <<'PY'
import keras, tensorflow as tf, numpy as np
print("keras", keras.__version__)
print("tensorflow", tf.__version__)
print("numpy", np.__version__)
PY
- name: Run tests
env:
KERAS_BACKEND: torch
run: pytest
# lint:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python 3.11
# uses: actions/setup-python@v5
# with:
# python-version: "3.11"
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# pip install ruff
# - name: Run Ruffl
# run: ruff check --output-format=github .
# examples:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python 3.11
# uses: actions/setup-python@v5
# with:
# python-version: "3.11"
# - name: Install dependencies
# run: |
# python -m pip install --upgrade pip
# if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
# pip install .
# - name: Run examples
# run: |
# for f in examples/*.py; do python "$f"; done
# notebooks:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - name: Set up Python
# uses: actions/setup-python@v5
# with:
# python-version: "3.11"
# - uses: yaananth/run-notebook@v2
# env:
# RUNNER: ${{ toJson(runner) }}
# SECRETS: ${{ toJson(secrets) }}
# GITHUB: ${{ toJson(github) }}
# with:
# notebook: "notebook/AutoQKeras.ipynb"
# isReport: False
# poll: True
# - uses: yaananth/run-notebook@v2
# env:
# RUNNER: ${{ toJson(runner) }}
# SECRETS: ${{ toJson(secrets) }}
# GITHUB: ${{ toJson(github) }}
# with:
# notebook: "notebook/CodebookQuantization.ipynb"
# isReport: False
# poll: True
# - uses: actions/upload-artifact@v4
# if: always()
# with:
# name: output
# path: ${{ RUNNER.temp }}/nb-runner
# env:
# RUNNER: ${{ toJson(runner) }}