-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
85 lines (79 loc) · 2.86 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
name: 'Lava CI Setup'
description: 'Setup environment for CI run in Lava repositories'
inputs:
repository:
description: 'repository name'
required: false
default: 'lava'
python_ver:
description: 'python version to use e.g. 3.10'
required: false
default: '3.10'
poetry_ver:
description: 'poetry version to use'
required: false
default: '1.8.3'
runs:
using: "composite"
steps:
- name: Install Poetry
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
python3 -m pip install --user pipx
elif [ "$RUNNER_OS" == "Windows" ]; then
python3 -m pip install --user pipx
elif [ "$RUNNER_OS" == "macOS" ]; then
brew unlink python@3.9 || True
brew unlink python@3.8 || True
brew link --force python@3.12 || True
brew install pipx
fi
python3 -m pipx ensurepath
python3 -m pipx install poetry==${{ inputs.poetry_ver }}
shell: bash
- name: Set up Python ${{ inputs.python_ver }}
uses: actions/setup-python@v5
with:
python-version: "${{ inputs.python_ver }}"
cache: 'poetry'
cache-dependency-path: |
**/poetry.lock
**/pyproject.toml
- name: Install Poetry w/ updated python version (Linux)
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
python${{ inputs.python_ver }} -m pip install --user pipx
python${{ inputs.python_ver }} -m pipx ensurepath
python${{ inputs.python_ver }} -m pipx install poetry==${{ inputs.poetry_ver }}
elif [ "$RUNNER_OS" == "Windows" ]; then
python -m pip install --user pipx
python -m pipx ensurepath
python -m pipx install poetry==${{ inputs.poetry_ver }}
elif [ "$RUNNER_OS" == "macOS" ]; then
python${{ inputs.python_ver }} -m pip install --user pipx
python${{ inputs.python_ver }} -m pipx ensurepath
python${{ inputs.python_ver }} -m pipx install poetry==${{ inputs.poetry_ver }}
fi
shell: bash
- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v3
with:
path: $GITHUB_WORKSPACE/.local/.cache
key: venv-${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-${{ hashFiles('**/poetry.lock') }}
- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: |
if [ "$(whoami)" = "ci-lava" ]; then
source /home/$(whoami)/.local/pipx/venvs/poetry/bin/activate
fi
poetry install --no-interaction --no-root
shell: bash
- name: Install Lava
run: |
if [ "$(whoami)" = "ci-lava" ]; then
source /home/$(whoami)/.local/pipx/venvs/poetry/bin/activate
fi
export CMAKE_ARGS="..."
poetry install --no-interaction
shell: bash