Skip to content

Tests

Tests #36

Workflow file for this run

name: Tests
on:
push:
pull_request:
schedule:
- cron: '0 0 * * *' # every day at midnight
jobs:
build:
runs-on: ${{ matrix.os }}
defaults:
run:
shell: bash
strategy:
max-parallel: 1
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.11"]
steps:
- name: Setup Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: xopt-dev
use-mamba: true
python-version: ${{ matrix.python-version }}
- uses: actions/checkout@v3
- name: Get Date
id: get-date
run: echo "today=$(/bin/date -u '+%Y%m%d')" >> $GITHUB_OUTPUT
shell: bash
- name: Cache Conda env
uses: actions/cache@v3
with:
path: ${{ env.CONDA }}/envs
key:
conda-${{ runner.os }}--${{ runner.arch }}--${{ github.workflow }}--${{
steps.get-date.outputs.today }}--${{
hashFiles('environment.yml') }}--${{ env.CACHE_NUMBER }}--${{ matrix.python-version }}
env:
CACHE_NUMBER: 0
id: cache
- name: Setup Mambaforge for real if not cached
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
activate-environment: xopt-dev
use-mamba: true
python-version: ${{ matrix.python-version }}
environment-file: environment.yml
if: steps.cache.outputs.cache-hit != 'true'
- name: Install Xopt
shell: bash -l {0}
run: |
pip uninstall -y xopt || true
pip install --no-dependencies .
- name: Run Tests
shell: bash -l {0}
run: |
python scripts/run_tests.py