-
Notifications
You must be signed in to change notification settings - Fork 42
131 lines (114 loc) · 4.56 KB
/
tests_without_binary.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
name: Testing without binary
on:
workflow_call:
inputs:
lightning-version:
type: string
required: true
description: The version of Lightning to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master)
pennylane-version:
type: string
required: true
description: The version of PennyLane to use. Valid values are either 'release' (most recent release candidate), 'stable' (most recent git-tag) or 'latest' (most recent commit from master)
pull_request:
paths-ignore:
- pennylane_lightning/core/src/**
push:
branches:
- master
env:
COVERAGE_FLAGS: "--cov=pennylane_lightning --cov-report=term-missing --cov-report=xml:./coverage.xml --no-flaky-report -p no:warnings --tb=native"
concurrency:
group: tests_without_binary-${{ github.ref }}-${{ github.event_name }}-${{ inputs.lightning-version }}-${{ inputs.pennylane-version }}
cancel-in-progress: true
jobs:
determine_runner:
name: Determine runner type to use
uses: ./.github/workflows/determine-workflow-runner.yml
with:
default_runner: ubuntu-22.04
pythontests:
needs: [determine_runner]
timeout-minutes: 30
runs-on: ${{ needs.determine_runner.outputs.runner_group }}
strategy:
matrix:
pl_backend: ["lightning_qubit", "lightning_kokkos", "lightning_gpu", "lightning_tensor"]
name: Python Tests without Binary (${{ matrix.pl_backend }})
steps:
- name: Checkout PennyLane-Lightning
uses: actions/checkout@v4
with:
fetch-tags: true
path: main
- name: Switch to release build of Lightning
if: inputs.lightning-version == 'release'
run: |
cd main
git fetch --all
git checkout $(git branch -a --list "origin/v*rc*" | tail -1)
- name: Switch to stable build of Lightning
if: inputs.lightning-version == 'stable'
run: |
cd main
git fetch --tags --force
git checkout latest_release
git log -1 --format='%H'
git status
- uses: actions/setup-python@v5
name: Install Python
with:
python-version: '3.9'
- name: Get required Python packages
run: |
rm -fr $(python -m pip cache dir)/selfcheck/
cd main
python -m pip install -r requirements-dev.txt
- name: Checkout PennyLane for release build
if: inputs.pennylane-version == 'release'
uses: actions/checkout@v4
with:
path: pennylane
repository: PennyLaneAI/pennylane
- name: Switch to release build of PennyLane
if: inputs.pennylane-version == 'release'
run: |
cd pennylane
git fetch --all
git checkout $(git branch -a --list "origin/v*rc*" | tail -1)
python -m pip uninstall -y pennylane && python -m pip install . -vv --no-deps
- name: Install Stable PennyLane
if: inputs.pennylane-version == 'stable'
run: |
cd main
python -m pip uninstall -y pennylane && python -m pip install -U pennylane
- name: Install the pennylane_lightning package
if: ${{ contains(fromJson('["lightning_kokkos", "lightning_gpu", "lightning_tensor"]'), matrix.pl_backend) }}
run: |
cd main
SKIP_COMPILATION=True PL_BACKEND="lightning_qubit" python -m pip install . -vv
- name: Install backend device
# FIXME: Remove this condition with v0.37.0 release
if: matrix.pl_backend != 'lightning_tensor' || inputs.lightning-version != 'stable'
env:
SKIP_COMPILATION: True
PL_BACKEND: ${{ matrix.pl_backend }}
run: |
cd main
python -m pip install . -vv
- name: Run PennyLane-Lightning unit tests for all backends
# FIXME: Remove this condition with v0.37.0 release
if: matrix.pl_backend != 'lightning_tensor' || inputs.lightning-version != 'stable'
run: |
cd main/
DEVICENAME=`echo ${{ matrix.pl_backend }} | sed "s/_/./g"`
PL_DEVICE=${DEVICENAME} python -m pytest tests/ $COVERAGE_FLAGS
- name: Upload coverage to Codecov
# FIXME: Remove this condition with v0.37.0 release
if: matrix.pl_backend != 'lightning_tensor' || inputs.lightning-version != 'stable'
uses: codecov/codecov-action@v4
with:
files: ./main/coverage.xml
fail_ci_if_error: true
verbose: true
token: ${{ secrets.CODECOV_TOKEN }}