name: Tests on CPU (scheduled) on: push: branches: [main] paths-ignore: - 'docs/**' - '*.md' - 'LICENSE' - 'COPYRIGHT' schedule: - cron: '0 4 * * *' workflow_call: permissions: contents: read concurrency: group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: check-skip: # For scheduled runs, check if only documentation files changed # If so, skip the expensive test runs runs-on: ubuntu-latest outputs: should-skip: ${{ steps.check.outputs.should-skip }} steps: - name: Checkout repository uses: actions/checkout@v6 with: fetch-depth: 2 # Need at least 2 commits to compare - name: Check if only docs changed id: check run: | # For non-schedule events, always run tests if [[ "${{ github.event_name }}" != "schedule" ]]; then echo "should-skip=false" >> "$GITHUB_OUTPUT" echo "Not a scheduled run, will proceed with tests" exit 0 fi # For scheduled runs, check if only documentation files changed # Get the last commit on main LAST_COMMIT=$(git rev-parse HEAD) # Get list of changed files in the last commit CHANGED_FILES=$(git diff-tree --no-commit-id --name-only -r $LAST_COMMIT) # Check if all changed files are in paths-ignore patterns SHOULD_SKIP="true" for file in $CHANGED_FILES; do # Check if file matches any ignore pattern if [[ ! "$file" =~ ^docs/ ]] && \ [[ ! "$file" =~ \.md$ ]] && \ [[ "$file" != "LICENSE" ]] && \ [[ "$file" != "COPYRIGHT" ]]; then SHOULD_SKIP="false" break fi done echo "should-skip=$SHOULD_SKIP" >> "$GITHUB_OUTPUT" echo "Changed files: $CHANGED_FILES" echo "Should skip: $SHOULD_SKIP" pre-tests: runs-on: ubuntu-latest needs: [check-skip] if: needs.check-skip.outputs.should-skip == 'false' outputs: hash: ${{ steps.hashid.outputs.weights-hash }} steps: - name: Checkout repository uses: actions/checkout@v6 - name: Setup pixi uses: prefix-dev/setup-pixi@v0.9.6 with: pixi-version: v0.40.0 cache: true - uses: actions/cache@v5 id: cache-weights with: path: weights/ key: model-weights-${{ hashFiles('.github/download-models-weights.py') }} enableCrossOsArchive: true - name: Download models weights... if: steps.cache-weights.outputs.cache-hit != 'true' run: pixi run uv run python .github/download-models-weights.py -t weights/ - name: write hashid id: hashid run: echo "weights-hash=${{ hashFiles('.github/download-models-weights.py') }}" >> "$GITHUB_OUTPUT" tests-cpu-ubuntu: needs: [check-skip, pre-tests] if: needs.check-skip.outputs.should-skip == 'false' strategy: fail-fast: false matrix: pytorch-dtype: ["float32", "float64"] uses: ./.github/workflows/tests.yml with: os: "ubuntu-latest" python-version: '["3.11", "3.12", "3.13"]' pytorch-version: '["2.1.2", "2.2.2", "2.3.1", "2.4.0", "2.5.1", "2.9.1"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} cache-path: weights/ cache-key: model-weights-${{ needs.pre-tests.outputs.hash }} cache-restore-keys: | model-weights-${{ needs.pre-tests.outputs.hash }} model-weights- tests-cpu-windows: needs: [check-skip, pre-tests] if: needs.check-skip.outputs.should-skip == 'false' strategy: fail-fast: false matrix: pytorch-dtype: ["float32", "float64"] python-version: ["3.11", "3.12", "3.13"] pytorch-version: ["2.5.1", "2.9.1"] exclude: # PyTorch 2.5.1 doesn't have wheels for Python 3.13 on Windows - python-version: "3.13" pytorch-version: "2.5.1" uses: ./.github/workflows/tests.yml with: os: "windows-latest" python-version: '["${{ matrix.python-version }}"]' pytorch-version: '["${{ matrix.pytorch-version }}"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} cache-path: weights/ cache-key: model-weights-${{ needs.pre-tests.outputs.hash }} cache-restore-keys: | model-weights-${{ needs.pre-tests.outputs.hash }} model-weights- tests-cpu-mac: needs: [check-skip, pre-tests] if: needs.check-skip.outputs.should-skip == 'false' strategy: fail-fast: false matrix: pytorch-dtype: ["float32", "float64"] python-version: ["3.11", "3.12", "3.13"] pytorch-version: ["2.5.1", "2.9.1"] exclude: # PyTorch 2.5.1 doesn't have wheels for Python 3.13 on macOS - python-version: "3.13" pytorch-version: "2.5.1" # macOS only runs float32 tests - pytorch-dtype: "float64" uses: ./.github/workflows/tests.yml with: os: "macos-latest" python-version: '["${{ matrix.python-version }}"]' pytorch-version: '["${{ matrix.pytorch-version }}"]' pytorch-dtype: ${{ matrix.pytorch-dtype }} cache-path: weights/ cache-key: model-weights-${{ needs.pre-tests.outputs.hash }} cache-restore-keys: | model-weights-${{ needs.pre-tests.outputs.hash }} model-weights- coverage: needs: [check-skip, pre-tests] if: needs.check-skip.outputs.should-skip == 'false' uses: ./.github/workflows/coverage.yml with: cache-path: weights/ cache-key: model-weights-${{ needs.pre-tests.outputs.hash }} cache-restore-keys: | model-weights-${{ needs.pre-tests.outputs.hash }} model-weights- typing: needs: [check-skip] if: needs.check-skip.outputs.should-skip == 'false' uses: ./.github/workflows/typecheck.yml tutorials: needs: [check-skip] if: needs.check-skip.outputs.should-skip == 'false' uses: ./.github/workflows/tutorials.yml docs: needs: [check-skip, pre-tests] if: needs.check-skip.outputs.should-skip == 'false' uses: ./.github/workflows/docs.yml with: python-version: '["3.11"]' cache-path: weights/ cache-key: model-weights-${{ needs.pre-tests.outputs.hash }} cache-restore-keys: | model-weights-${{ needs.pre-tests.outputs.hash }} model-weights-