CI TensorFlow v2 #5561
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI TensorFlow v2 | |
| on: | |
| # Run on manual trigger | |
| workflow_dispatch: | |
| # Run on pull requests | |
| pull_request: | |
| paths-ignore: | |
| - '*.md' | |
| # Run on merge queue | |
| merge_group: | |
| # Run when pushing to main or dev branches | |
| push: | |
| branches: | |
| - main | |
| - dev* | |
| # Run scheduled CI flow daily | |
| schedule: | |
| - cron: '0 8 * * 0' | |
| jobs: | |
| test: | |
| runs-on: ubuntu-22.04 | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - name: TensorFlow 2.20.0 (Keras 3.11.2 Python 3.10) | |
| framework: tensorflow | |
| python: '3.10' | |
| tensorflow: 2.20.0 | |
| tf_version: v2 | |
| keras: 3.11.2 | |
| name: ${{ matrix.name }} | |
| steps: | |
| - name: Checkout Repo | |
| uses: actions/checkout@v5 | |
| - name: Setup Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Free up space | |
| run: | | |
| sudo rm -rf /usr/share/dotnet /opt/ghc /usr/local/lib/android | |
| sudo apt-get clean | |
| - name: Install Dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get -y -q install ffmpeg libavcodec-extra | |
| pip install -q -r <(sed '/^tensorflow/d;/^keras/d' requirements_test.txt) | |
| pip install tensorflow==${{ matrix.tensorflow }} | |
| pip install keras==${{ matrix.keras }} | |
| pip list | |
| - name: Cache CIFAR-10 dataset | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.art/data/cifar-10-batches-py | |
| key: cifar10-dataset-cache-v1 | |
| - name: Cache MNIST dataset | |
| uses: actions/cache@v4 | |
| with: | |
| path: ~/.art/data/mnist.npz | |
| key: mnist-dataset-cache-v1 | |
| - name: Download and extract CIFAR-10 if not cached | |
| run: | | |
| mkdir -p ~/.art/data | |
| if [ ! -d ~/.art/data/cifar-10-batches-py ]; then | |
| echo "Downloading CIFAR-10 dataset..." | |
| if curl -L -f -o cifar-10-python.tar.gz https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz; then | |
| echo "Downloaded from www.cs.toronto.edu" | |
| else | |
| echo "Primary download failed, trying Dropbox mirror..." | |
| curl -L -o cifar-10-python.tar.gz "https://www.dropbox.com/scl/fi/6mhiq4rtfszqrosasp8a9/cifar-10-batches-py.tar.gz?rlkey=g6v114un4je233j52tu5tdsbe&st=gxo2e50q&dl=1" | |
| fi | |
| tar -xzf cifar-10-python.tar.gz -C ~/.art/data/ | |
| else | |
| echo "CIFAR-10 already cached." | |
| fi | |
| - name: Download MNIST if not cached | |
| run: | | |
| mkdir -p ~/.art/data | |
| if [ ! -f ~/.art/data/mnist.npz ]; then | |
| echo "Downloading MNIST dataset..." | |
| curl -L -o ~/.art/data/mnist.npz https://s3.amazonaws.com/img-datasets/mnist.npz | |
| else | |
| echo "MNIST already cached." | |
| fi | |
| - name: Run Tests | |
| run: ./run_tests.sh ${{ matrix.framework }} | |
| - name: Upload coverage to Codecov | |
| uses: codecov/codecov-action@v5 | |
| with: | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| fail_ci_if_error: true |