Skip to content

Commit

Permalink
Use Conda envs in all CI jobs (#368)
Browse files Browse the repository at this point in the history
## Description

<!-- Provide a brief description of the PR's purpose here. -->

We encountered an issue in #366 where different Python instances caused
swig to not be found. To prevent this and similar issues in the future,
this PR creates Conda envs to ensure that we always / are more likely to
use the correct version of Python.

## TODO

<!-- Notable points that this PR has either accomplished or will
accomplish. -->

## Questions

<!-- Any concerns or points of confusion? -->

- [x] Should we use Tox?
- For now, I believe Tox would introduce too much complexity. All we
want is to create a virtual env for each job. Tox may be able to do this
with less boilerplate, but we would also incur overhead to learn how to
use it properly. Conda envs also more closely match our audience of
researchers.
- Note that we did have Tox originally, but we removed it in #143 to
simplify our workflows.

## Status

- [x] I have read the guidelines in

[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [x] I have added a one-line description of my change to the changelog
in
      `HISTORY.md`
- [x] This PR is ready to go
  • Loading branch information
btjanaka committed Sep 10, 2023
1 parent 8a5be85 commit ae3db42
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 32 deletions.
48 changes: 16 additions & 32 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ on:
branches:
- master

defaults:
run:
# The default shell must be set like this so that bash will source the
# profile, which contains settings initialized by Conda:
# https://github.com/marketplace/actions/setup-miniconda#important
shell: bash -el {0}

jobs:
pre-commit:
runs-on: ubuntu-latest
Expand All @@ -19,9 +26,9 @@ jobs:
SKIP: pylint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: 3.11
python-version: "3.11"
- name: Install all deps and pylint (to be available to pre-commit)
run: pip install .[all] pylint
- uses: pre-commit/action@v3.0.0
Expand All @@ -42,12 +49,9 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install core deps
run: pip install .[dev]
- name: Test core
Expand All @@ -57,12 +61,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install core deps
run: pip install -r pinned_reqs/install.txt .[dev]
- name: Test core
Expand All @@ -80,12 +81,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install deps
run: pip install .[visualize,dev]
- name: Test coverage
Expand All @@ -100,12 +98,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install deps
run: pip install .[visualize,dev]
- name: Run benchmarks
Expand All @@ -122,10 +117,8 @@ jobs:
with:
python-version: 3.8
- name: Install deps
shell: bash -el {0}
run: pip install .[visualize]
- name: Test Examples
shell: bash -el {0}
run: bash tests/examples.sh
tutorials:
runs-on: ubuntu-latest
Expand All @@ -136,12 +129,9 @@ jobs:
run: sudo apt-get remove swig
# We use Python 3.10 instead of 3.8 here since Google Colab uses 3.10.
- uses: actions/checkout@v4
- name: Set up Python 3.10
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.10"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install deps
run: pip install .[visualize] jupyter nbconvert
- name: Test Tutorials
Expand All @@ -150,12 +140,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install deps
run: pip install .[visualize,dev]
- name: Build docs
Expand All @@ -166,12 +153,9 @@ jobs:
if: startsWith(github.ref, 'refs/tags')
steps:
- uses: actions/checkout@v4
- name: Set up Python 3.8
uses: actions/setup-python@v4
- uses: conda-incubator/setup-miniconda@v2
with:
python-version: "3.8"
- name: Upgrade pip
run: python -m pip install --upgrade pip
- name: Install dependencies
run: |
pip install -e .
Expand Down
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
- Refactor visualize module into multiple files ({pr}`357`)
- Add GitHub link roles in documentation ({pr}`361`)
- Refactor argument validation utilities ({pr}`365`)
- Use Conda envs in all CI jobs ({pr}`368`)

## 0.5.2

Expand Down

0 comments on commit ae3db42

Please sign in to comment.