Skip to content

Serial Recovery for the Thingy:91 X #238

Serial Recovery for the Thingy:91 X

Serial Recovery for the Thingy:91 X #238

name: Validate pip requirements-fixed.txt
on:
pull_request_target:
types: [opened, synchronize, reopened]
branches:
- main
- 'v*-branch'
paths:
- 'scripts/requirements*.txt'
env:
REACT_EMOTE: 'eyes'
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@v4
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.2
with:
github-token: ${{ secrets.NCS_GITHUB_TOKEN }}
message_diff: |
This pr introduces changes to requirements files.
The compiled requirements-fixed.txt has changed.
To automatically add the changed file to this pr react with the :$REACT_EMOTE: emote to this comment and re-run the check.
[Check Run]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID)
<details>
<summary>requirements-fixed.txt diff</summary>
\`\`\` diff
$GITDIFF
\`\`\`
</details>
message_success: |
The changes to the 'requirements-fixed.txt' have been added to this PR.
All further changes to any of the requirements file will automatically be applied as long an :$REACT_EMOTE: is present.
git_diff_root: ncs/nrf
diff_path: scripts
diff_file: requirements-fixed.txt
reaction_emote: "${{ env.REACT_EMOTE }}"
git_user_name: "Nordic Builder"
git_user_email: "pylon@nordicsemi.no"
script_call: |
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 pip-tools > /dev/null 2>&1
pip3 install setuptools --upgrade
pip-compile \
--build-isolation \
--strip-extras \
--annotation-style line \
--allow-unsafe \
--output-file $OUT_FILE \
bootloader/mcuboot/scripts/requirements.txt \
zephyr/scripts/requirements.txt \
nrf/scripts/requirements.txt \
nrf/scripts/requirements-ci.txt \
nrf/scripts/requirements-extra.txt
deactivate
rmvirtualenv pip-fixed-venv