forked from PennyLaneAI/pennylane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
113 lines (102 loc) · 3.79 KB
/
action.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
name: Install Dependencies
description: |
This workflow installs Python, PennyLane and all its dependencies. If a
requirements file is provided, it will upload the results of pip freeze
as well.
inputs:
python_version:
description: The version of Python to use in order to run unit tests
required: false
default: '3.9'
install_jax:
description: Indicate if JAX should be installed or not
required: false
default: 'true'
jax_version:
description: The version of JAX to install for any job that requires JAX
required: false
default: 0.4.23
install_tensorflow:
description: Indicate if TensorFlow should be installed or not
required: false
default: 'true'
tensorflow_version:
description: The version of TensorFlow to install for any job that requires TensorFlow
required: false
default: 2.15.0
install_pytorch:
description: Indicate if PyTorch should be installed or not
required: false
default: 'true'
pytorch_version:
description: The version of PyTorch to install for any job that requires PyTorch
required: false
default: 2.2.0
install_pennylane_lightning_master:
description: Indicate if PennyLane-Lightning should be installed from the master branch
required: false
default: 'true'
additional_pip_packages:
description: Additional packages to install. Values will be passed to pip install {value}
required: false
default: ''
requirements_file:
description: File name to store stable version of requirements for a test group
required: false
default: ''
runs:
using: composite
steps:
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '${{ inputs.python_version }}'
- name: Upgrade PIP
shell: bash
run: pip install --upgrade pip && pip install wheel --upgrade
- name: Install PennyLane dependencies
shell: bash
run: |
pip install -r requirements-ci.txt --upgrade
pip install -r requirements-dev.txt --upgrade
- name: Install PyTorch
shell: bash
if: inputs.install_pytorch == 'true'
env:
TORCH_VERSION: ${{ inputs.pytorch_version != '' && format('=={0}', inputs.pytorch_version) || '' }}
run: pip install "torch${{ env.TORCH_VERSION }}" -f https://download.pytorch.org/whl/torch_stable.html
- name: Install TensorFlow
shell: bash
if: inputs.install_tensorflow == 'true'
env:
TF_VERSION: ${{ inputs.tensorflow_version != '' && format('~={0}', inputs.tensorflow_version) || '' }}
run: pip install "tensorflow${{ env.TF_VERSION }}" "keras${{ env.TF_VERSION }}"
- name: Install JAX
shell: bash
if: inputs.install_jax == 'true'
env:
JAX_VERSION: ${{ inputs.jax_version != '' && format('=={0}', inputs.jax_version) || '' }}
run: pip install "jax${{ env.JAX_VERSION}}" "jaxlib${{ env.JAX_VERSION }}"
- name: Install additional PIP packages
shell: bash
if: inputs.additional_pip_packages != ''
run: pip install ${{ inputs.additional_pip_packages }}
- name: Install PennyLane
shell: bash
run: |
python setup.py bdist_wheel
pip install dist/PennyLane*.whl
- name: Install PennyLane-Lightning master
shell: bash
if: inputs.install_pennylane_lightning_master == 'true'
run: pip install -i https://test.pypi.org/simple/ PennyLane-Lightning --pre --upgrade
- name: Freeze dependencies
shell: bash
if: inputs.requirements_file != ''
run: pip freeze | grep -v "file:///" > ${{ inputs.requirements_file }}
- name: Upload frozen requirements
if: inputs.requirements_file != ''
uses: actions/upload-artifact@v4
with:
name: frozen-${{ inputs.requirements_file }}
path: ${{ inputs.requirements_file }}