pytorch-lightning
96 строк · 3.3 Кб
1name: Test Store
2
3# see: https://help.github.com/en/actions/reference/events-that-trigger-workflows
4on:
5push:
6branches: [master, "release/*"]
7pull_request:
8branches: [master, "release/*"]
9types: [opened, reopened, ready_for_review, synchronize] # added `ready_for_review` since draft is skipped
10paths:
11- ".actions/*"
12- "requirements/ci.txt"
13- "requirements/store/**"
14- "src/lightning/__init__.py"
15- "src/lightning/__setup__.py"
16- "src/lightning/__version__.py"
17- "src/lightning/store/**"
18- "tests/tests_store/**"
19- "pyproject.toml" # includes pytest config
20- ".github/workflows/ci-tests-store.yml"
21- "!requirements/*/docs.txt"
22- "!*.md"
23- "!**/*.md"
24
25concurrency:
26group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref }}
27cancel-in-progress: ${{ github.event_name == 'pull_request' }}
28
29defaults:
30run:
31shell: bash
32
33jobs:
34store-cpu:
35runs-on: ${{ matrix.os }}
36if: github.event.pull_request.draft == false
37strategy:
38fail-fast: false
39matrix:
40os: ["macOS-11", "ubuntu-20.04", "windows-2022"]
41pkg-name: ["lightning"]
42python-version: ["3.10"]
43pytorch-version: ["2.0"]
44timeout-minutes: 25 # because of building grpcio on Mac
45env:
46PACKAGE_NAME: ${{ matrix.pkg-name }}
47FREEZE_REQUIREMENTS: ${{ ! (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/heads/release/')) }}
48# PYPI_CACHE_DIR: "_pip-wheels"
49TORCH_URL_STABLE: "https://download.pytorch.org/whl/cpu/torch_stable.html"
50steps:
51- uses: actions/checkout@v4
52
53- name: Set up Python ${{ matrix.python-version }}
54uses: actions/setup-python@v5
55with:
56python-version: ${{ matrix.python-version }}
57
58- name: Adjust PyTorch versions in requirements files
59if: ${{ matrix.requires != 'oldest' && matrix.release != 'pre' }}
60run: |
61pip install -q -r requirements/ci.txt
62python -m wget https://raw.githubusercontent.com/Lightning-AI/utilities/main/scripts/adjust-torch-versions.py
63for fpath in `ls requirements/store/*.txt`; do \
64python ./adjust-torch-versions.py $fpath ${{ matrix.pytorch-version }}; \
65done
66
67- name: Install package & dependencies
68timeout-minutes: 20
69run: |
70pip install -e ".[store,store-test]" -U -f ${TORCH_URL} --prefer-binary
71pip list
72
73- name: Testing Store
74working-directory: tests/tests_store
75# NOTE: do not include coverage report here, see: https://github.com/nedbat/coveragepy/issues/1003
76run: |
77python -m coverage run --source lightning \
78-m pytest -v --timeout=60 --durations=60
79
80- name: Statistics
81if: success()
82working-directory: tests/tests_store
83run: |
84coverage report
85coverage xml
86
87- name: Upload coverage to Codecov
88uses: codecov/codecov-action@v4
89# see: https://github.com/actions/toolkit/issues/399
90continue-on-error: true
91with:
92token: ${{ secrets.CODECOV_TOKEN }}
93file: tests/tests_store/coverage.xml
94flags: lightning,cpu,pytest,python${{ matrix.python-version }}
95name: CPU-coverage
96fail_ci_if_error: false
97