Update dependencies action to handle linux running in docker

This commit is contained in:
Dmitry Makarenko 2025-05-21 17:34:38 +03:00
parent 3dfd97a830
commit a6f13092aa
5 changed files with 144 additions and 83 deletions

View File

@ -8,88 +8,23 @@ inputs:
runs:
using: "composite"
steps:
- name: Switch to GCC 11 on linux
shell: bash
if: ${{ inputs.force_gcc11 == 'true' && runner.os== 'Linux' }}
run: |
sudo apt update
sudo apt install gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --set gcc /usr/bin/gcc-11
- name: Install required libraries
- name: Prepare the build environment
shell: bash
if: ${{ runner.os== 'Linux' }}
run: |
apt_packages=(
# For self hosted runners
build-essential
cmake
# For Audacity
libasound2-dev
libgtk2.0-dev
libjack-jackd2-dev
gettext
python3-pip
libgl1-mesa-dev
uuid-dev
# For Qt building
libx11-dev
libx11-xcb-dev
libfontenc-dev
libice-dev
libsm-dev
libxau-dev
libxaw7-dev
libxcomposite-dev
libxcursor-dev
libxdamage-dev
libxdmcp-dev
libxext-dev
libxfixes-dev
libxi-dev
libxinerama-dev
libxkbfile-dev
libxmu-dev
libxmuu-dev
libxpm-dev
libxrandr-dev
libxrender-dev
libxres-dev
libxss-dev
libxt-dev
libxtst-dev
libxv-dev
libxvmc-dev
libxxf86vm-dev
libxcb-render0-dev
libxcb-render-util0-dev
libxcb-xkb-dev
libxcb-icccm4-dev
libxcb-image0-dev
libxcb-keysyms1-dev
libxcb-randr0-dev
libxcb-shape0-dev
libxcb-sync-dev
libxcb-xfixes0-dev
libxcb-xinerama0-dev
libxcb-dri3-dev
libxcb-util0-dev
libxcb-cursor-dev
# xkeyboard-config
xkb-data
# It appears that CCI M4 package does not work correctly
m4
)
sudo apt-get update
sudo apt-get install -y --no-install-recommends "${apt_packages[@]}"
sudo apt-get remove -y ccache
echo "Preparing the build environment"
${GITHUB_ACTION_PATH}/setup_linux.sh "${{ inputs.force_gcc11 }}"
- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
with:
cmake-version: '3.24.x'
- name: Generate requirements
shell: bash
run: |
echo "conan==2.4.0" > requirements.txt
- name: Setup Python
uses: actions/setup-python@v5
if: ${{ runner.os != 'Linux' }}
with:
python-version: '3.10'
cache: 'pip'

126
dependencies/setup_linux.sh vendored Executable file
View File

@ -0,0 +1,126 @@
#!/bin/bash
# This script is used to set up a Linux environment for building and packaging software.
# It installs necessary packages and dependencies, and configures the environment.
# It is designed to be run in a Docker container or on a runner.
# Usage: ./setup_linux.sh [true|false]
# true: Force GCC 11
# false: Use the default GCC version
# Default is false
FORCE_GCC11="$1"
set -e
set -o pipefail
apt_packages=(
# For self hosted runners
wget
curl
build-essential
file
git
# For Audacity
libatk-bridge2.0-dev
libcairo2-dev
libcairo-gobject2
libpango-1.0-0
librsvg2-dev
libjack-jackd2-dev
libportaudio2
libasound2-dev
libgtk2.0-dev
gettext
libgl1-mesa-dev
uuid-dev
# For Qt building
libx11-dev
libx11-xcb-dev
libfontenc-dev
libice-dev
libsm-dev
libxau-dev
libxaw7-dev
libxcomposite-dev
libxcursor-dev
libxdamage-dev
libxdmcp-dev
libxext-dev
libxfixes-dev
libxi-dev
libxinerama-dev
libxkbfile-dev
libxmu-dev
libxmuu-dev
libxpm-dev
libxrandr-dev
libxrender-dev
libxres-dev
libxss-dev
libxt-dev
libxtst-dev
libxv-dev
libxvmc-dev
libxxf86vm-dev
libxcb-render0-dev
libxcb-render-util0-dev
libxcb-xkb-dev
libxcb-icccm4-dev
libxcb-image0-dev
libxcb-keysyms1-dev
libxcb-randr0-dev
libxcb-shape0-dev
libxcb-sync-dev
libxcb-xfixes0-dev
libxcb-xinerama0-dev
libxcb-dri3-dev
libxcb-util0-dev
libxcb-cursor-dev
# xkeyboard-config
xkb-data
# It appears that CCI M4 package does not work correctly
m4
# To bundle Adwaita theme
gnome-themes-extra
)
if [ "$(id -u)" -eq 0 ]; then
echo "Running in docker container as root"
apt update
apt install --no-install-recommends -y sudo lsb-release
# Disable interactive prompts
export DEBIAN_FRONTEND=noninteractive
ln -fs /usr/share/zoneinfo/UTC /etc/localtime
echo "Etc/UTC" > /etc/timezone
fi
sudo apt update
sudo apt install -y --no-install-recommends "${apt_packages[@]}"
sudo apt remove -y ccache
# Force GCC11 if requested
if [[ "$FORCE_GCC11" == "true" ]]; then
echo "Switch to GCC 11 on linux"
sudo apt install --no-install-recommends -y gcc-11 g++-11
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-11 100 --slave /usr/bin/g++ g++ /usr/bin/g++-11 --slave /usr/bin/gcov gcov /usr/bin/gcov-11
sudo update-alternatives --set gcc /usr/bin/gcc-11
fi
# Need to bump python3 to 3.10 for Ubuntu 20.04
source /etc/os-release
if [[ "$ID" == "ubuntu" && "$VERSION_ID" == "20.04" ]]; then
sudo apt install -y --no-install-recommends software-properties-common
sudo add-apt-repository -y ppa:deadsnakes/ppa
sudo apt update
sudo apt install -y --no-install-recommends python3.10
sudo bash -c "curl -sS https://bootstrap.pypa.io/get-pip.py | python3.10"
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
sudo update-alternatives --set python3 /usr/bin/python3.10
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
sudo update-alternatives --set python /usr/bin/python3
else
sudo apt install -y --no-install-recommends python3 python3-pip
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 1
fi
# allows to run git commands
git config --global --add safe.directory '*'

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
"license": "BSD 3-Clause",
"dependencies": {
"@actions/artifact": "^2.1.8",
"@actions/cache": "^3.2.4",
"@actions/cache": "^4.0.3",
"@actions/core": "^1.10.1",
"@actions/exec": "^1.1.1",
"@actions/github": "^6.0.0",
@ -24,7 +24,7 @@
"extract-zip": "^2.0.1",
"fs-temp": "^2.0.1",
"md5": "2.3.0",
"simple-plist": "1.1.0",
"simple-plist": "^1.1.0",
"yaml": "2.4.5"
},
"devDependencies": {