Skip to content

Commit

Permalink
Update CI worfklow actions & fix minor bug (#909)
Browse files Browse the repository at this point in the history
1) Update versions of actions like `checkout`
2) Define undefined variable `cirq-version` in ci.yml
3) Take advantage of pip cache offered by `setup-python`.
4) Support merge queues.
5) Require CI checks on pushes to master branch.
  • Loading branch information
mhucka authored Jan 30, 2025
1 parent 341d0d7 commit e95ea4f
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 20 deletions.
58 changes: 40 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,32 @@
name: Continuous Integration
on: [pull_request]

on:
pull_request:
types: [opened, synchronize]
branches:
- master

merge_group:
types:
- checks_requested

push:
branches:
- master

jobs:
format:
name: Format check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
cache: pip
- name: Install requirements
run: pip install -r dev_tools/requirements/envs/format.env.txt
- name: Format
Expand All @@ -21,11 +35,12 @@ jobs:
name: Type check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
cache: pip
- name: Install requirements
run: pip install -r dev_tools/requirements/envs/mypy.env.txt
- name: Type check
Expand All @@ -34,11 +49,12 @@ jobs:
name: Lint check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v1
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
architecture: 'x64'
cache: pip
- name: Install requirements
run: pip install -r dev_tools/requirements/envs/pylint.env.txt
- name: Lint
Expand All @@ -47,10 +63,11 @@ jobs:
name: Pytest max compat
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.8
cache: pip
- name: Install requirements
run: |
pip install -r dev_tools/requirements/max_compat/pytest-max-compat.env.txt
Expand All @@ -63,16 +80,18 @@ jobs:
strategy:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
cirq-version: [ 1.4.1 ]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: Install requirements
run: |
pip install -r dev_tools/requirements/envs/pytest.env.txt
pip install cirq-core${{matrix.cirq-version}}
pip install cirq-core==${{matrix.cirq-version}}
- name: Pytest check
run: check/pytest
shell: bash
Expand All @@ -82,30 +101,33 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]
cirq-version: [ 1.4.1 ]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: Install requirements
run: |
pip install -r dev_tools/requirements/envs/pytest-extra.env.txt
pip install cirq-core${{matrix.cirq-version}}
pip install cirq-core==${{matrix.cirq-version}}
- name: Pytest check resources
run: check/pytest -m 'not slow' src/openfermion/resource_estimates
shell: bash
coverage:
name: Coverage check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-python@v1
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
- name: Install requirements
run: pip install -r dev_tools/requirements/envs/pytest.env.txt
- name: Coverage check
run: check/pytest-and-incremental-coverage
run: check/pytest-and-incremental-coverage
5 changes: 3 additions & 2 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,11 @@ jobs:
python-version: [ '3.10' ]
fail-fast: false
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: pip
- name: Install requirements
run: |
pip install -r dev_tools/requirements/envs/pytest.env.txt
Expand Down

0 comments on commit e95ea4f

Please sign in to comment.