Skip to content

Commit

Permalink
Add prerelease, cuda, macos, windows test workflows (#134)
Browse files Browse the repository at this point in the history
- Adds CUDA, macOS, and Windows test workflows that run on schedule,
manually, or by adding appropriate labels to a PR
- Separates prerelease tests into its own workflow that runs on schedule
  • Loading branch information
martinkim0 authored Feb 8, 2024
1 parent 6cf394e commit 886ca4f
Show file tree
Hide file tree
Showing 7 changed files with 338 additions and 22 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check Build
name: Build

on:
push:
Expand All @@ -14,11 +14,11 @@ jobs:
package:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: actions/checkout@v4
- name: Set up Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.11"
cache: "pip"
cache-dependency-path: "**/pyproject.toml"
- name: Install build dependencies
Expand Down
29 changes: 12 additions & 17 deletions .github/workflows/test.yaml → .github/workflows/test_linux.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
name: Test
name: Test (Linux)

on:
push:
branches: [main]
pull_request:
branches: [main]
schedule:
- cron: "0 5 1,15 * *"

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -22,26 +20,19 @@ jobs:
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
python: "3.9"
- os: ubuntu-latest
python: "3.11"
- os: ubuntu-latest
python: "3.11"
pip-flags: "--pre"
name: PRE-RELEASE DEPENDENCIES
os: [ubuntu-latest]
python: ["3.9", "3.10", "3.11"]

name: ${{ matrix.name }} Python ${{ matrix.python }}
name: Integration

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
Expand All @@ -50,9 +41,11 @@ jobs:
- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install ${{ matrix.pip-flags }} ".[dev,test]"
pip install --pre ".[dev,test]"
- name: Test
env:
MPLBACKEND: agg
Expand All @@ -64,4 +57,6 @@ jobs:
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
66 changes: 66 additions & 0 deletions .github/workflows/test_linux_cuda.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
name: Test (Linux, CUDA)

on:
pull_request:
branches: [main]
types: [labeled, synchronize, opened]
schedule:
- cron: "0 10 * * *" # runs at 10:00 UTC (03:00 PST) every day
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
# if PR has label "cuda tests" or "all tests" or if scheduled or manually triggered
if: >-
(
contains(github.event.pull_request.labels.*.name, 'cuda tests') ||
contains(github.event.pull_request.labels.*.name, 'all tests') ||
contains(github.event_name, 'schedule') ||
contains(github.event_name, 'workflow_dispatch')
)
runs-on: [self-hosted, Linux, X64, CUDA]
defaults:
run:
shell: bash -e {0} # -e to fail on error

strategy:
fail-fast: false
matrix:
python: ["3.11"]
cuda: ["11"]

container:
image: scverse/scvi-tools:py${{ matrix.python }}-cu${{ matrix.cuda }}-base
options: --user root --gpus all

name: Integration (CUDA)

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v4

- name: Install dependencies
run: |
pip install ".[dev,test]"
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
coverage run -m pytest -v --color=yes
- name: Report coverage
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
72 changes: 72 additions & 0 deletions .github/workflows/test_linux_pre.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Test (Linux, prereleases)

on:
pull_request:
branches: [main]
types: [labeled, synchronize, opened]
schedule:
- cron: "0 10 * * *" # runs at 10:00 UTC (03:00 PST) every day
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
# if PR has label "cuda tests" or "all tests" or if scheduled or manually triggered
if: >-
(
contains(github.event.pull_request.labels.*.name, 'prerelease tests') ||
contains(github.event.pull_request.labels.*.name, 'all tests') ||
contains(github.event_name, 'schedule') ||
contains(github.event_name, 'workflow_dispatch')
)
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -e {0} # -e to fail on error

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python: ["3.9", "3.10", "3.11", "3.12"]

name: Integration (Prereleases)

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install --pre ".[dev,test]"
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
coverage run -m pytest -v --color=yes
- name: Report coverage
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
61 changes: 61 additions & 0 deletions .github/workflows/test_macos.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test (MacOS)

on:
schedule:
- cron: "0 10 * * *" # runs at 10:00 UTC -> 03:00 PST every day
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -e {0} # -e to fail on error

strategy:
fail-fast: false
matrix:
os: [macos-latest]
python: ["3.9", "3.10", "3.11"]

name: Integration

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install ".[dev,test]"
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
coverage run -m pytest -v --color=yes
- name: Report coverage
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
61 changes: 61 additions & 0 deletions .github/workflows/test_macos_m1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Test (MacOS M1)

on:
schedule:
- cron: "0 10 * * *" # runs at 10:00 UTC -> 03:00 PST every day
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
test:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash -e {0} # -e to fail on error

strategy:
fail-fast: false
matrix:
os: [macos-14]
python: ["3.9", "3.10", "3.11"]

name: Integration

env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python }}

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: "pip"
cache-dependency-path: "**/pyproject.toml"

- name: Install test dependencies
run: |
python -m pip install --upgrade pip wheel
- name: Install dependencies
run: |
pip install ".[dev,test]"
- name: Test
env:
MPLBACKEND: agg
PLATFORM: ${{ matrix.os }}
DISPLAY: :42
run: |
coverage run -m pytest -v --color=yes
- name: Report coverage
run: |
coverage report
- name: Upload coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
Loading

0 comments on commit 886ca4f

Please sign in to comment.