2022-05-14 05:56:57 +00:00
|
|
|
name: Linux Build Steps
|
|
|
|
|
|
|
|
on:
|
|
|
|
workflow_call:
|
|
|
|
inputs:
|
|
|
|
jobName:
|
|
|
|
required: true
|
|
|
|
type: string
|
2024-01-06 20:44:44 +00:00
|
|
|
artifactPrefixName:
|
|
|
|
required: true
|
|
|
|
type: string
|
2022-05-14 05:56:57 +00:00
|
|
|
os:
|
|
|
|
required: false
|
|
|
|
type: string
|
2023-06-25 05:26:32 +00:00
|
|
|
default: ubuntu-22.04
|
2022-05-14 05:56:57 +00:00
|
|
|
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: ""
|
2023-07-20 01:44:20 +00:00
|
|
|
patchesUrl:
|
2022-08-04 19:33:37 +00:00
|
|
|
required: false
|
|
|
|
type: string
|
|
|
|
default: https://github.com/PCSX2/pcsx2_patches/releases/latest/download
|
2023-07-20 01:44:20 +00:00
|
|
|
fetchTags:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2024-01-11 00:04:42 +00:00
|
|
|
stableBuild:
|
|
|
|
required: false
|
|
|
|
type: boolean
|
|
|
|
default: false
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
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.
|
2023-10-25 06:36:08 +00:00
|
|
|
timeout-minutes: 90
|
2022-05-14 05:56:57 +00:00
|
|
|
env:
|
|
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
|
|
CCACHE_COMPRESS: true
|
|
|
|
CCACHE_COMPRESSLEVEL: 9
|
|
|
|
CCACHE_MAXSIZE: 100M
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout Repository
|
2023-09-11 04:33:40 +00:00
|
|
|
uses: actions/checkout@v4
|
2024-08-05 10:56:46 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
2022-05-14 05:56:57 +00:00
|
|
|
|
2023-07-11 07:10:03 +00:00
|
|
|
# actions/checkout elides tags, fetch them primarily for releases
|
|
|
|
- name: Fetch Tags
|
2023-07-20 01:44:20 +00:00
|
|
|
if: ${{ inputs.fetchTags }}
|
2023-07-11 07:10:03 +00:00
|
|
|
run: git fetch --tags --no-recurse-submodules
|
|
|
|
|
2024-01-11 00:04:42 +00:00
|
|
|
- name: Add stable release identifier file
|
|
|
|
if: ${{ inputs.stableBuild == true || inputs.stableBuild == 'true' }}
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
echo "#define DEFAULT_UPDATER_CHANNEL \"stable\"" > ./pcsx2-qt/DefaultUpdaterChannel.h
|
|
|
|
cat ./pcsx2-qt/DefaultUpdaterChannel.h
|
|
|
|
|
2022-05-14 05:56:57 +00:00
|
|
|
- name: Prepare Artifact Metadata
|
|
|
|
id: artifact-metadata
|
|
|
|
shell: bash
|
|
|
|
env:
|
2024-01-06 20:44:44 +00:00
|
|
|
PREFIX: ${{ inputs.artifactPrefixName }}
|
2022-05-14 05:56:57 +00:00
|
|
|
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
|
2022-10-19 21:49:51 +00:00
|
|
|
run: echo "timestamp=$(date -u "+%Y-%m-%d-%H;%M;%S")" >> $GITHUB_OUTPUT
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: ccache cache files
|
2024-03-24 16:45:58 +00:00
|
|
|
uses: actions/cache@v4
|
2022-05-14 05:56:57 +00:00
|
|
|
with:
|
|
|
|
path: .ccache
|
2022-12-03 22:08:05 +00:00
|
|
|
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
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Install Packages
|
2024-04-25 06:55:51 +00:00
|
|
|
run: |
|
|
|
|
tools/retry.sh wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc
|
|
|
|
sudo tools/retry.sh apt-add-repository -n 'deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-17 main'
|
|
|
|
sudo tools/retry.sh apt-get update
|
|
|
|
sudo tools/retry.sh apt-get -y install \
|
|
|
|
build-essential ccache clang-17 cmake curl extra-cmake-modules git libasound2-dev libaio-dev libavcodec-dev libavformat-dev libavutil-dev \
|
|
|
|
libcurl4-openssl-dev libdbus-1-dev libdecor-0-dev libegl-dev libevdev-dev libfontconfig-dev libfreetype-dev libfuse2 libgtk-3-dev libgudev-1.0-dev \
|
|
|
|
libharfbuzz-dev libinput-dev libopengl-dev libpcap-dev libpipewire-0.3-dev libpulse-dev libssl-dev libswresample-dev libswscale-dev libudev-dev \
|
|
|
|
libwayland-dev libx11-dev libx11-xcb-dev libxcb1-dev libxcb-composite0-dev libxcb-cursor-dev libxcb-damage0-dev libxcb-glx0-dev libxcb-icccm4-dev \
|
|
|
|
libxcb-image0-dev libxcb-keysyms1-dev libxcb-present-dev libxcb-randr0-dev libxcb-render0-dev libxcb-render-util0-dev libxcb-shape0-dev \
|
|
|
|
libxcb-shm0-dev libxcb-sync-dev libxcb-util-dev libxcb-xfixes0-dev libxcb-xinput-dev libxcb-xkb-dev libxext-dev libxkbcommon-x11-dev libxrandr-dev \
|
|
|
|
lld-17 llvm-17 ninja-build patchelf pkg-config zlib1g-dev
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Cache Dependencies
|
2022-07-02 04:00:56 +00:00
|
|
|
id: cache-deps
|
2024-03-24 16:45:58 +00:00
|
|
|
uses: actions/cache@v4
|
2022-05-14 05:56:57 +00:00
|
|
|
with:
|
2022-07-02 04:00:56 +00:00
|
|
|
path: ~/deps
|
2023-07-09 11:16:46 +00:00
|
|
|
key: ${{ inputs.os }} ${{ inputs.platform }} deps ${{ hashFiles('.github/workflows/scripts/linux/build-dependencies-qt.sh') }}
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Build Dependencies
|
2022-07-02 04:00:56 +00:00
|
|
|
if: steps.cache-deps.outputs.cache-hit != 'true'
|
2024-01-14 03:19:16 +00:00
|
|
|
run: .github/workflows/scripts/linux/build-dependencies-qt.sh "$HOME/deps"
|
2022-05-14 05:56:57 +00:00
|
|
|
|
2023-05-26 10:33:51 +00:00
|
|
|
- name: Download patches
|
2022-08-04 19:33:37 +00:00
|
|
|
run: |
|
|
|
|
cd bin/resources
|
2023-07-20 01:44:20 +00:00
|
|
|
aria2c -Z "${{ inputs.patchesUrl }}/patches.zip"
|
2022-08-04 19:33:37 +00:00
|
|
|
|
2022-05-14 05:56:57 +00:00
|
|
|
- name: Generate CMake
|
|
|
|
env:
|
|
|
|
ADDITIONAL_CMAKE_ARGS: ${{ inputs.cmakeflags }}
|
2023-06-05 13:38:37 +00:00
|
|
|
run: |
|
2024-04-25 06:55:51 +00:00
|
|
|
cmake -B build -G Ninja \
|
|
|
|
-DCMAKE_BUILD_TYPE=Release \
|
|
|
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON \
|
|
|
|
-DCMAKE_PREFIX_PATH="$HOME/deps" \
|
|
|
|
-DCMAKE_C_COMPILER=clang-17 \
|
|
|
|
-DCMAKE_CXX_COMPILER=clang++-17 \
|
|
|
|
-DCMAKE_EXE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
|
|
|
-DCMAKE_MODULE_LINKER_FLAGS_INIT="-fuse-ld=lld" \
|
|
|
|
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
|
|
|
-DENABLE_SETCAP=OFF \
|
|
|
|
-DDISABLE_ADVANCE_SIMD=TRUE \
|
|
|
|
$ADDITIONAL_CMAKE_ARGS
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Build PCSX2
|
|
|
|
working-directory: build
|
2024-04-25 06:55:51 +00:00
|
|
|
run: |
|
|
|
|
# Prepare the Cache
|
|
|
|
ccache -p
|
|
|
|
ccache -z
|
|
|
|
# Build
|
|
|
|
ninja
|
|
|
|
# Save the Cache
|
|
|
|
ccache -s
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
working-directory: ./build
|
|
|
|
run: ninja unittests
|
|
|
|
|
|
|
|
- name: Package AppImage
|
|
|
|
if: inputs.buildAppImage == true
|
|
|
|
env:
|
2022-07-02 04:00:56 +00:00
|
|
|
NAME: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
|
|
|
run: |
|
2023-06-25 05:26:32 +00:00
|
|
|
.github/workflows/scripts/linux/appimage-qt.sh "$(realpath .)" "$(realpath ./build)" "$HOME/deps" "$NAME"
|
|
|
|
mkdir -p "$GITHUB_WORKSPACE"/ci-artifacts/
|
|
|
|
mv "${NAME}.AppImage" "$GITHUB_WORKSPACE"/ci-artifacts/
|
2022-05-14 05:56:57 +00:00
|
|
|
|
|
|
|
- name: Upload artifact
|
|
|
|
if: inputs.buildAppImage == true
|
2024-01-06 20:44:44 +00:00
|
|
|
uses: actions/upload-artifact@v4
|
2022-05-14 05:56:57 +00:00
|
|
|
with:
|
|
|
|
name: ${{ steps.artifact-metadata.outputs.artifact-name }}
|
|
|
|
path: ci-artifacts
|