Skip to content

Commit

Permalink
Update GitHub Actions Workflows (#1822)
Browse files Browse the repository at this point in the history
Summary:
- Update `checkout` and `python-setup` to v3 & v4, respectively.
- Create a new `reusable_test` workflow and use this everywhere unit tests are ran. This supports pinned and latest BoTorch, as well as minimal and full dependencies.
- Update the `reusable_tutorials` workflow to support both latest and pinned BoTorch.
- Create a `cron_pinned` workflow and update `cron` to run only latest BoTorch version. This should make nightly cron into a much higher signal workflow and prevent it from failing due to latest Ax diverging from pinned BoTorch.

Pull Request resolved: #1822

Reviewed By: Balandat

Differential Revision: D49028887

Pulled By: saitcakmak

fbshipit-source-id: 7426300da6724656dbcb0cf12c6b36a7cdd40838
  • Loading branch information
saitcakmak authored and facebook-github-bot committed Sep 6, 2023
1 parent 79c9705 commit 5dc443f
Show file tree
Hide file tree
Showing 7 changed files with 167 additions and 132 deletions.
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
68 changes: 68 additions & 0 deletions .github/workflows/reusable_test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
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"]
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: |
# The brackets returns '.[unittest_minimal]' if using minimal dependencies and '.[unittest]'
# otherwise. This saves us from needing 4 install dependencies blocks by supporting two
# different installation options in one line.
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

0 comments on commit 5dc443f

Please sign in to comment.