Skip to content

Commit

Permalink
Use a composite action to share system setup across jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
t20100 committed Sep 5, 2024
1 parent 2cbea53 commit 15b05bb
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 42 deletions.
31 changes: 31 additions & 0 deletions .github/actions/setup-system/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: 'Setup Linux'
description: 'Install system packages and setup Intel Opencl ICD'

runs:
using: "composite"
steps:
# Install packages:
# OpenCL lib
# xvfb to run the GUI test headless
# libegl1-mesa: Required by Qt xcb platform plugin
# libgl1-mesa-glx: For OpenGL
# xserver-xorg-video-dummy: For OpenGL
# libxkbcommon-x11-0, ..: needed for Qt plugins
- name: Install system packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ocl-icd-opencl-dev xvfb libegl1-mesa libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
- name: Setup Intel OpenCL ICD
id: setup-intel-opencl-icd
if: runner.os == 'Linux'
run: |
wget -nv http://www.silx.org/pub/OpenCL/intel_opencl_icd-6.4.0.38.tar.gz -O - | tar -xzvf -
echo $(pwd)/intel_opencl_icd/icd/libintelocl.so > intel_opencl_icd/vendors/intel64.icd
echo "OCL_ICD_VENDORS=$(pwd)/intel_opencl_icd/vendors/intel64.icd" >> "$GITHUB_ENV"
- name: Setup OpenGL
if: runner.os == 'Windows'
run: |
C:\\msys64\\usr\\bin\\wget.exe -nv -O $(python -c 'import sys, os.path; print(os.path.dirname(sys.executable))')\\opengl32.dll http://www.silx.org/pub/silx/continuous_integration/opengl32_mingw-mesa-x86_64.dll
30 changes: 1 addition & 29 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,34 +61,12 @@ jobs:
steps:
- uses: actions/checkout@v4

# Install packages:
# OpenCL lib
# xvfb to run the GUI test headless
# libegl1-mesa: Required by Qt xcb platform plugin
# libgl1-mesa-glx: For OpenGL
# xserver-xorg-video-dummy: For OpenGL
# libxkbcommon-x11-0, ..: needed for Qt plugins
- name: Install system packages
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install ocl-icd-opencl-dev xvfb libegl1-mesa libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
- name: Setup Intel OpenCL ICD
if: runner.os == 'Linux'
run: |
wget -nv http://www.silx.org/pub/OpenCL/intel_opencl_icd-6.4.0.38.tar.gz -O - | tar -xzvf -
echo $(pwd)/intel_opencl_icd/icd/libintelocl.so > intel_opencl_icd/vendors/intel64.icd
- uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip"

- name: Setup OpenGL
if: runner.os == 'Windows'
run: |
C:\\msys64\\usr\\bin\\wget.exe -nv -O $(python -c 'import sys, os.path; print(os.path.dirname(sys.executable))')\\opengl32.dll http://www.silx.org/pub/silx/continuous_integration/opengl32_mingw-mesa-x86_64.dll
- uses: ./.github/actions/setup-system

- name: Install build dependencies
run: |
Expand All @@ -107,9 +85,6 @@ jobs:
pip install -r ci/requirements-pinned.txt
pip install --pre "${{ matrix.QT_API }}"
pip install --pre "$(ls dist/silx*.whl)[full,test]"
if [ ${{ runner.os }} == 'Linux' ]; then
export OCL_ICD_VENDORS=$(pwd)/intel_opencl_icd/vendors
fi
python ./ci/info_platform.py
pip list
Expand All @@ -119,7 +94,4 @@ jobs:
SILX_TEST_LOW_MEM: "False"
SILX_OPENCL: ${{ matrix.with_opencl && 'True' || 'False' }}
run: |
if [ ${{ runner.os }} == 'Linux' ]; then
export OCL_ICD_VENDORS=$(pwd)/intel_opencl_icd/vendors
fi
python -c "import silx.test, sys; sys.exit(silx.test.run_tests(verbosity=1, args=['--qt-binding=${{ matrix.QT_API }}']));"
15 changes: 2 additions & 13 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install xvfb libegl1-mesa libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- uses: ./.github/actions/setup-system
- uses: actions/download-artifact@v4
with:
name: cibw-sdist
Expand All @@ -62,18 +59,11 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install system packages
run: |
sudo apt-get update
sudo apt-get install xvfb libegl1-mesa libgl1-mesa-glx xserver-xorg-video-dummy libxkbcommon-x11-0 libxkbcommon0 libxkbcommon-dev libxcb-icccm4 libxcb-image0 libxcb-shm0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-render0 libxcb-shape0 libxcb-sync1 libxcb-xfixes0 libxcb-xinerama0 libxcb-xkb1 libxcb-cursor0 libxcb1
- name: Setup Intel OpenCL ICD
run: |
wget -nv http://www.silx.org/pub/OpenCL/intel_opencl_icd-6.4.0.38.tar.gz -O - | tar -xzvf -
echo $(pwd)/intel_opencl_icd/icd/libintelocl.so > intel_opencl_icd/vendors/intel64.icd
- uses: actions/setup-python@v5
with:
python-version: "3.12"
cache: "pip"
- uses: ./.github/actions/setup-system
- name: Install pandoc&graphviz
run: sudo apt-get install pandoc graphviz
- name: Install silx
Expand All @@ -82,7 +72,6 @@ jobs:
env:
QT_QPA_PLATFORM: "offscreen"
run: |
export OCL_ICD_VENDORS=$(pwd)/intel_opencl_icd/vendors
export SILX_VERSION="$(python -c 'import silx; print(silx.strictversion)')"
sphinx-build --fail-on-warning doc/source/ "silx-${SILX_VERSION}_documentation/"
zip -r "silx-${SILX_VERSION}_documentation.zip" "silx-${SILX_VERSION}_documentation/"
Expand Down

0 comments on commit 15b05bb

Please sign in to comment.