CI: generate appimage with linux workflow

This commit is contained in:
qurios-pixel 2021-07-13 14:52:58 +00:00 committed by Kojin
parent 4eb5d2c5ed
commit bac66e1e5e
6 changed files with 180 additions and 34 deletions

View File

@ -31,33 +31,35 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
include: include:
- os: ubuntu-20.04 - os: ubuntu-18.04
platform: x86 platform: x86
compiler: gcc compiler: gcc
detail: appimage
experimental: false experimental: false
- os: ubuntu-20.04 - os: ubuntu-18.04
platform: x64 platform: x64
compiler: gcc compiler: gcc
detail: appimage
experimental: false experimental: false
- os: ubuntu-20.04 - os: ubuntu-18.04
platform: x86 platform: x86
compiler: clang compiler: clang
# Need to disable PCH until cmake 3.17 # Need to disable PCH until cmake 3.17
# (PCH conflicts with ccache, fixed by https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4400) # (PCH conflicts with ccache, fixed by https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4400)
cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
detail: -nopch detail: nopch
experimental: false experimental: false
- os: ubuntu-20.04 - os: ubuntu-18.04
platform: x86 platform: x86
compiler: gcc compiler: gcc
cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
detail: -nopch detail: nopch
experimental: false experimental: false
- os: ubuntu-20.04 - os: ubuntu-18.04
platform: x86 platform: x86
compiler: gcc compiler: gcc
cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -DARCH_FLAG=-march=haswell cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -DARCH_FLAG=-march=haswell
detail: -avx2-nopch detail: avx2 nopch
experimental: false experimental: false
name: "${{ matrix.platform }} | ${{ matrix.compiler }} ${{ matrix.detail }}" name: "${{ matrix.platform }} | ${{ matrix.compiler }} ${{ matrix.detail }}"
@ -95,22 +97,62 @@ jobs:
with: with:
path: .ccache path: .ccache
key: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}${{ matrix.detail }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }} key: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}${{ matrix.detail }}-ccache-${{ steps.ccache_cache_timestamp.outputs.timestamp }}
restore-keys: | restore-keys: ${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}${{ matrix.detail }}-ccache-
${{ matrix.os }}-${{ matrix.platform }}-${{ matrix.compiler }}${{ matrix.detail }}-ccache-
- name: Prepare Artifact Metadata
id: artifact-metadata
shell: bash
run: |
ARCH=$([ "${{ matrix.platform }}" == x86 ] && echo "32bit" || echo "64bit")
ARTIFACT_NAME=""
if [ ${{ github.event_name }} == "pull_request" ]; then
PR_SHA=$(git rev-parse --short "${{ github.event.pull_request.head.sha }}")
ARTIFACT_NAME="PCSX2-${ARCH}"
if [ ! -z "${{ github.event.pull_request.number }}" ]; then
PR_NUM=${{ github.event.pull_request.number }}
ARTIFACT_NAME="${ARTIFACT_NAME}-pr[${PR_NUM}]"
fi
ARTIFACT_NAME="${ARTIFACT_NAME}-sha[${PR_SHA}]"
if [ ! -z "${{ github.event.pull_request.title }}" ]; then
PR_TITLE=$(echo "${{ github.event.pull_request.title }}" | tr -cd '[a-zA-Z0-9[:space:]]_-')
ARTIFACT_NAME="${ARTIFACT_NAME}-title["${PR_TITLE}""
fi
else
SHA=$(git rev-parse --short "$GITHUB_SHA")
ARTIFACT_NAME="PCSX2-${ARCH}-sha[${SHA}"
fi
TRIMMED_ARTIFACT_NAME=$(printf "%.199s]" "$ARTIFACT_NAME")
echo "name=$TRIMMED_ARTIFACT_NAME"
echo "##[set-output name=name;]${TRIMMED_ARTIFACT_NAME}"
- name: Install Packages - name: Install Packages
env: env:
PLATFORM: ${{ matrix.platform }} PLATFORM: ${{ matrix.platform }}
COMPILER: ${{ matrix.compiler }} COMPILER: ${{ matrix.compiler }}
run: ./.github/workflows/scripts/linux/install-packages.sh run: .github/workflows/scripts/linux/install-packages.sh
- name: Generate CMake - name: Generate CMake
env: env:
PLATFORM: ${{ matrix.platform }} PLATFORM: ${{ matrix.platform }}
COMPILER: ${{ matrix.compiler }} COMPILER: ${{ matrix.compiler }}
ADDITIONAL_CMAKE_ARGS: ${{ matrix.cmakeflags }} ADDITIONAL_CMAKE_ARGS: ${{ matrix.cmakeflags }}
run: ./.github/workflows/scripts/linux/generate-cmake.sh run: .github/workflows/scripts/linux/generate-cmake.sh
- name: Build PCSX2 - name: Build PCSX2
working-directory: ./build working-directory: ./build
run: ../.github/workflows/scripts/linux/compile.sh run: ../.github/workflows/scripts/linux/compile.sh
- name: Package AppImage
env:
PLATFORM: ${{ matrix.platform }}
COMPILER: ${{ matrix.compiler }}
name: ${{ steps.artifact-metadata.outputs.name }}
run: .github/workflows/scripts/linux/appimage.sh
if: ${{ matrix.detail == 'appimage' }}
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.artifact-metadata.outputs.name }}
path: artifacts
if: ${{ matrix.detail == 'appimage' }}

15
.github/workflows/scripts/linux/AppRun vendored Executable file
View File

@ -0,0 +1,15 @@
#!/bin/bash
export LD_LIBRARY_PATH="/tmp/PCSX2:$APPDIR/usr/lib:$LD_LIBRARY_PATH"
BINARY_NAME=$(basename "$ARGV0")
if [[ ! -e "$PWD/$BINARY_NAME.config" ]]; then
mkdir "$PWD/$BINARY_NAME.config"
fi
export XDG_CONFIG_HOME="$PWD/$BINARY_NAME.config"
ln -sf $APPDIR/usr/bin/plugins /tmp/PCSX2
mkdir -p $HOME/.local/share/icons/hicolor/scalable/apps && cp $APPDIR/PCSX2.png $HOME/.local/share/icons/hicolor/scalable/apps
$APPDIR/AppRun-patched
unlink /tmp/PCSX2

58
.github/workflows/scripts/linux/appimage.sh vendored Executable file
View File

@ -0,0 +1,58 @@
#!/bin/bash
set -ex
echo "${PLATFORM}"
if [ "${PLATFORM}" == "x86" ]; then
APPARCH="i686"
ARCH="i386"
else
APPARCH="x86_64"
ARCH="x86_64"
fi
BUILDPATH="$GITHUB_WORKSPACE"/build
BUILDBIN="$BUILDPATH"/pcsx2
cd /tmp
curl -sSfLO "https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-$ARCH.AppImage"
chmod a+x linuxdeploy*.AppImage
./linuxdeploy-"$ARCH".AppImage --appimage-extract
mv /tmp/squashfs-root/usr/bin/patchelf /tmp/squashfs-root/usr/bin/patchelf.orig
sudo cp /usr/local/bin/patchelf /tmp/squashfs-root/usr/bin/patchelf
cd "$GITHUB_WORKSPACE"
mkdir -p squashfs-root/usr/bin
ls -al "$BUILDBIN"
cp -P "$BUILDBIN"/PCSX2 "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/
patchelf --set-rpath /tmp/PCSX2 "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/PCSX2
cp ./pcsx2/gui/Resources/AppIcon64.png ./squashfs-root/PCSX2.png
cp ./linux_various/PCSX2.desktop.in ./squashfs-root/PCSX2.desktop
sed -i -e 's|Categories=@PCSX2_MENU_CATEGORIES@|Categories=Game;Emulator;|g' ./squashfs-root/PCSX2.desktop
sed -i -e 's|__GL_THREADED_OPTIMIZATIONS=1|__GL_THREADED_OPTIMIZATIONS=0|g' ./squashfs-root/PCSX2.desktop
curl -sSfL "https://github.com/AppImage/AppImageKit/releases/download/continuous/runtime-$APPARCH" -o ./squashfs-root/runtime
mkdir -p squashfs-root/usr/share/applications && cp ./squashfs-root/PCSX2.desktop ./squashfs-root/usr/share/applications
mkdir -p squashfs-root/usr/share/icons && cp ./squashfs-root/PCSX2.png ./squashfs-root/usr/share/icons
mkdir -p squashfs-root/usr/share/icons/hicolor/scalable/apps && cp ./squashfs-root/PCSX2.png ./squashfs-root/usr/share/icons/hicolor/scalable/apps
mkdir -p squashfs-root/usr/share/pixmaps && cp ./squashfs-root/PCSX2.png ./squashfs-root/usr/share/pixmaps
mkdir -p squashfs-root/usr/lib/
cp ./.github/workflows/scripts/linux/AppRun "$GITHUB_WORKSPACE"/squashfs-root/AppRun
curl -sSfL "https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-$APPARCH" -o "$GITHUB_WORKSPACE"/squashfs-root/AppRun-patched
chmod a+x ./squashfs-root/AppRun
chmod a+x ./squashfs-root/runtime
chmod a+x ./squashfs-root/AppRun-patched
echo "$name" > "$GITHUB_WORKSPACE"/squashfs-root/version.txt
mkdir -p "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/{plugins,vm}
cp -r "$GITHUB_WORKSPACE"/bin/Langs "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/
cp "$GITHUB_WORKSPACE"/bin/docs/{Configuration_Guide.pdf,PCSX2_FAQ.pdf} "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins
cp "$GITHUB_WORKSPACE"/bin/cheats_ws.zip "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins
if [[ -e "$BUILDPATH/plugins" ]]; then
find "$BUILDPATH/plugins" -iname '*.so' -exec cp {} "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins \;
fi
cp ./bin/GameIndex.yaml "$GITHUB_WORKSPACE"/squashfs-root/usr/bin/plugins/GameIndex.yaml
export UPD_INFO="gh-releases-zsync|PCSX2|pcsx2|latest|$name.AppImage.zsync"
export OUTPUT="$name.AppImage"
/tmp/squashfs-root/AppRun --appdir="$GITHUB_WORKSPACE"/squashfs-root/ -d "$GITHUB_WORKSPACE"/squashfs-root/PCSX2.desktop -i "$GITHUB_WORKSPACE"/squashfs-root/PCSX2.png --output appimage
mkdir -p "$GITHUB_WORKSPACE"/artifacts/
ls -al .
mv "$name.AppImage" "$GITHUB_WORKSPACE"/artifacts # && mv "$name.AppImage.zsync" $GITHUB_WORKSPACE/artifacts
chmod -R 777 ./artifacts
cd ./artifacts
ls -al .

View File

@ -12,6 +12,6 @@ export CCACHE_MAXSIZE="400M"
ccache -p ccache -p
ccache -z ccache -z
# Build # Build
make -j4 install ninja
# Save the Cache # Save the Cache
ccache -s ccache -s

View File

@ -10,17 +10,24 @@ else
export CXX=clang++ export CXX=clang++
fi fi
if [ "${PLATFORM}" = "x86" ]; then if [ "${PLATFORM}" = x86 ]; then
ADDITIONAL_CMAKE_ARGS="$ADDITIONAL_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=cmake/linux-compiler-i386-multilib.cmake" ADDITIONAL_CMAKE_ARGS="$ADDITIONAL_CMAKE_ARGS"
TOOLCHAIN="cmake/linux-compiler-i386-multilib.cmake"
fi fi
echo "Additional CMake Args - ${ADDITIONAL_CMAKE_ARGS}" echo "Additional CMake Args - ${ADDITIONAL_CMAKE_ARGS}"
# Generate CMake into ./build # Generate CMake into ./build
cmake \ cmake \
-D CMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-D DISABLE_ADVANCE_SIMD=TRUE \ -DCMAKE_BUILD_TYPE=Release \
-D CMAKE_BUILD_TYPE=Release \ -DPACKAGE_MODE=TRUE \
-D BUILD_REPLAY_LOADERS=TRUE \ -DDISABLE_ADVANCE_SIMD=TRUE \
-D CMAKE_BUILD_PO=FALSE \ -DCMAKE_INSTALL_LIBDIR="/tmp/" \
-D GTK3_API=TRUE ${ADDITIONAL_CMAKE_ARGS} \ -DCMAKE_INSTALL_DATADIR="/tmp/" \
-DCMAKE_INSTALL_DOCDIR="/tmp/PCSX2" \
-DOpenGL_GL_PREFERENCE="LEGACY" \
-DOPENGL_opengl_LIBRARY="" \
-DXDG_STD=TRUE "${ADDITIONAL_CMAKE_ARGS}" \
-DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" \
-GNinja \
-B build -B build

View File

@ -6,7 +6,8 @@ set -e
declare -a BUILD_PACKAGES=( declare -a BUILD_PACKAGES=(
"ccache" "ccache"
"cmake" "cmake"
"g++-10-multilib" "g++-8-multilib"
"ninja-build"
) )
declare -a GCC_PACKAGES=( declare -a GCC_PACKAGES=(
@ -18,15 +19,15 @@ declare -a CLANG_PACKAGES=(
"clang-tidy" "clang-tidy"
"clang-tools" "clang-tools"
"clang" "clang"
"clangd" "clangd-10"
"libc++-dev" "libc++-dev"
"libc++1" "libc++1"
"libc++abi-dev" "libc++abi-dev"
"libc++abi1" "libc++abi1"
"libclang-dev" "libclang-dev"
"libclang1" "libclang1"
"liblldb-dev" "liblldb-10-dev"
"libllvm-ocaml-dev" "libllvm-10-ocaml-dev"
"libomp-dev" "libomp-dev"
"libomp5" "libomp5"
"lld" "lld"
@ -34,50 +35,66 @@ declare -a CLANG_PACKAGES=(
"llvm-dev" "llvm-dev"
"llvm-runtime" "llvm-runtime"
"llvm" "llvm"
"python-clang" "python3-clang-10"
) )
# Packages - PCSX2 # Packages - PCSX2
declare -a PCSX2_PACKAGES=( declare -a PCSX2_PACKAGES=(
"curl"
"fuse"
"gettext"
"libaio-dev" "libaio-dev"
"libasound2-dev" "libasound2-dev"
"libatk1.0-dev"
"libatk-bridge2.0-dev"
"libbz2-dev"
"libcairo2-dev" "libcairo2-dev"
"libegl-dev" "libcggl"
"libdbus-1-dev"
"libegl1-mesa-dev" "libegl1-mesa-dev"
"libfontconfig1-dev"
"libgdk-pixbuf2.0-dev" "libgdk-pixbuf2.0-dev"
"libgirepository-1.0-1" "libgirepository-1.0-1"
"libgl-dev" "libgl-dev"
"libgl1-mesa-dev" "libgl1-mesa-dev"
"libgl1-mesa-dri" "libgl1-mesa-dri"
"libgl1" "libgl1"
"libgles-dev"
"libgles-dev"
"libgles2-mesa-dev" "libgles2-mesa-dev"
"libglew-dev"
"libglib2.0-dev" "libglib2.0-dev"
"libglu1-mesa-dev" "libglu1-mesa-dev"
"libglu1-mesa" "libglu1-mesa"
"libglvnd-dev" "libglvnd-dev"
"libglx-dev"
"libglx-mesa0" "libglx-mesa0"
"libglx0" "libglx0"
"libgtk-3-dev" "libgtk-3-dev"
"libgtk2.0-dev" "libgtk2.0-dev"
"libharfbuzz-dev" "libharfbuzz-dev"
"libibus-1.0-dev"
"libjack-jackd2-dev"
"libjpeg-dev"
"libllvm10" "libllvm10"
"liblzma-dev" "liblzma-dev"
"liblzma5"
"libpango1.0-dev" "libpango1.0-dev"
"libpcap0.8-dev" "libpcap0.8-dev"
"libpng-dev"
"libportaudiocpp0"
"libpulse-dev" "libpulse-dev"
"libsdl1.2-dev"
"libsdl2-dev" "libsdl2-dev"
"libsamplerate0-dev" "libsamplerate0-dev"
"libsoundtouch-dev" "libsoundtouch-dev"
"libwxgtk3.0-dev"
"libwxgtk3.0-gtk3-0v5" "libwxgtk3.0-gtk3-0v5"
"libwxgtk3.0-gtk3-dev" "libwxgtk3.0-gtk3-dev"
"libx11-xcb-dev" "libx11-xcb-dev"
"libxext-dev" "libxext-dev"
"libxft-dev" "libxft-dev"
"libxml2-dev" "libxml2-dev"
"nvidia-cg-toolkit"
"portaudio19-dev" "portaudio19-dev"
"python"
"zlib1g-dev" "zlib1g-dev"
) )
@ -108,11 +125,11 @@ else
fi fi
echo "Will install the following packages for building - ${BUILD_PACKAGE_STR}" echo "Will install the following packages for building - ${BUILD_PACKAGE_STR}"
sudo apt remove gcc-9 g++-9 #sudo apt remove gcc-9 g++-9
sudo apt-get -y install ${BUILD_PACKAGE_STR} sudo apt-get -y install ${BUILD_PACKAGE_STR}
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-10 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 10
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-10 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 10
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30
@ -127,3 +144,10 @@ sudo apt-get -y install libgcc-s1:i386
fi fi
echo "Will install the following packages for pcsx2 - ${PCSX2_PACKAGES_STR}" echo "Will install the following packages for pcsx2 - ${PCSX2_PACKAGES_STR}"
sudo apt-get -y install ${PCSX2_PACKAGES_STR} sudo apt-get -y install ${PCSX2_PACKAGES_STR}
cd /tmp
curl -sSfLO https://github.com/NixOS/patchelf/releases/download/0.12/patchelf-0.12.tar.bz2
tar xvf patchelf-0.12.tar.bz2
cd patchelf-0.12*/
./configure
make && sudo make install