forked from nrfconnect/sdk-nrf
-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (65 loc) · 2.71 KB
/
validate-pip-requirements-fixed-file.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
name: Validate pip requirements-fixed.txt
on:
pull_request:
types: [opened, synchronize, reopened]
branches:
- main
- 'v*-branch'
paths:
- 'scripts/requirements*.txt'
- '.github/workflows/validate-pip-requirements-fixed-file.yml'
jobs:
check-requirements:
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: nrfconnect/action-checkout-west-update@main
with:
git-ref: ${{ github.event.pull_request.head.sha }}
west-update-args: '--narrow mcuboot zephyr'
- name: Get python version
id: pyv
run: |
sudo snap install --channel=v4 yq
PYTHON_VERSION=$(yq '.python.version' ./ncs/nrf/scripts/tools-versions-linux.yml)
echo "python_version=$PYTHON_VERSION" >> $GITHUB_OUTPUT
- name: Setup python version
uses: actions/setup-python@v5
with:
python-version: '${{ steps.pyv.outputs.python_version }}'
- name: Setup environment
working-directory: ncs
run: |
pip3 install --user -U setuptools wheel pip virtualenv virtualenvwrapper
- name: Execute script diff action
uses: nrfconnect/action-script-diff@v0.3
with:
diff_file: "ncs/nrf/scripts/requirements-fixed.txt"
script_call: |
cd ncs
OUT_FILE="nrf/scripts/requirements-fixed.txt"
echo "Writing frozen requirements to: $OUT_FILE"
echo "Log python version: $(python --version)"
TOPDIR=$(west topdir)
cd $TOPDIR
source ~/.local/bin/virtualenvwrapper.sh
[[ $? != 0 ]] && echo "error sourcing virtualenvwrapper" && exit 1
rmvirtualenv pip-fixed-venv > /dev/null 2>&1
# We need to force the result of the following command.
# For no aparent reason it returns 1 with the same output as local.
mkvirtualenv pip-fixed-venv > /dev/null 2>&1 || true
workon pip-fixed-venv > /dev/null 2>&1
pip3 install \
--extra-index-url https://files.nordicsemi.com/artifactory/api/pypi/nordic-pypi/simple \
pip-compile-cross-platform==1.4.2+nordic.2 --upgrade > /dev/null 2>&1
pip-compile-cross-platform \
bootloader/mcuboot/scripts/requirements.txt \
zephyr/scripts/requirements.txt \
nrf/scripts/requirements-west-ncs-sbom.txt \
nrf/scripts/requirements-ci.txt \
nrf/scripts/requirements-extra.txt \
nrf/scripts/requirements.txt \
--output-file nrf/scripts/requirements-fixed.txt \
--min-python-version 3.10
deactivate
rmvirtualenv pip-fixed-venv