Test the Windows CI on dev #1382
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 | |
CACHE_NUMBER: 0 # Increment to force cache invalidation | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get Date | |
id: get-date | |
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT | |
shell: bash | |
- name: Set Cache Path and Conda PATH | |
run: | | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
echo "CACHE_ENV_PATH=C:\\Users\\runneradmin\\miniconda3\\envs" >> $GITHUB_ENV | |
echo "C:\\Users\\runneradmin\\miniconda3\\condabin" >> $GITHUB_PATH | |
else | |
echo "CACHE_ENV_PATH=$HOME/miniconda3/envs" >> $GITHUB_ENV | |
echo "$HOME/miniconda3/bin" >> $GITHUB_PATH | |
fi | |
- name: Initialize Conda for Shell | |
run: | | |
if [[ "${{ runner.os }}" == "Windows" ]]; then | |
source C:\\Users\\runneradmin\\miniconda3\\etc\\profile.d\\conda.sh | |
else | |
eval "$(conda shell.bash hook)" | |
fi | |
conda --version | |
conda info | |
- 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: No cache found - Create new environment with Miniforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
use-mamba: true | |
environment-file: ${{ env.CONDA_FILE }} | |
activate-environment: cadet-process | |
channels: conda-forge | |
conda-remove-defaults: true | |
auto-activate-base: false | |
if: steps.restore-cache.outputs.cache-hit != 'true' | |
- name: Save Cache if not hit | |
uses: actions/cache/save@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 }} | |
if: steps.restore-cache.outputs.cache-hit != 'true' | |
- name: Install CADET-Process | |
run: | | |
conda activate cadet-process | |
pip install -e ./[testing] | |
- name: Check Python and run tests | |
run: | | |
PYTHON_VERSION=$(python --version | awk '{print $2}') | |
REQUIRED_VERSION="${{ matrix.python-version }}.*" | |
echo "Running on Python version: $PYTHON_VERSION" | |
echo "Required Python version: $REQUIRED_VERSION" | |
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__)" |