Skip to content

Commit

Permalink
add github files
Browse files Browse the repository at this point in the history
  • Loading branch information
yiweny committed Jul 11, 2024
1 parent 7ba6c4a commit c4f511f
Show file tree
Hide file tree
Showing 3 changed files with 113 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Setup

inputs:
python-version:
required: false
default: '3.8'
torch-version:
required: false
default: '2.2.0'
cuda-version:
required: false
default: cpu

runs:
using: composite

steps:
- name: Set up Python ${{ inputs.python-version }}
uses: actions/[email protected]
with:
python-version: ${{ inputs.python-version }}
check-latest: true
cache: pip
cache-dependency-path: |
pyproject.toml
- name: Install PyTorch ${{ inputs.torch-version }}+${{ inputs.cuda-version }}
if: ${{ inputs.torch-version != 'nightly' }}
run: |
pip install torch==${{ inputs.torch-version }} --extra-index-url https://download.pytorch.org/whl/${{ inputs.cuda-version }}
python -c "import torch; print('PyTorch:', torch.__version__)"
python -c "import torch; print('CUDA:', torch.version.cuda)"
shell: bash

- name: Install PyTorch ${{ inputs.torch-version }}+${{ inputs.cuda-version }}
if: ${{ inputs.torch-version == 'nightly' }}
run: |
pip install --pre torch --extra-index-url https://download.pytorch.org/whl/nightly/${{ inputs.cuda-version }}
python -c "import torch; print('PyTorch:', torch.__version__)"
python -c "import torch; print('CUDA:', torch.version.cuda)"
shell: bash
23 changes: 23 additions & 0 deletions .github/workflows/linting.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Linting

on: # yamllint disable-line rule:truthy
push:
branches:
- master
pull_request:

jobs:
mypy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Install dependencies
run: |
pip install -e '.[full,test]' -f https://download.pytorch.org/whl/cpu
- name: Check type hints
run: mypy
49 changes: 49 additions & 0 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Testing PyTorch 2.2

on: # yamllint disable-line rule:truthy
push:
branches:
- master
pull_request:

jobs:

pytest:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 40

# Skip workflow if only certain files have been changed.
- name: Get changed files
id: changed-files-specific
uses: tj-actions/changed-files@v41
with:
files: |
docs/**
examples/**
README.md
CHANGELOG.md
- name: Setup packages
if: steps.changed-files-specific.outputs.only_changed != 'true'
uses: ./.github/actions/setup

- name: Install main package
if: steps.changed-files-specific.outputs.only_changed != 'true'
run: |
pip install -e .[full,test]
- name: Run tests
if: steps.changed-files-specific.outputs.only_changed != 'true'
run: |
pytest --cov --cov-report=xml
- name: Upload coverage
if: steps.changed-files-specific.outputs.only_changed != 'true'
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: false

0 comments on commit c4f511f

Please sign in to comment.