Test the Windows CI on dev #1391
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: pipeline | |
on: | |
push: | |
branches: | |
- master | |
- dev | |
- test_ci | |
pull_request: | |
jobs: | |
test-job: | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash -l {0} | |
strategy: | |
matrix: | |
# os: [ubuntu-latest] | |
# python-version: ["3.10", "3.11", "3.12"] | |
include: | |
- os: windows-latest | |
python-version: "3.12" | |
# - os: macos-13 | |
# python-version: "3.12" | |
env: | |
CONDA_FILE: environment.yml | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
- name: Set Cache Path and Conda PATH | |
run: | | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
echo "CACHE_ENV_PATH=C:\\Users\\runneradmin\\miniconda3" >> $GITHUB_ENV | |
else | |
echo "CACHE_ENV_PATH=$HOME/miniconda3" >> $GITHUB_ENV | |
fi | |
- name: Restore cache | |
uses: actions/cache/restore@v4 | |
with: | |
path: ${{env.CACHE_ENV_PATH}} | |
key: ${{ matrix.os }}-python_${{ matrix.python-version }}-${{ steps.get-date.outputs.today }}-${{ hashFiles(env.CONDA_FILE) }}-${{ env.CACHE_NUMBER }} | |
id: restore-cache | |
- name: Setup Conda Environment | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
use-mamba: true | |
activate-environment: cadet-process | |
channels: conda-forge | |
- name: Cache conda | |
uses: actions/cache@v4 | |
env: | |
# Increase this value to reset cache if environment.yml has not changed | |
CACHE_NUMBER: 0 | |
with: | |
path: ${{ env.CONDA }}/envs | |
key: ${{ matrix.os }}-python_${{ matrix.python-version }}-${{ steps.get-date.outputs.today }}-${{ hashFiles(env.CONDA_FILE) }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update Environment (Windows) | |
run: | | |
call "C:\Users\runneradmin\miniconda3\condabin\conda.bat" | |
conda activate cadet-process | |
mamba install python=${{ matrix.python-version }} | |
echo "python=${{ matrix.python-version }}.*" > %CONDA_PREFIX%\conda-meta\pinned | |
mamba env update -n cadet-process -f %CONDA_FILE% | |
where python | |
python --version | |
shell: cmd /C call {0} | |
- name: Install (Windows) | |
run: | | |
call "C:\Users\runneradmin\miniconda3\condabin\conda.bat" | |
conda activate cadet-process | |
pip install -e ./[testing] | |
shell: cmd /C call {0} | |
- name: Run Tests (Windows) | |
run: | | |
call "C:\Users\runneradmin\miniconda3\condabin\conda.bat" | |
conda activate cadet-process | |
python -m unittest discover -s tests | |
shell: cmd /C call {0} | |
- name: Test | |
run: | | |
python -m unittest discover -s tests | |
- name: Install pypa/build | |
run: | | |
python -m pip install build --user | |
- name: Build binary wheel and source tarball | |
run: | | |
python -m build --sdist --wheel --outdir dist/ . | |
- name: Test Wheel install and import | |
run: | | |
python -c "import CADETProcess; print(CADETProcess.__version__)" |