-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from YektaY/routine-refactor
ENH: Adds github actions support to routine refactor branch
- Loading branch information
Showing
7 changed files
with
139 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,14 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [master] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/setup-python@v3 | ||
- uses: pre-commit/[email protected] |
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,64 @@ | ||
# This workflow will install badger dependencies, lint with flake8, and run the test suite, for all combinations | ||
# of operating systems and version numbers specified in the matrix | ||
|
||
name: Build Status | ||
|
||
on: | ||
push: | ||
branches: [ "**" ] | ||
pull_request: | ||
branches: [ "**" ] | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
if: ${{ github.repository == 'slaclab/Badger' }} | ||
runs-on: ${{ matrix.os }} | ||
strategy: | ||
fail-fast: false | ||
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: | ||
- uses: actions/checkout@v3 | ||
- name: Setup conda | ||
uses: conda-incubator/setup-miniconda@v2 | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
miniforge-variant: Mambaforge | ||
miniforge-version: latest | ||
activate-environment: badger-env | ||
environment-file: environment-dev.yml | ||
- name: Install python packages | ||
shell: bash -el {0} | ||
run: | | ||
if [ "$RUNNER_OS" == "Windows" ]; then | ||
mamba install flake8 zipp | ||
mamba install --file requirements.txt --file windows-dev-requirements.txt | ||
else | ||
mamba install flake8 zipp $(cat requirements.txt dev-requirements.txt) | ||
fi | ||
- name: Install pyqt5 | ||
shell: bash -el {0} | ||
run: | | ||
pip install PyQt5 | ||
- name: Install packages 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: Test with pytest | ||
shell: bash -el {0} | ||
run: | | ||
python run_tests.py |
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,18 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.4.0 | ||
hooks: | ||
- id: end-of-file-fixer | ||
files: '\.(py|txt)$' # Only run on .py and .txt files | ||
- id: trailing-whitespace | ||
files: '\.(py|txt)$' # Only run on .py and .txt files | ||
- repo: https://github.com/psf/black | ||
rev: 23.7.0 | ||
hooks: | ||
- id: black | ||
args: [--line-length, '120'] | ||
- repo: https://github.com/astral-sh/ruff-pre-commit | ||
rev: v0.0.287 | ||
hooks: | ||
- id: ruff | ||
args: [--line-length, '120', --fix, --exit-non-zero-on-fix] |
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,5 @@ | ||
name: badger-env | ||
channels: | ||
- conda-forge | ||
- defaults | ||
- pytorch |
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,11 @@ | ||
pandas | ||
pyyaml | ||
coolname | ||
pyqtgraph | ||
qdarkstyle | ||
pillow | ||
requests | ||
tqdm | ||
xopt>=2.0.0 | ||
pytest | ||
pytest-qt |
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,21 @@ | ||
#!/usr/bin/env python | ||
import sys | ||
import pytest | ||
|
||
if __name__ == "__main__": | ||
# Show output results from every test function | ||
# Show the message output for skipped and expected failures | ||
args = ["-v", "-vrxs"] | ||
|
||
# Add extra arguments | ||
if len(sys.argv) > 1: | ||
args.extend(sys.argv[1:]) | ||
|
||
# Show coverage | ||
if "--show-cov" in args: | ||
args.extend(["--cov=badger", "--cov-report", "term-missing"]) | ||
args.remove("--show-cov") | ||
|
||
print("pytest arguments: {}".format(args)) | ||
|
||
sys.exit(pytest.main(args)) |
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,6 @@ | ||
pytorch | ||
codecov | ||
pytest>=3.6 | ||
pytest-qt | ||
pytest-cov | ||
pytest-timeout |