Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHub Actions Workflows #1822

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 8 additions & 32 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,43 +9,19 @@ on:

jobs:
tests-and-coverage:

runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
fail-fast: false

steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
env:
ALLOW_BOTORCH_LATEST: true
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
# use latest Botorch
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install git+https://github.com/pytorch/botorch.git
pip install -e ".[unittest]"
- name: Tests and coverage
run: |
pytest -ra --cov=ax
- name: Upload coverage
run: |
bash <(curl -s https://codecov.io/bash)
name: Tests with latest BoTorch
uses: ./.github/workflows/reusable_test.yml
with:
pinned_botorch: false

lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
Expand All @@ -70,9 +46,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
Expand Down
74 changes: 19 additions & 55 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,71 +13,35 @@ on:

jobs:

tests-and-coverage:

runs-on: ubuntu-latest
strategy:
matrix:
botorch: ['pinned', 'latest']
requirements: ['minimal', 'full']
fail-fast: false
tests-and-coverage-minimal:
name: Tests with latest BoTorch & minimal dependencies
uses: ./.github/workflows/reusable_test.yml
with:
pinned_botorch: false
minimal_dependencies: true

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies (full requirements, stable Botorch)
run: |
# will install the version of Botorch that is pinned in setup.py
pip install -e ".[unittest]"
if: matrix.botorch == 'pinned' && matrix.requirements == 'full'
- name: Install dependencies (minimal requirements, stable Botorch)
run: |
pip install -e ".[unittest_minimal]"
if: matrix.botorch == 'pinned' && matrix.requirements == 'minimal'
- name: Install dependencies (full requirements, Botorch main)
env:
ALLOW_BOTORCH_LATEST: true
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install git+https://github.com/pytorch/botorch.git
pip install -e ".[unittest]"
if: matrix.botorch == 'latest' && matrix.requirements == 'full'
- name: Install dependencies (minimal requirements, Botorch main)
env:
ALLOW_BOTORCH_LATEST: true
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install git+https://github.com/pytorch/botorch.git
pip install -e ".[unittest_minimal]"
if: matrix.botorch == 'latest' && matrix.requirements == 'minimal'
- name: Import Ax
run: |
python scripts/import_ax.py
- name: Tests
# run even if previous step (import Ax) failed
if: matrix.requirements == 'full'
run: |
pytest -ra
tests-and-coverage-full:
name: Tests with latest BoTorch & full dependencies
uses: ./.github/workflows/reusable_test.yml
with:
pinned_botorch: false
minimal_dependencies: false

build-tutorials-with-pinned-botorch:
name: Build tutorials with pinned BoTorch
build-tutorials:
name: Build tutorials with latest BoTorch
uses: ./.github/workflows/reusable_tutorials.yml
with:
smoke_test: false
pinned_botorch: false

publish-latest-website:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
Expand All @@ -100,11 +64,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Fetch all history for all tags and branches
run: git fetch --prune --unshallow
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
Expand Down
31 changes: 31 additions & 0 deletions .github/workflows/cron_pinned.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: Nightly Cron with Pinned BoTorch

on:
schedule:
# midnight EST
- cron: '0 5 * * *'
# allow this to be scheduled manually in addition to cron
workflow_dispatch:

jobs:

tests-and-coverage-minimal:
name: Tests with pinned BoTorch & minimal dependencies
uses: ./.github/workflows/reusable_test.yml
with:
pinned_botorch: true
minimal_dependencies: true

tests-and-coverage-full:
name: Tests with pinned BoTorch & full dependencies
uses: ./.github/workflows/reusable_test.yml
with:
pinned_botorch: true
minimal_dependencies: false

build-tutorials:
name: Build tutorials with pinned BoTorch
uses: ./.github/workflows/reusable_tutorials.yml
with:
smoke_test: false
pinned_botorch: true
55 changes: 16 additions & 39 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,50 +8,27 @@ on:
types: [created]

jobs:
tests-and-coverage:
tests-and-coverage-latest:
name: Tests with latest BoTorch
uses: ./.github/workflows/reusable_test.yml
with:
pinned_botorch: false

runs-on: ubuntu-latest
strategy:
matrix:
botorch: ['latest', 'pinned']

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.9"
- name: Install dependencies (latest Botorch)
env:
ALLOW_BOTORCH_LATEST: true
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
# use latest Botorch
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install git+https://github.com/pytorch/botorch.git
pip install -e ".[unittest]"
if: matrix.botorch == 'latest'
- name: Install dependencies (pinned Botorch)
run: |
# will install the version of Botorch that is pinned in setup.py
pip install -e ".[unittest]"
if: matrix.botorch == 'pinned'
- name: Import Ax
run: |
python scripts/import_ax.py
- name: Tests
run: |
pytest -ra
tests-and-coverage-pinned:
name: Tests with pinned BoTorch
uses: ./.github/workflows/reusable_test.yml
with:
pinned_botorch: true

publish-stable-website:

needs: tests-and-coverage # only run if test step succeeds
needs: tests-and-coverage-pinned # only run if test step succeeds
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
Expand All @@ -66,13 +43,13 @@ jobs:

deploy:

needs: tests-and-coverage # only run if test step succeeds
needs: tests-and-coverage-pinned # only run if test step succeeds
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
Expand Down
65 changes: 65 additions & 0 deletions .github/workflows/reusable_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Reusable Test Workflow

on:
workflow_dispatch:
inputs:
pinned_botorch:
required: true
type: boolean
minimal_dependencies:
required: false
type: boolean
default: false
workflow_call:
inputs:
pinned_botorch:
required: true
type: boolean
minimal_dependencies:
required: false
type: boolean
default: false

jobs:
tests-and-coverage:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.10"]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we start testing against 3.11 (here and in other places)? Botorch does...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should but this is currently blocked on pytorch/torchx#744

fail-fast: false

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

- if: ${{ inputs.pinned_botorch }}
name: Install dependencies with pinned BoTorch (minimal dependencies ${{ inputs.minimal_dependencies }})
run: |
pip install -e ${{ ((inputs.minimal_dependencies) && '.[unittest_minimal]') || '.[unittest]' }}

- if: ${{ !inputs.pinned_botorch }}
name: Install dependencies with latest BoTorch (minimal dependencies ${{ inputs.minimal_dependencies }})
env:
ALLOW_BOTORCH_LATEST: true
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install git+https://github.com/pytorch/botorch.git
pip install -e ${{ ((inputs.minimal_dependencies) && '.[unittest_minimal]') || '.[unittest]' }}

- name: Import Ax
run: |
python scripts/import_ax.py
- if: ${{ !inputs.minimal_dependencies }}
# Only run with full dependencies. Minimal does not include pytest.
name: Tests and coverage
run: |
pytest -ra --cov=ax
- if: ${{ !inputs.minimal_dependencies }}
# Using same condition as above since we need the coverage report for upload.
name: Upload coverage
run: |
bash <(curl -s https://codecov.io/bash)
26 changes: 22 additions & 4 deletions .github/workflows/reusable_tutorials.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,27 +6,45 @@ on:
smoke_test:
required: true
type: boolean
pinned_botorch:
required: true
type: boolean
workflow_call:
inputs:
smoke_test:
required: true
type: boolean
pinned_botorch:
required: true
type: boolean

jobs:

build-tutorials-with-pinned-botorch:
name: Tutorials with pinned BoTorch
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies

- if: ${{ inputs.pinned_botorch }}
name: Install dependencies with pinned BoTorch
run: |
# will install the version of Botorch that is pinned in setup.py
pip install -e ".[tutorial]"

- if: ${{ !inputs.pinned_botorch }}
name: Install dependencies with latest BoTorch
env:
ALLOW_BOTORCH_LATEST: true
ALLOW_LATEST_GPYTORCH_LINOP: true
run: |
pip install git+https://github.com/cornellius-gp/gpytorch.git
pip install git+https://github.com/pytorch/botorch.git
pip install -e ".[tutorial]"

- if: ${{ inputs.smoke_test }}
name: Build tutorials with smoke test
run: |
Expand Down
Loading