Add windows to CI #110
Workflow file for this run
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: tests | |
on: | |
push: | |
branches: [master, v2] | |
pull_request: | |
branches: [master, v2] | |
schedule: | |
# Run every Sunday | |
- cron: "0 0 * * 0" | |
workflow_dispatch: | |
jobs: | |
code-quality: | |
name: Code Quality | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: "3.10" | |
cache: "pip" | |
cache-dependency-path: | | |
pyproject.toml | |
dev-requirements.txt | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
make requirements | |
- name: Lint | |
run: | | |
make lint | |
tests: | |
name: Tests (${{ matrix.os }}, Python ${{ matrix.python-version }}) | |
needs: code-quality | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.7, 3.8, 3.9, "3.10", "3.11"] | |
defaults: | |
run: | |
shell: bash -el {0} | |
steps: | |
- uses: actions/checkout@v3 | |
# Even though we use setup-miniconda, this is still useful for pip caching | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v4 | |
with: | |
python-version: ${{ matrix.python-version }} | |
allow-prereleases: true | |
cache: "pip" | |
cache-dependency-path: | | |
pyproject.toml | |
dev-requirements.txt | |
- name: Cache conda packages | |
uses: actions/cache@v2 | |
env: | |
# Increase this value to reset cache explicitly | |
CACHE_NUMBER: 0 | |
with: | |
path: ~/conda_pkgs_dir | |
key: | |
${{ runner.os }}-conda-${{ env.CACHE_NUMBER }}-${{ | |
hashFiles('ccds/hook_utils/dependencies.py') }} | |
# Use mamba for faster environment resolution in conda tests | |
# regular conda takes 3x time | |
# micromamba does not work because it does not fully reproduce conda CLI's API | |
- uses: conda-incubator/setup-miniconda@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
miniforge-variant: Mambaforge | |
use-mamba: true | |
- name: Setup for Windows | |
if: ${{ matrix.os == 'windows-latest' }} | |
run: | | |
# Install GNU make | |
choco install --verbose make | |
# Add conda binaries directory to PATH so that conda is accessible | |
echo "${CONDA}\Scripts" >> $GITHUB_PATH | |
# Use mamba instead of conda | |
echo "CONDA_EXECUTABLE=mamba" >> "$GITHUB_ENV" | |
# Set bash executable explicitly since Make may pick wrong shell | |
echo "BASH_EXECUTABLE=$(which bash)" >> "$GITHUB_ENV" | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
make requirements | |
- name: Check dependencies | |
run: | | |
if [[ -z "${BASH_EXECUTABLE}" ]]; then | |
echo $BASH_EXECUTABLE | |
$BASH_EXECUTABLE --version | |
else | |
bash --version | |
fi | |
which make | |
make --version | |
if [[ -z "${BASH_EXECUTABLE}" ]]; then | |
which $CONDA_EXECUTABLE | |
$CONDA_EXECUTABLE --version | |
else | |
which conda | |
conda --version | |
fi | |
which pipenv | |
pipenv --version | |
which virtualenv | |
virtualenv --version | |
- name: Run tests | |
run: | | |
make test |