Updating the new layer sampling rule. It is hopefully finalized. It p… #1164
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
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions | |
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-python-with-github-actions | |
name: Build and run tests | |
on: | |
push: | |
branches-ignore: [ "beta" ] | |
# Hacky way to only run pull requests from forked repositories (assumes : is not used in branch names unless forked) | |
# https://github.saobby.my.eu.orgmunity/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662/10 | |
pull_request: | |
branches: [ "**:**" ] | |
# Allow running manually from Actions tab | |
workflow_dispatch: | |
env: | |
SKIP_DEAP: 1 | |
jobs: | |
build: # Main build + unit test check | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, windows-2019, macos-11] | |
python-version: [3.7, 3.8, 3.9, '3.10'] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up installation environment (Ubuntu or Windows) | |
if: ${{matrix.os == 'ubuntu-20.04' || matrix.os == 'windows-2019'}} | |
run: | | |
./.github/ci-scripts/before_install.sh | |
- name: Set up installation environment (MacOS) | |
if: ${{matrix.os == 'macos-11'}} | |
run: | | |
./.github/ci-scripts/before_install_macos.sh | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Cache pip packages | |
uses: actions/cache@v2 | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('setup.py') }}-${{ hashFiles('**/*requirements.txt') }} | |
- name: Install package | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel | |
python -m pip install flake8 | |
python -m pip install -e .[testing] | |
python setup.py build_ext --inplace | |
# python -m pip freeze # this isn't relevant anymore since pip install builds a wheel separately | |
- name: Lint with flake8 | |
if: ${{matrix.os != 'windows-2019'}} | |
run: | | |
# Critical errors, exit on failure | |
flake8 . --count --show-source --statistics --config=.flake8-critical | |
# Standard PEP8, allowed to fail since exit-zero treats all errors as warnings | |
flake8 . --exit-zero --statistics | |
- name: Run unit tests ubuntu | |
if: ${{matrix.os == 'ubuntu-20.04'}} | |
run: | | |
python -Ic "import pygsti; print(pygsti.__version__); print(pygsti.__path__)" | |
python -m pytest -n auto --cov=pygsti test/unit | |
- name: Run unit tests windows | |
if: ${{matrix.os == 'windows-2019'}} | |
run: | | |
python -Ic "import pygsti; print(pygsti.__version__); print(pygsti.__path__)" | |
python -m pytest -n auto --cov=pygsti test/unit | |
- name: Run unit tests MacOS | |
if: ${{matrix.os == 'macos-11'}} | |
run: | | |
python -Ic "import pygsti; print(pygsti.__version__); print(pygsti.__path__)" | |
python -m pytest -n auto --cov=pygsti test/unit | |
push: # Push to stable "beta" branch on successful build | |
runs-on: ubuntu-20.04 | |
# Only run on "develop" branch if tests pass | |
needs: build | |
if: github.ref == 'refs/heads/develop' && github.event_name == 'push' | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.PYGSTI_TOKEN }} | |
- name: Merge changes to beta branch | |
run: | | |
git config --global user.name 'PyGSTi' | |
git config --global user.email 'pygsti@noreply.github.com' | |
git checkout beta | |
git merge --ff-only ${GITHUB_SHA} && git push origin beta | |