name: Tests on: push: pull_request: release: types: [created] jobs: test: name: Test the code runs-on: ${{ matrix.os }} strategy: matrix: os: [windows-latest, ubuntu-latest] steps: - uses: actions/checkout@v2 - name: Set up Python 3.7 uses: actions/setup-python@v1 with: python-version: 3.7 - name: Get pip cache dir id: pip-cache run: | python -m pip install --upgrade pip setuptools echo "::set-output name=dir::$(pip cache dir)" - name: pip cache uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} restore-keys: | ${{ runner.os }}-pip- - name: Install dependencies run: | pip install tensorflow-cpu==2.10.0 pip install -e ".[tests]" --progress-bar off --upgrade - name: Build custom ops for tests run: | python build_deps/configure.py bazel build keras_cv/custom_ops:all cp bazel-bin/keras_cv/custom_ops/*.so keras_cv/custom_ops/ - name: Test with pytest env: TEST_CUSTOM_OPS: true run: | pytest keras_cv/ --ignore keras_cv/models format: name: Check the code format runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python 3.7 uses: actions/setup-python@v1 with: python-version: 3.7 - name: Get pip cache dir id: pip-cache run: | python -m pip install --upgrade pip setuptools echo "::set-output name=dir::$(pip cache dir)" - name: pip cache uses: actions/cache@v2 with: path: ${{ steps.pip-cache.outputs.dir }} key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }} restore-keys: | ${{ runner.os }}-pip- - name: Install dependencies run: | pip install tensorflow==2.10.0 pip install -e ".[tests]" --progress-bar off --upgrade - name: Lint run: bash shell/lint.sh deploy: needs: [test, format] if: github.event_name == 'release' && github.event.action == 'created' runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Python uses: actions/setup-python@v1 with: python-version: 3.7 - name: Install dependencies run: | pip install tensorflow==2.10.0 python -m pip install --upgrade pip setuptools wheel twine - name: Build and publish env: TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} run: | python setup.py sdist bdist_wheel twine upload dist/*