Merge pull request #211 from TileDB-Inc/kostastsitsimpikos/sc-33666/p… #1325
This file contains 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: TileDB-ML CI | |
on: [push] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
timeout-minutes: 60 | |
strategy: | |
fail-fast: false | |
matrix: | |
python-verison: ["3.7"] | |
ml-deps: | |
- "torch==1.11.0+cpu torchvision==0.12.0+cpu torchdata==0.3.0 tensorflow-cpu==2.8.1" | |
- "torch==1.12.1+cpu torchvision==0.13.1+cpu torchdata==0.4.1 tensorflow-cpu==2.9.1" | |
- "torch==1.13.0+cpu torchvision==0.14.0+cpu torchdata==0.5.0 tensorflow-cpu==2.10.0" | |
- "torch==1.13.0+cpu torchvision==0.14.0+cpu torchdata==0.5.0 tensorflow-cpu==2.11.0" | |
include: | |
- ml-deps: "torch==1.13.0+cpu torchvision==0.14.0+cpu torchdata==0.5.0 tensorflow-cpu==2.12.0" | |
python-version: "3.9" | |
- ml-deps: "torch==1.13.0+cpu torchvision==0.14.0+cpu torchdata==0.5.0 tensorflow-cpu==2.13.0" | |
python-version: "3.9" | |
env: | |
run_coverage: ${{ github.ref == 'refs/heads/master' }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}:ml-deps=[${{ matrix.ml-deps }}] | |
- name: Install dependencies | |
run: | | |
pip install --upgrade pip | |
pip install -f https://download.pytorch.org/whl/torch_stable.html protobuf==3.* ${{ matrix.ml-deps }} | |
pip install pytest-mock pytest-cov scikit-learn==1.0.2 | |
pip install -e .[cloud] | |
- name: Run pre-commit hooks | |
run: | | |
pip install pre-commit | |
pre-commit run -a | |
- name: Run notebook examples | |
run: | | |
pip install pytest-xdist nbmake matplotlib idx2numpy | |
pytest --disable-warnings --nbmake examples/{models,readers} | |
# Run tiledb-cloud in parallel | |
if [[ "${{ secrets.TILEDB_API_TOKEN }}" != "" ]]; then | |
TILEDB_API_TOKEN="${{ secrets.TILEDB_API_TOKEN }}" pytest --disable-warnings --nbmake -n3 examples/cloud | |
fi | |
- name: Run tests | |
if: ${{ !fromJSON(env.run_coverage) }} | |
run: pytest --disable-warnings tests/ | |
- name: Run test coverage statistics | |
id: stats | |
if: ${{ fromJSON(env.run_coverage) }} | |
run: | | |
pytest --disable-warnings --cov-report=term-missing --cov=tiledb tests/ > coverage.txt | |
cat coverage.txt | |
TEST_COVERAGE="$(grep '^TOTAL' coverage.txt | awk -v N=4 '{print $N}')" | |
echo "::set-output name=COVERAGE::$TEST_COVERAGE" | |
- name: Create Test Coverage Badge | |
if: ${{ fromJSON(env.run_coverage) }} | |
uses: schneegans/dynamic-badges-action@v1.1.0 | |
with: | |
auth: ${{ secrets.COVERAGE_SECRET }} | |
gistID: 2506f6c9d3375e2d636cf594340d11bf | |
filename: gistfile.json | |
label: Test Coverage | |
message: ${{ steps.stats.outputs.COVERAGE }} | |
color: green | |
namedLogo: pytest |