-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
73 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: Tests | ||
|
||
on: | ||
push: | ||
pull_request: | ||
schedule: | ||
- cron: '0 0 * * *' # every day at midnight | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.repository == 'slaclab/Badger' }} | ||
runs-on: ${{ matrix.os }} | ||
defaults: | ||
run: | ||
shell: bash | ||
strategy: | ||
max-parallel: 1 | ||
matrix: | ||
os: [ubuntu-latest, windows-latest, macos-latest] | ||
python-version: ["3.9", "3.11"] | ||
env: | ||
DISPLAY: ':99.0' | ||
QT_MAC_WANTS_LAYER: 1 # PyQT gui tests involving qtbot interaction on macOS will fail without this | ||
steps: | ||
- name: Setup Mambaforge | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
activate-environment: badger-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: badger-dev | ||
use-mamba: true | ||
python-version: ${{ matrix.python-version }} | ||
environment-file: environment.yml | ||
if: steps.cache.outputs.cache-hit != 'true' | ||
|
||
- name: Install Badger | ||
shell: bash -l {0} | ||
run: | | ||
pip uninstall -y badger-opt || true | ||
pip install --no-dependencies . | ||
- name: Run Tests | ||
shell: bash -l {0} | ||
run: | | ||
python scripts/run_tests.py |