Updates workflows and adds pypi release yml #12
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: | |
pull_request: | |
push: | |
schedule: | |
# ┌───────────── minute (0 - 59) | |
# │ ┌───────────── hour (0 - 23) | |
# │ │ ┌───────────── day of the month (1 - 31) | |
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC) | |
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT) | |
# │ │ │ │ │ | |
- cron: '0 0 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
if: ${{ github.repository == 'xopt-org/Badger' }} | |
runs-on: ${{ matrix.os }} | |
defaults: | |
run: | |
shell: bash | |
strategy: | |
max-parallel: 1 | |
matrix: | |
os: [ubuntu-latest] # TODO: add windows and macos to matrix | |
python-version: ["3.9", "3.10", "3.11", "3.12"] | |
env: | |
DISPLAY: ':99.0' | |
QT_MAC_WANTS_LAYER: 1 # PyQT gui tests involving qtbot interaction on macOS will fail without this | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Miniforge | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
activate-environment: badger-dev | |
use-mamba: true | |
python-version: ${{ matrix.python-version }} | |
environment-file: env/environment.yml | |
# Have to install pyqt5 with pip | |
- name: Install pyqt5 | |
shell: bash -el {0} | |
run: | | |
pip install PyQt5 | |
# TODO: Have to install xopt with pip for now | |
# should put xopt>=2.1 in the environment.yml later | |
# to install xopt with conda | |
- name: Install Xopt v2.1+ | |
shell: bash -el {0} | |
run: | | |
conda install xopt -c conda-forge | |
# - name: Update environment | |
# shell: bash -l {0} | |
# run: | | |
# mamba install -n badger-dev python=${{ matrix.python-version }} | |
# | |
# - name: Install python packages | |
# shell: bash -el {0} | |
# run: | | |
# mamba install --file env/requirements.txt | |
- name: Install libs for testing a pyqt app on linux | |
shell: bash -el {0} | |
run: | | |
if [ "$RUNNER_OS" == "Linux" ]; then | |
sudo apt install xvfb herbstluftwm libxkbcommon-x11-0 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xinerama0 libxcb-xfixes0 x11-utils | |
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -screen 0 1024x768x24 -ac +extension GLX +render -noreset | |
sleep 3 | |
sudo /sbin/start-stop-daemon --start --pidfile /tmp/custom_herbstluftwm_99.pid --make-pidfile --background --exec /usr/bin/herbstluftwm | |
sleep 1 | |
fi | |
- name: Install Badger | |
shell: bash -l {0} | |
run: | | |
pip install . | |
- name: Run Tests | |
shell: bash -l {0} | |
run: | | |
python scripts/run_tests.py |