|
| 1 | +name: Tests |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [main] |
| 6 | + pull_request: |
| 7 | + workflow_dispatch: |
| 8 | + |
| 9 | +env: |
| 10 | + FORCE_COLOR: "1" |
| 11 | + |
| 12 | +concurrency: |
| 13 | + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} |
| 14 | + cancel-in-progress: true |
| 15 | + |
| 16 | +jobs: |
| 17 | + lint: |
| 18 | + runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + |
| 21 | + - name: Check out the repository |
| 22 | + uses: actions/checkout@v4 |
| 23 | + with: |
| 24 | + fetch-depth: 0 |
| 25 | + |
| 26 | + - name: Set up Python 3.9 |
| 27 | + uses: actions/setup-python@v5 |
| 28 | + with: |
| 29 | + python-version: '3.9' |
| 30 | + cache: 'pip' |
| 31 | + |
| 32 | + - name: Upgrade nox and uv |
| 33 | + run: | |
| 34 | + python -m pip install --upgrade 'nox[uv]' |
| 35 | + nox --version |
| 36 | + uv --version |
| 37 | +
|
| 38 | + - name: Cache mypy |
| 39 | + uses: actions/cache@v4 |
| 40 | + with: |
| 41 | + path: .mypy_cache |
| 42 | + key: mypy-${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('pyproject.toml') }} |
| 43 | + |
| 44 | + - name: Cache pre-commit hooks |
| 45 | + uses: actions/cache@v4 |
| 46 | + with: |
| 47 | + path: ~/.cache/pre-commit |
| 48 | + key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }} |
| 49 | + |
| 50 | + - name: Lint code |
| 51 | + run: nox -s lint |
| 52 | + |
| 53 | + tests: |
| 54 | + timeout-minutes: 25 |
| 55 | + runs-on: ${{ matrix.os }} |
| 56 | + strategy: |
| 57 | + fail-fast: false |
| 58 | + matrix: |
| 59 | + os: [ubuntu-latest-8-cores] |
| 60 | + pyv: ['3.9', '3.10', '3.11', '3.12'] |
| 61 | + include: |
| 62 | + - os: macos-latest |
| 63 | + pyv: '3.9' |
| 64 | + - os: macos-latest |
| 65 | + pyv: '3.12' |
| 66 | + - os: windows-latest-8-cores |
| 67 | + pyv: '3.9' |
| 68 | + - os: windows-latest-8-cores |
| 69 | + pyv: '3.12' |
| 70 | + |
| 71 | + steps: |
| 72 | + |
| 73 | + # https://github.com/iterative/pytest-servers/pull/122 |
| 74 | + # https://github.com/abiosoft/colima/issues/468 |
| 75 | + # https://github.com/abiosoft/colima/blob/main/docs/FAQ.md#cannot-connect-to-the-docker-daemon-at-unixvarrundockersock-is-the-docker-daemon-running |
| 76 | + # colima v0.5.6 seems to run more stable than the latest - that has occasional network failures (ports are not open) |
| 77 | + # see: https://github.com/abiosoft/colima/issues/962 |
| 78 | + - name: Use colima as default docker host on MacOS |
| 79 | + if: runner.os == 'macOS' |
| 80 | + run: | |
| 81 | + brew install docker lima || true # avoid non-zero exit code if brew link fails |
| 82 | + sudo curl -L -o /usr/local/bin/colima https://github.com/abiosoft/colima/releases/download/v0.5.6/colima-Darwin-x86_64 |
| 83 | + sudo chmod +x /usr/local/bin/colima |
| 84 | + colima start |
| 85 | + sudo ln -vsf "${HOME}"/.colima/default/docker.sock /var/run/docker.sock |
| 86 | + env: |
| 87 | + HOMEBREW_NO_AUTO_UPDATE: true |
| 88 | + HOMEBREW_NO_INSTALL_CLEANUP: true |
| 89 | + HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: true |
| 90 | + HOMEBREW_NO_INSTALL_UPGRADE: true |
| 91 | + |
| 92 | + - name: Check out the repository |
| 93 | + uses: actions/checkout@v4 |
| 94 | + with: |
| 95 | + fetch-depth: 0 |
| 96 | + |
| 97 | + - name: Set up Python ${{ matrix.pyv }} |
| 98 | + uses: actions/setup-python@v5 |
| 99 | + with: |
| 100 | + python-version: ${{ matrix.pyv }} |
| 101 | + cache: 'pip' |
| 102 | + |
| 103 | + - name: Upgrade nox and uv |
| 104 | + run: | |
| 105 | + python -m pip install --upgrade 'nox[uv]' |
| 106 | + nox --version |
| 107 | + uv --version |
| 108 | +
|
| 109 | + - name: Skip flaky azure, gs remotes if unavailable on macos |
| 110 | + if: runner.os == 'macOS' |
| 111 | + run: echo 'DATACHAIN_TEST_SKIP_MISSING_REMOTES=azure,gs' >> "$GITHUB_ENV" |
| 112 | + |
| 113 | + - name: Run tests |
| 114 | + run: nox -s tests-${{ matrix.pyv }} |
| 115 | + |
| 116 | + - name: Upload coverage report |
| 117 | + uses: codecov/codecov-action@v4 |
| 118 | + with: |
| 119 | + token: ${{ secrets.CODECOV_TOKEN }} |
| 120 | + files: coverage.xml |
| 121 | + flags: datachain |
| 122 | + |
| 123 | + - name: Build package |
| 124 | + run: nox -s build |
| 125 | + |
| 126 | + - name: Build docs |
| 127 | + run: nox -s docs |
0 commit comments