Skip to content

Commit

Permalink
ci: Fix handling of python packages.
Browse files Browse the repository at this point in the history
GitHub Actions doesn't have python locations in PATH and different
runners might have different configuration for default python
location and versions.  For example, on some runners python2 might
be installed or not.

Missing PATH causes weird situations where during one run our scripts
can locate just installed flake8 and can't do that on a different run.

Also, we're mistakenly installing python2 version of flake8.
On runners that able to locate installed flake8 this causes breakage
of a flake8-check build target because our python scripts written for
python3.  And runners that can't locate flake8 works just fine and
job succeeds.

It's required to use actions/setup-python@v2 in order to have
predictable version of python installed and paths correctly configured.
Due to some bugs in GHA itself it doesn't set $HOME/.local/bin into
PATH, so we have to do that manually for now in order to use '--user'.

Unfortunately actions/setup-python@v2 also makes invisible python
packages installed from Ubuntu repositories.  Switching them to
'pip3 install'.

'six' package is not needed, so it's dropped.

Fixes: ecdd790 ("CI: Add github actions workflow.")
Reported-by: Numan Siddique <numans@ovn.org>
Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
Acked-by: Dumitru Ceara <dceara@redhat.com>
Signed-off-by: Numan Siddique <numans@ovn.org>
  • Loading branch information
igsilya authored and numansiddique committed Mar 15, 2021
1 parent d851fef commit 338a6dd
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 5 deletions.
4 changes: 2 additions & 2 deletions .ci/linux-prepare.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,5 @@ set -ev
git clone git://git.kernel.org/pub/scm/devel/sparse/sparse.git
cd sparse && make -j4 HAVE_LLVM= HAVE_SQLITE= install && cd ..

pip install --disable-pip-version-check --user six flake8 hacking
pip install --user --upgrade docutils
pip3 install --disable-pip-version-check --user flake8 hacking sphinx pyOpenSSL
pip3 install --upgrade --user docutils
23 changes: 20 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ jobs:
dependencies: |
automake libtool gcc bc libjemalloc1 libjemalloc-dev \
libssl-dev llvm-dev libelf-dev libnuma-dev libpcap-dev \
python3-openssl python3-pip python3-sphinx \
selinux-policy-dev
m32_dependecies: gcc-multilib
CC: ${{ matrix.compiler }}
Expand Down Expand Up @@ -88,11 +87,21 @@ jobs:
if: matrix.m32 != ''
run: sudo apt install -y ${{ env.m32_dependecies }}

- name: update PATH
run: |
echo "$HOME/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: set up python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: prepare
run: ./.ci/linux-prepare.sh

- name: build
run: PATH="$PATH:$HOME/bin" ./.ci/linux-build.sh
run: ./.ci/linux-build.sh

- name: copy logs on failure
if: failure() || cancelled()
Expand Down Expand Up @@ -145,10 +154,18 @@ jobs:
ref: 'master'
- name: install dependencies
run: brew install automake libtool
- name: update PATH
run: |
echo "$HOME/bin" >> $GITHUB_PATH
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: set up python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: prepare
run: ./.ci/osx-prepare.sh
- name: build
run: PATH="$PATH:$HOME/bin" ./.ci/osx-build.sh
run: ./.ci/osx-build.sh
- name: upload logs on failure
if: failure()
uses: actions/upload-artifact@v2
Expand Down

0 comments on commit 338a6dd

Please sign in to comment.