Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce redundant tests & overheads for CI #319

Merged
merged 44 commits into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
29fa4ee
Reduce tests for MacOS x86
mlxd Jul 27, 2022
f9f0a5e
Auto update version
chaeyeunpark Jul 27, 2022
1673d3f
Fix yaml
mlxd Jul 27, 2022
2a01f53
Merge branch 'reduce_test_set' of github.com:PennyLaneAI/pennylane-li…
mlxd Jul 27, 2022
260ba18
Overcome limitations of matrix and job by conditional selection fo bu…
mlxd Jul 27, 2022
40ed141
Update MacOS x86 runner to MacOS 11
mlxd Jul 27, 2022
1c53f37
Output conditional data
mlxd Jul 27, 2022
e98ad33
More info
mlxd Jul 27, 2022
7af76d8
More info
mlxd Jul 27, 2022
0ef3759
More info
mlxd Jul 27, 2022
4ee6633
Fix generate version string for MacOS matrix
mlxd Jul 27, 2022
bd985a2
Fix yaml
mlxd Jul 27, 2022
bacedfa
Fix yaml
mlxd Jul 27, 2022
6d1c7e4
Fix yaml
mlxd Jul 27, 2022
f4e3a8a
Fix yaml
mlxd Jul 27, 2022
da800ea
Fix yaml
mlxd Jul 27, 2022
ad541b1
Trigger CI
mlxd Jul 27, 2022
2d1b0f1
Forcibly use Py3 on CI
mlxd Jul 27, 2022
ee1d0e0
Fix Py version string
mlxd Jul 27, 2022
b6aad92
Fix yaml
mlxd Jul 27, 2022
0e12737
Fix yaml
mlxd Jul 27, 2022
67b8e92
Fix yaml
mlxd Jul 27, 2022
68f2336
Fix yaml
mlxd Jul 27, 2022
2e218b0
Fix yaml
mlxd Jul 27, 2022
2a9654b
More fixes
mlxd Jul 27, 2022
420e383
More fixes
mlxd Jul 27, 2022
bd8bb49
Attempt to escape string in Python
mlxd Jul 27, 2022
437df9b
Refactor json output
mlxd Jul 27, 2022
a3f1492
More fixes
mlxd Jul 27, 2022
0908b07
Attempt to fix parsing errors in JSON
mlxd Jul 27, 2022
8ba71b4
Process within steps rather than external
mlxd Jul 28, 2022
bbcde73
More fixes
mlxd Jul 28, 2022
80a947b
Update all wheels to selectively use extrama in PR tests
mlxd Jul 28, 2022
9a8f1d6
MacOS x86 on master only, and fix Win Py versioning
mlxd Jul 28, 2022
513dde2
Fix Win Py versioning
mlxd Jul 28, 2022
4d8bb1e
Merge branch 'master' into reduce_test_set
mlxd Jul 28, 2022
853b2dc
Auto update version
chaeyeunpark Jul 28, 2022
7f11698
Update changelog [skip ci]
mlxd Jul 28, 2022
73686a7
Merge branch 'reduce_test_set' of github.com:PennyLaneAI/pennylane-li…
mlxd Jul 28, 2022
cf50496
Update changelog [skip ci]
mlxd Jul 28, 2022
77a7ed6
Fix yaml formatting
mlxd Jul 28, 2022
03d3d92
Merge branch 'master' into reduce_test_set
mlxd Aug 3, 2022
8e91a64
Auto update version
chaeyeunpark Aug 3, 2022
d68aafe
Add missing docstring
mlxd Aug 3, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@

### Improvements

* CI builders use a reduced set of resources and redundant tests for PRs
[(#319)](https://github.com/PennyLaneAI/pennylane-lightning/pull/319)

* Parallelize wheel-builds where applicable.
[(#314)](https://github.com/PennyLaneAI/pennylane-lightning/pull/314)

Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/benchmarks.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Benchmarking
on:
pull_request:
push:
branches:
- master

jobs:
benchmarks:
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/gen_pyver_matrix.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import argparse
import re
import json


def version_map(py_ver: str):
r"""Auxiliary function to map the Python version number to the format accepted by CIBuildWheel wheel-builder actions.
Args:
py_ver (str): Python version number in 'major.minor' format.
Returns:
str: Python version in cp'major.minor'-* format.
"""
ci_ver = re.sub("\.", "", py_ver)
return f"cp{ci_ver}-*"


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument(
"--min-version",
dest="min",
type=str,
required=True,
help="Minimum Python version supported",
)
parser.add_argument(
"--max-version",
dest="max",
type=str,
required=True,
help="Maximum Python version supported",
)
parser.add_argument(
"--range",
dest="range",
required=False,
action="store_true",
help="Include all Python values between the extrema",
)

args = parser.parse_args()

v_minor_min = int(args.min.split(".")[-1])
v_minor_max = int(args.max.split(".")[-1])

out_range = range(v_minor_min, v_minor_max + 1) if args.range else [v_minor_min, v_minor_max]
output_list = []

for v in out_range:
v_str = f"3.{v}"
output_list.append((version_map(v_str)))

json_out = json.dumps(output_list)

print(json_out)
34 changes: 33 additions & 1 deletion .github/workflows/wheel_linux_aarch64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,46 @@ on:
release:
types: [published]

env:
PYTHON3_MIN_VERSION: "7"
PYTHON3_MAX_VERSION: "10"

jobs:
linux-set-matrix-aarch64:
name: Set builder matrix versions
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- id: pyver
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }})"
else
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }} \
--range)"
fi
outputs:
matrix: ${{ steps.pyver.outputs.matrix }}

linux-wheels-aarch64:
needs: [linux-set-matrix-aarch64]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [aarch64]
cibw_build: [cp37-*, cp38-*, cp39-*, cp310-*]
cibw_build: ${{fromJson(needs.linux-set-matrix-aarch64.outputs.matrix)}}

name: ubuntu-latest::aarch64 (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}
Expand Down
36 changes: 34 additions & 2 deletions .github/workflows/wheel_linux_ppc64le.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,46 @@ on:
release:
types: [published]

env:
PYTHON3_MIN_VERSION: "7"
PYTHON3_MAX_VERSION: "10"

jobs:
linux-wheels-ppc64le:
linux-set-matrix-ppc64le:
name: Set builder matrix versions
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- id: pyver
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }})"
else
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }} \
--range)"
fi
outputs:
matrix: ${{ steps.pyver.outputs.matrix }}

linux-wheels-ppc64le:
needs: [linux-set-matrix-ppc64le]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [ppc64le]
cibw_build: [cp37-*, cp38-*, cp39-*, cp310-*]
cibw_build: ${{fromJson(needs.linux-set-matrix-ppc64le.outputs.matrix)}}

name: ubuntu-latest::ppc64le (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}
Expand Down
34 changes: 33 additions & 1 deletion .github/workflows/wheel_linux_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,46 @@ on:
release:
types: [published]

env:
PYTHON3_MIN_VERSION: "7"
PYTHON3_MAX_VERSION: "10"

jobs:
linux-set-matrix-x86_64:
name: Set builder matrix versions
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- id: pyver
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }})"
else
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }} \
--range)"
fi
outputs:
matrix: ${{ steps.pyver.outputs.matrix }}

linux-wheels-x86-64:
needs: [linux-set-matrix-x86_64]
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
arch: [x86_64]
cibw_build: [cp37-*, cp38-*, cp39-*, cp310-*]
cibw_build: ${{fromJson(needs.linux-set-matrix-x86_64.outputs.matrix)}}

name: ${{ matrix.os }} (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}
Expand Down
36 changes: 33 additions & 3 deletions .github/workflows/wheel_macos_arm64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,47 @@ on:

env:
ARCHS: 'arm64'
PYTHON3_MIN_VERSION: "8"
PYTHON3_MAX_VERSION: "10"

jobs:
mac-set-matrix-arm:
name: Set builder matrix versions
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- id: pyver
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }})"
else
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }} \
--range)"
fi
outputs:
matrix: ${{ steps.pyver.outputs.matrix }}

mac-wheels-arm64:
needs: [mac-set-matrix-arm]
strategy:
fail-fast: false
matrix:
os: [macos-11]
arch: [arm64]
cibw_build: [cp38-*, cp39-*, cp310-*]
cibw_build: ${{fromJson(needs.mac-set-matrix-arm.outputs.matrix)}}

name: macos-latest::arm64 (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }})
name: macos-latest::arm64 (Python ${{ fromJson('{ "cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -39,7 +69,7 @@ jobs:
- uses: actions/setup-python@v2
name: Install Python
with:
python-version: '3.7'
python-version: '3.8'

- name: Install cibuildwheel
run: python -m pip install cibuildwheel==2.3.0
Expand Down
38 changes: 34 additions & 4 deletions .github/workflows/wheel_macos_x86_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ name: Wheel::MacOS::Intel
# **Who does it impact**: Wheels to be uploaded to PyPI.

on:
pull_request:
push:
branches:
- master
Expand All @@ -15,15 +14,45 @@ on:

env:
MACOSX_DEPLOYMENT_TARGET: 10.15
PYTHON3_MIN_VERSION: "7"
PYTHON3_MAX_VERSION: "10"

jobs:
mac-set-matrix-x86:
name: Set builder matrix versions
runs-on: ubuntu-latest

steps:
- name: Cancel Previous Runs
uses: styfle/[email protected]
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v2

- id: pyver
run: |
if [[ ${{ github.event_name }} == 'pull_request' ]]; then
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }})"
else
echo "::set-output name=matrix::$(python3 .github/workflows/gen_pyver_matrix.py \
--min-version=3.${{ env.PYTHON3_MIN_VERSION }} \
--max-version=3.${{ env.PYTHON3_MAX_VERSION }} \
--range)"
fi
outputs:
matrix: ${{ steps.pyver.outputs.matrix }}

mac-wheels-x86:
needs: [mac-set-matrix-x86]
strategy:
fail-fast: false
matrix:
os: [macos-10.15]
os: [macos-11]
arch: [x86_64]
cibw_build: [cp37-*, cp38-*, cp39-*, cp310-*]
cibw_build: ${{fromJson(needs.mac-set-matrix-x86.outputs.matrix)}}

name: ${{ matrix.os }} (Python ${{ fromJson('{ "cp37-*":"3.7","cp38-*":"3.8","cp39-*":"3.9","cp310-*":"3.10" }')[matrix.cibw_build] }})
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -72,7 +101,8 @@ jobs:

USE_OMP: 1

run: python -m cibuildwheel --output-dir wheelhouse
run: |
python -m cibuildwheel --output-dir wheelhouse

- uses: actions-ecosystem/action-regex-match@v2
id: rc_build
Expand Down
Loading