Skip to content

Commit

Permalink
Add github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
zhe-slac committed Dec 5, 2023
1 parent 25d988a commit cca9b84
Showing 1 changed file with 73 additions and 0 deletions.
73 changes: 73 additions & 0 deletions .github/workflows/ci.yml
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

0 comments on commit cca9b84

Please sign in to comment.