Skip to content

Commit

Permalink
Fix: GitHub checks for PRs to rc branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ameyer-rigetti committed May 5, 2021
1 parent 01c9f3d commit f6d2479
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 66 deletions.
46 changes: 33 additions & 13 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Tests

on:
push:
branches: [ master ]
branches: [ master, rc ]
pull_request:
branches: [ master ]
branches: [ master, rc ]


workflow_dispatch:
Expand All @@ -19,12 +19,17 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.7'
- uses: actions/cache@v2
with:
path: .venv
key: poetry-${{ hashFiles('poetry.lock') }}
- name: Build and test the documentation
run: |
sudo apt update
sudo apt install pandoc
make install
make docs
. scripts/ci_install_deps
poetry run make docs
check-format:
name: Check formatting
runs-on: ubuntu-latest
Expand All @@ -34,11 +39,15 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.7'
- uses: actions/cache@v2
with:
path: .venv
key: poetry-${{ hashFiles('poetry.lock') }}
- name: Check format
run: |
sudo apt update
make requirements
make check-format
. scripts/ci_install_deps
poetry run make check-format
check-style:
name: Check style
runs-on: ubuntu-latest
Expand All @@ -48,11 +57,15 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.7'
- uses: actions/cache@v2
with:
path: .venv
key: poetry-${{ hashFiles('poetry.lock') }}
- name: Check style
run: |
sudo apt update
make requirements
make check-style
. scripts/ci_install_deps
poetry run make check-style
check-types:
name: Check types
runs-on: ubuntu-latest
Expand All @@ -62,11 +75,15 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: '3.7'
- uses: actions/cache@v2
with:
path: .venv
key: poetry-${{ hashFiles('poetry.lock') }}
- name: Check types
run: |
sudo apt update
make requirements
make check-types
. scripts/ci_install_deps
poetry run make check-types
test-pyquil:
name: Test pyQuil
runs-on: ubuntu-latest
Expand All @@ -79,11 +96,14 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: actions/cache@v2
with:
path: .venv
key: poetry-${{ hashFiles('poetry.lock') }}
- name: Test pyQuil (Python ${{ matrix.python-version }})
run: |
sudo apt update
make requirements
. scripts/ci_install_deps
docker run --rm -itd -p 5555:5555 rigetti/quilc -R
docker run --rm -itd -p 5000:5000 rigetti/qvm -S
make test
poetry run make test
97 changes: 45 additions & 52 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,6 @@ cache:
- .cache/pip
- .venv

.install-dependencies:
&install-dependencies # Recommended install method for Poetry: https://python-poetry.org/docs/
- curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
- source $HOME/.poetry/env
- poetry --version
- poetry config virtualenvs.in-project true
- poetry config experimental.new-installer false # Address flaky poetry installs, see: https://github.com/python-poetry/poetry/issues/3199
- poetry run python -m ensurepip --upgrade
- poetry install -vv

.install-dephell: &install-dephell # Install dephell to auto-generate setup.py
- curl -L dephell.org/install | python

Expand Down Expand Up @@ -62,56 +52,59 @@ services:
# EVERY-COMMIT JOBS
####################################################################################################

#Test Docs:
# stage: test
# script:
# - *install-dependencies
# - apt-get update && apt-get install -y pandoc
# - poetry run make docs
#
#Style:
# stage: test
# script:
# - *install-dependencies
# - poetry run make check-all
# rules:
# # Skip this job if it was triggered by a tag
# - if: "$CI_COMMIT_TAG"
# when: never
# - when: always
#
#Test (3.7):
# stage: test
# image: python:3.7
# coverage: '/TOTAL.*?(\d+)\%/'
# script:
# - *install-dependencies
# - poetry run make test
#
#Test (3.8):
# stage: test
# image: python:3.8
# coverage: '/TOTAL.*?(\d+)\%/'
# script:
# - *install-dependencies
# - poetry run make test
#
#Coverage:
# stage: test
# script:
# - *install-dependencies
# - poetry run make coverage
# allow_failure: true
Test Docs:
stage: test
script:
- . scripts/ci_install_deps
- apt-get update && apt-get install -y pandoc
- poetry run make docs

Style:
stage: test
script:
- . scripts/ci_install_deps
- poetry run make check-all
rules:
# Skip this job if it was triggered by a tag
- if: "$CI_COMMIT_TAG"
when: never
- when: always

Test (3.7):
stage: test
image: python:3.7
coverage: '/TOTAL.*?(\d+)\%/'
script:
- . scripts/ci_install_deps
- poetry run make test

Test (3.8):
stage: test
image: python:3.8
coverage: '/TOTAL.*?(\d+)\%/'
script:
- . scripts/ci_install_deps
- poetry run make test

Coverage:
stage: test
script:
- . scripts/ci_install_deps
- poetry run make coverage
allow_failure: true


####################################################################################################
# BRANCH-ONLY JOBS
####################################################################################################

# NOTE: Running this job requires the following env vars to be set when triggering:
# - GITHUB_TOKEN
# - TEST_PYPI_PASSWORD
PyPI Publish Branch (TestPyPI):
stage: deploy
script:
- *install-dependencies
- . scripts/ci_install_deps
- *install-dephell
- *install-npm
- npx semantic-release --branches $CI_COMMIT_BRANCH --dry-run
Expand All @@ -133,7 +126,7 @@ PyPI Publish Branch (TestPyPI):
.pypi-publish:
stage: deploy
script:
- *install-dependencies
- . scripts/ci_install_deps
- *install-dephell
- *install-npm
# This performs the semantic-release configured in package.json.
Expand Down
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ COMMIT_HASH=$(shell git rev-parse --short HEAD)
DEFAULT_QUILC_URL=tcp://localhost:5555
DEFAULT_QVM_URL=http://localhost:5000
DOCKER_TAG=rigetti/forest:$(COMMIT_HASH)
TWINE_REPOSITORY_URL=https://test.pypi.org/legacy/

.PHONY: all
all: dist
Expand Down
9 changes: 9 additions & 0 deletions scripts/ci_install_deps
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
. $HOME/.poetry/env
poetry --version
poetry config virtualenvs.in-project true
poetry config experimental.new-installer false # Address flaky poetry installs, see: https://github.com/python-poetry/poetry/issues/3199
poetry run python -m ensurepip --upgrade
poetry install -vv

0 comments on commit f6d2479

Please sign in to comment.