mirror of https://github.com/PCSX2/pcsx2.git
153 lines
5.2 KiB
YAML
153 lines
5.2 KiB
YAML
name: Linux Build Steps
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
jobName:
|
|
required: true
|
|
type: string
|
|
os:
|
|
required: false
|
|
type: string
|
|
default: ubuntu-20.04
|
|
platform:
|
|
required: false
|
|
type: string
|
|
default: x64
|
|
compiler:
|
|
required: true
|
|
type: string
|
|
cmakeflags:
|
|
required: true
|
|
type: string
|
|
buildAppImage:
|
|
required: false
|
|
type: boolean
|
|
default: false
|
|
detail:
|
|
required: false
|
|
type: string
|
|
default: ""
|
|
cheats_url:
|
|
required: false
|
|
type: string
|
|
default: https://github.com/PCSX2/pcsx2_patches/releases/latest/download
|
|
|
|
jobs:
|
|
build_linux:
|
|
name: ${{ inputs.jobName }}
|
|
runs-on: ${{ inputs.os }}
|
|
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
|
|
timeout-minutes: 60
|
|
env:
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
CCACHE_COMPRESS: true
|
|
CCACHE_COMPRESSLEVEL: 9
|
|
CCACHE_MAXSIZE: 100M
|
|
SDL: SDL2-2.26.0
|
|
PATCHELF_VERSION: 0.12
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
|
|
- name: Prepare Artifact Metadata
|
|
id: artifact-metadata
|
|
shell: bash
|
|
env:
|
|
OS: linux
|
|
GUI_FRAMEWORK: wxWidgets
|
|
ARCH: ${{ inputs.platform }}
|
|
SIMD: ''
|
|
EVENT_NAME: ${{ github.event_name }}
|
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
|
PR_NUM: ${{ github.event.pull_request.number }}
|
|
PR_SHA: ${{ github.event.pull_request.head.sha }}
|
|
run: ./.github/workflows/scripts/common/name-artifacts.sh
|
|
|
|
# -- SETUP CCACHE - https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/
|
|
- name: Prepare ccache timestamp
|
|
id: ccache_cache_timestamp
|
|
run: echo "timestamp=$(date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
|
|
|
- name: ccache cache files
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: .ccache
|
|
key: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }}${{ inputs.detail }} ccache ${{ steps.ccache_cache_timestamp.outputs.timestamp }}
|
|
restore-keys: ${{ inputs.os }} ${{ inputs.platform }} ${{ inputs.compiler }}${{ inputs.detail }} ccache
|
|
|
|
- name: Install Packages
|
|
env:
|
|
PLATFORM: ${{ inputs.platform }}
|
|
COMPILER: ${{ inputs.compiler }}
|
|
run: .github/workflows/scripts/linux/install-packages.sh
|
|
|
|
- name: Cache Dependencies
|
|
uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
3rdparty/${{ env.SDL }}
|
|
3rdparty/patchelf-${{ env.PATCHELF_VERSION }}
|
|
key: ${{ inputs.os }} ${{ inputs.platform }} ${{ env.SDL }} patchelf-${{ env.PATCHELF_VERSION }}
|
|
|
|
- name: Build Dependencies
|
|
run: |
|
|
if [[ ! -e 3rdparty/patchelf-${{ env.PATCHELF_VERSION }} ]]; then
|
|
curl -sSfL https://github.com/NixOS/patchelf/releases/download/${{ env.PATCHELF_VERSION }}/patchelf-${{ env.PATCHELF_VERSION }}.tar.bz2 | tar -xjC 3rdparty
|
|
mv 3rdparty/patchelf-${{ env.PATCHELF_VERSION }}* 3rdparty/patchelf-${{ env.PATCHELF_VERSION }}
|
|
cd 3rdparty/patchelf-${{ env.PATCHELF_VERSION }}
|
|
./configure
|
|
make && cd ../../
|
|
fi
|
|
sudo make -C 3rdparty/patchelf-${{ env.PATCHELF_VERSION }} install
|
|
if [[ ! -e 3rdparty/${{ env.SDL }} ]]; then
|
|
curl -sL https://libsdl.org/release/${{ env.SDL }}.tar.gz | tar -xzC 3rdparty
|
|
cd 3rdparty/${{ env.SDL }}
|
|
if [ "${{ inputs.platform }}" == "x86" ]; then
|
|
./configure --build=i686-pc-linux-gnu CC=${{ inputs.compiler }} CFLAGS=-m32 CXXFLAGS=-m32 LDFLAGS=-m32 --prefix=/usr --libdir=/usr/lib/i386-linux-gnu
|
|
else
|
|
./configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu
|
|
fi
|
|
make -j $(getconf _NPROCESSORS_ONLN) && cd ../../
|
|
fi
|
|
sudo make -C 3rdparty/${{ env.SDL }} install
|
|
|
|
- name: Download cheats
|
|
run: |
|
|
cd bin/resources
|
|
aria2c -Z "${{ inputs.cheats_url }}/cheats_ni.zip" "${{ inputs.cheats_url }}/cheats_ws.zip"
|
|
|
|
- name: Generate CMake
|
|
env:
|
|
PLATFORM: ${{ inputs.platform }}
|
|
COMPILER: ${{ inputs.compiler }}
|
|
ADDITIONAL_CMAKE_ARGS: ${{ inputs.cmakeflags }}
|
|
run: .github/workflows/scripts/linux/generate-cmake.sh
|
|
|
|
- name: Build PCSX2
|
|
working-directory: build
|
|
run: ../.github/workflows/scripts/linux/compile.sh
|
|
|
|
- name: Run Tests
|
|
working-directory: ./build
|
|
run: ninja unittests
|
|
|
|
- name: Package AppImage
|
|
if: inputs.buildAppImage == true
|
|
env:
|
|
PLATFORM: ${{ inputs.platform }}
|
|
COMPILER: ${{ inputs.compiler }}
|
|
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
|
run: .github/workflows/scripts/linux/appimage.sh
|
|
|
|
- name: Upload artifact
|
|
if: inputs.buildAppImage == true
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
|
path: ci-artifacts
|