Skip to content

Commit

Permalink
Rewrote to have consistent python/conda environments in workflows and…
Browse files Browse the repository at this point in the history
… for readability
  • Loading branch information
PrinceWalnut committed Nov 22, 2023
1 parent a9f920c commit 24c0e89
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 103 deletions.
48 changes: 23 additions & 25 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,32 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}

strategy:
matrix:
python-version: ['3.10']
os: [ubuntu-latest]

steps:
- name: Checkout source code
uses: actions/checkout@v3

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

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
use-only-tar-bz2: true
auto-update-conda: true
auto-activate-base: true
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""

- name: Source Miniconda
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
which python
python --version
echo $CONDA
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
python -m pip install --upgrade pip
conda list
- name: Build with tox
run: |
python -m pip install --upgrade pip
pip install tox
pip install tox-conda
tox -e build
Expand Down
46 changes: 26 additions & 20 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,40 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: [ubuntu-latest]

if: "!contains(github.event.head_commit.message, 'skip docs')"

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""

steps:
- uses: actions/checkout@v3

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""

- name: Source Miniconda
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
which python
python --version
echo $CONDA
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
python -m pip install --upgrade pip
conda list
- name: Install DIALS environment and more
run: |
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
conda install -n base -c conda-forge -y dials
conda info
conda list
$CONDA/bin/pip install -e ".[docs]"
pip install -e ".[docs]"
cd docs
conda list
export SPHINXBUILD="$CONDA/bin/sphinx-build"
make clean
make html
Expand All @@ -53,6 +58,7 @@ jobs:
touch .nojekyll
git add .nojekyll
git diff --quiet && git diff --staged --quiet || git commit -m "Upload documentation from latest commit"
- name: Push changes to gh-pages
uses: ad-m/github-push-action@master
with:
Expand Down
36 changes: 22 additions & 14 deletions .github/workflows/dev_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,29 @@ on:

jobs:
build:
runs-on: ${{ matrix.os }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3

strategy:
matrix:
python-version: ['3.10']
os: [ubuntu-latest]

steps:
- name: Checkout source code
uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""

- name: Source Miniconda
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
which python
python --version
echo $CONDA
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
python -m pip install --upgrade pip
conda list
- name: Build with tox
run: |
Expand Down
36 changes: 23 additions & 13 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,29 @@ on:

jobs:
format:
runs-on: ${{ matrix.os }}

strategy:
matrix:
python-version: ['3.10']
os: [ubuntu-latest]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""

- name: Source Miniconda
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
which python
python --version
echo $CONDA
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
python -m pip install --upgrade pip
conda list
- name: Format code with black
run: |
Expand Down
21 changes: 11 additions & 10 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,16 @@ jobs:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""
- name: Install DIALS environment and all dependencies

- name: Source Miniconda
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
Expand All @@ -26,25 +28,24 @@ jobs:
echo $CONDA
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
python -m pip install --upgrade pip
conda list
- name: Install DIALS environment and all dependencies
run: |
conda install -n base -c conda-forge -y dials
$CONDA/bin/pip install -e ".[docs]"
pip install -e ".[docs]"
cd docs
export SPHINXBUILD="$CONDA/bin/sphinx-build"
make clean
make html
which python
echo $CONDA
python -m pip install --upgrade pip
pip install -U setuptools setuptools_scm wheel packaging twine typing-extensions tox-conda myst-parser docutils
- name: Build the Python package
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
which python
echo $CONDA
conda list
tox -e build
tox -e docs
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
45 changes: 24 additions & 21 deletions .github/workflows/test_build_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,37 +8,40 @@ on:

jobs:
build:
runs-on: ubuntu-latest
runs-on: [ubuntu-latest]

if: "!contains(github.event.head_commit.message, 'skip docs')"

steps:
- uses: actions/checkout@v3
with:
ref: sphinx
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: 3.9

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""

steps:
- uses: actions/checkout@v3

- name: Install Miniconda
uses: conda-incubator/setup-miniconda@v2
with:
miniconda-version: "latest"
channels: conda-forge, defaults
auto-activate-base: true
activate-environment: ""

- name: Source Miniconda
run: |
source $CONDA/etc/profile.d/conda.sh
conda activate
which python
python --version
echo $CONDA
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
python -m pip install --upgrade pip
conda list
- name: Install DIALS environment and more
run: |
conda install -n base conda-libmamba-solver
conda config --set solver libmamba
conda install -n base -c conda-forge -y dials
conda info
conda list
$CONDA/bin/pip install -e ".[docs]"
cd docs
conda list
export SPHINXBUILD="$CONDA/bin/sphinx-build"
make clean
make html

0 comments on commit 24c0e89

Please sign in to comment.