2021-07-07 01:23:04 +00:00
|
|
|
name: 🐧 Linux Builds
|
2020-09-11 05:57:09 +00:00
|
|
|
|
|
|
|
# Controls when the action will run. Triggers the workflow on push or pull request
|
|
|
|
# events but only for the master branch
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- master
|
2021-10-18 04:18:25 +00:00
|
|
|
tags:
|
|
|
|
- v*
|
2020-09-11 05:57:09 +00:00
|
|
|
pull_request:
|
|
|
|
branches:
|
|
|
|
- master
|
2020-09-18 01:19:04 +00:00
|
|
|
paths-ignore:
|
2021-10-18 04:18:25 +00:00
|
|
|
- "**/*.md"
|
|
|
|
- "**/*.bat"
|
|
|
|
- "**/*.cmd"
|
|
|
|
- "**/*.props"
|
|
|
|
- "**/*.sln"
|
|
|
|
- ".clang-format"
|
|
|
|
- ".codacy.yaml"
|
|
|
|
- ".github/*"
|
|
|
|
- ".github/workflows/lint-gamedb.yml"
|
|
|
|
- ".github/workflows/macos-workflow.yml"
|
|
|
|
- ".github/workflows/pr-triage.yml"
|
|
|
|
- ".github/workflows/scripts/windows/**"
|
|
|
|
- ".github/workflows/scripts/validation/**"
|
|
|
|
- ".github/workflows/windows-workflow.yml"
|
|
|
|
- ".gitignore"
|
|
|
|
- "bin/PCSX2_keys.ini.default"
|
|
|
|
- "build.sh"
|
|
|
|
- "buildbot.xml"
|
|
|
|
- "pcsx2/CDVD/Windows/**"
|
|
|
|
- "pcsx2/DEV9/Win32/**"
|
|
|
|
- "pcsx2/PAD/Windows/**"
|
|
|
|
- "pcsx2/SPU2/Windows/**"
|
|
|
|
- "pcsx2/USB/Win32/**"
|
|
|
|
- "pcsx2/windows/**"
|
2020-09-11 05:57:09 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
strategy:
|
|
|
|
# Prevent one build from failing everything (although maybe those should be included as experimental builds instead)
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
2020-11-24 00:44:30 +00:00
|
|
|
include:
|
2021-07-13 14:52:58 +00:00
|
|
|
- os: ubuntu-18.04
|
2020-11-24 00:44:30 +00:00
|
|
|
platform: x86
|
|
|
|
compiler: gcc
|
2021-09-02 03:43:08 +00:00
|
|
|
cmakeflags: -DLTO_PCSX2_CORE=ON
|
2021-07-08 21:14:54 +00:00
|
|
|
appimage: true
|
2020-11-24 00:44:30 +00:00
|
|
|
experimental: false
|
2021-07-13 14:52:58 +00:00
|
|
|
- os: ubuntu-18.04
|
2020-11-24 00:44:30 +00:00
|
|
|
platform: x64
|
|
|
|
compiler: gcc
|
2021-09-02 03:43:08 +00:00
|
|
|
cmakeflags: -DLTO_PCSX2_CORE=ON
|
2021-07-08 21:14:54 +00:00
|
|
|
appimage: true
|
2020-11-24 00:44:30 +00:00
|
|
|
experimental: false
|
2021-07-13 14:52:58 +00:00
|
|
|
- os: ubuntu-18.04
|
2020-11-24 00:44:30 +00:00
|
|
|
platform: x86
|
|
|
|
compiler: clang
|
2020-11-24 10:48:49 +00:00
|
|
|
# Need to disable PCH until cmake 3.17
|
|
|
|
# (PCH conflicts with ccache, fixed by https://gitlab.kitware.com/cmake/cmake/-/merge_requests/4400)
|
|
|
|
cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
|
2021-07-08 21:14:54 +00:00
|
|
|
detail: " nopch"
|
2021-10-18 04:18:25 +00:00
|
|
|
appimage: false
|
2020-11-24 00:44:30 +00:00
|
|
|
experimental: false
|
2021-07-13 14:52:58 +00:00
|
|
|
- os: ubuntu-18.04
|
2020-11-24 00:44:30 +00:00
|
|
|
platform: x86
|
|
|
|
compiler: gcc
|
|
|
|
cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON
|
2021-07-08 21:14:54 +00:00
|
|
|
detail: " nopch"
|
2021-10-18 04:18:25 +00:00
|
|
|
appimage: false
|
2020-11-24 10:48:49 +00:00
|
|
|
experimental: false
|
2021-07-13 14:52:58 +00:00
|
|
|
- os: ubuntu-18.04
|
2021-05-13 09:13:40 +00:00
|
|
|
platform: x86
|
|
|
|
compiler: gcc
|
|
|
|
cmakeflags: -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -DARCH_FLAG=-march=haswell
|
2021-07-08 21:14:54 +00:00
|
|
|
detail: " avx2 nopch"
|
2021-10-18 04:18:25 +00:00
|
|
|
appimage: false
|
2021-05-13 09:13:40 +00:00
|
|
|
experimental: false
|
2020-09-11 05:57:09 +00:00
|
|
|
|
2021-07-08 21:14:54 +00:00
|
|
|
name: ${{ matrix.platform }} | ${{ matrix.compiler }}${{ matrix.detail }}
|
2020-09-11 05:57:09 +00:00
|
|
|
runs-on: ${{ matrix.os }}
|
|
|
|
continue-on-error: ${{ matrix.experimental }}
|
|
|
|
# Set some sort of timeout in the event of run-away builds. We are limited on concurrent jobs so, get rid of them.
|
2021-11-07 03:48:53 +00:00
|
|
|
timeout-minutes: 60
|
2020-09-11 05:57:09 +00:00
|
|
|
|
2021-08-19 03:19:26 +00:00
|
|
|
env:
|
|
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
|
|
CCACHE_DIR: ${{ github.workspace }}/.ccache
|
|
|
|
CCACHE_COMPRESS: true
|
|
|
|
CCACHE_COMPRESSLEVEL: 9
|
|
|
|
CCACHE_MAXSIZE: 100M
|
2021-12-01 03:31:56 +00:00
|
|
|
SDL: SDL2-2.0.16
|
2021-12-01 05:03:52 +00:00
|
|
|
PATCHELF_VERSION: 0.12
|
2021-08-19 03:19:26 +00:00
|
|
|
|
2020-09-11 05:57:09 +00:00
|
|
|
steps:
|
|
|
|
# NOTE - useful for debugging
|
|
|
|
# - name: Dump GitHub context
|
|
|
|
# env:
|
|
|
|
# GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
|
|
# run: |
|
|
|
|
# echo "$GITHUB_CONTEXT"
|
|
|
|
# echo ${{ github.event.pull_request.title }}
|
|
|
|
|
2020-09-18 18:26:32 +00:00
|
|
|
- name: Checkout Repository
|
2020-09-11 05:57:09 +00:00
|
|
|
uses: actions/checkout@v2
|
2020-09-18 18:26:32 +00:00
|
|
|
|
|
|
|
- name: Checkout Submodules
|
|
|
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
2021-05-07 13:45:52 +00:00
|
|
|
run: git submodule update --init --recursive -j $(getconf _NPROCESSORS_ONLN)
|
2020-09-11 05:57:09 +00:00
|
|
|
|
|
|
|
# -- SETUP CCACHE - https://cristianadam.eu/20200113/speeding-up-c-plus-plus-github-actions-using-ccache/
|
|
|
|
- name: Prepare ccache timestamp
|
|
|
|
id: ccache_cache_timestamp
|
|
|
|
shell: cmake -P {0}
|
|
|
|
run: |
|
|
|
|
string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC)
|
|
|
|
message("::set-output name=timestamp::${current_date}")
|
|
|
|
|
2020-09-28 00:18:19 +00:00
|
|
|
- name: ccache cache files
|
2021-11-29 04:02:42 +00:00
|
|
|
uses: actions/cache@v2.1.7
|
2020-09-28 00:18:19 +00:00
|
|
|
with:
|
|
|
|
path: .ccache
|
2021-07-08 21:14:54 +00:00
|
|
|
key: ${{ matrix.os }} ${{ matrix.platform }} ${{ matrix.compiler }}${{ matrix.detail }} ccache ${{ steps.ccache_cache_timestamp.outputs.timestamp }}
|
|
|
|
restore-keys: ${{ matrix.os }} ${{ matrix.platform }} ${{ matrix.compiler }}${{ matrix.detail }} ccache
|
2020-09-11 05:57:09 +00:00
|
|
|
|
2021-07-13 14:52:58 +00:00
|
|
|
- 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}"
|
2021-10-18 04:18:25 +00:00
|
|
|
echo "##[set-output name=arch;]${ARCH}"
|
|
|
|
|
2020-09-12 00:12:55 +00:00
|
|
|
- name: Install Packages
|
2020-09-11 05:57:09 +00:00
|
|
|
env:
|
|
|
|
PLATFORM: ${{ matrix.platform }}
|
2020-10-17 00:09:15 +00:00
|
|
|
COMPILER: ${{ matrix.compiler }}
|
2021-07-13 14:52:58 +00:00
|
|
|
run: .github/workflows/scripts/linux/install-packages.sh
|
2020-09-11 05:57:09 +00:00
|
|
|
|
2021-12-01 05:03:52 +00:00
|
|
|
- name: Cache Dependencies
|
2021-12-01 03:31:56 +00:00
|
|
|
uses: actions/cache@v2.1.7
|
|
|
|
with:
|
2021-12-01 05:03:52 +00:00
|
|
|
path: |
|
|
|
|
3rdparty/${{ env.SDL }}
|
|
|
|
3rdparty/patchelf-${{ env.PATCHELF_VERSION }}
|
|
|
|
key: ${{ matrix.os }} ${{ matrix.platform }} ${{ env.SDL }} patchelf-${{ env.PATCHELF_VERSION }}
|
2021-12-01 03:31:56 +00:00
|
|
|
|
2021-12-01 05:03:52 +00:00
|
|
|
- name: Build Dependencies
|
2021-12-01 03:31:56 +00:00
|
|
|
run: |
|
2021-12-01 05:03:52 +00:00
|
|
|
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
|
2021-12-01 03:31:56 +00:00
|
|
|
if [[ ! -e 3rdparty/${{ env.SDL }} ]]; then
|
|
|
|
curl -sL https://libsdl.org/release/${{ env.SDL }}.tar.gz | tar -xzC 3rdparty
|
|
|
|
cd 3rdparty/${{ env.SDL }}
|
|
|
|
if [ "${{ matrix.platform }}" == "x86" ]; then
|
|
|
|
./configure --build=i686-pc-linux-gnu CC=${{ matrix.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
|
|
|
|
|
2020-10-17 00:09:15 +00:00
|
|
|
- name: Generate CMake
|
2020-09-12 00:12:55 +00:00
|
|
|
env:
|
|
|
|
PLATFORM: ${{ matrix.platform }}
|
2020-10-17 00:09:15 +00:00
|
|
|
COMPILER: ${{ matrix.compiler }}
|
2020-11-24 00:44:30 +00:00
|
|
|
ADDITIONAL_CMAKE_ARGS: ${{ matrix.cmakeflags }}
|
2021-07-13 14:52:58 +00:00
|
|
|
run: .github/workflows/scripts/linux/generate-cmake.sh
|
2020-10-17 00:09:15 +00:00
|
|
|
|
|
|
|
- name: Build PCSX2
|
2021-05-07 13:45:52 +00:00
|
|
|
working-directory: build
|
2020-10-17 00:09:15 +00:00
|
|
|
run: ../.github/workflows/scripts/linux/compile.sh
|
2021-04-24 04:51:02 +00:00
|
|
|
|
|
|
|
- name: Run Tests
|
|
|
|
working-directory: ./build
|
|
|
|
run: ninja unittests
|
2021-10-18 04:18:25 +00:00
|
|
|
|
2021-07-13 14:52:58 +00:00
|
|
|
- name: Package AppImage
|
2021-10-18 04:18:25 +00:00
|
|
|
if: matrix.appimage == true
|
2021-07-13 14:52:58 +00:00
|
|
|
env:
|
|
|
|
PLATFORM: ${{ matrix.platform }}
|
|
|
|
COMPILER: ${{ matrix.compiler }}
|
|
|
|
name: ${{ steps.artifact-metadata.outputs.name }}
|
|
|
|
run: .github/workflows/scripts/linux/appimage.sh
|
|
|
|
|
|
|
|
- name: Upload artifact
|
2021-10-18 04:18:25 +00:00
|
|
|
if: matrix.appimage == true
|
2021-07-13 14:52:58 +00:00
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: ${{ steps.artifact-metadata.outputs.name }}
|
2021-10-18 04:18:25 +00:00
|
|
|
path: ci-artifacts
|
|
|
|
|
|
|
|
# ---- Release / Tagging related steps ----
|
|
|
|
- name: Prepare Build Artifacts
|
2021-11-02 00:39:00 +00:00
|
|
|
if: github.repository == 'PCSX2/pcsx2' && startsWith(github.ref, 'refs/tags/') && matrix.appimage == true
|
2021-10-18 04:18:25 +00:00
|
|
|
run: |
|
|
|
|
mv ./ci-artifacts/*.AppImage ./ci-artifacts/linux-AppImage-${{ steps.artifact-metadata.outputs.arch }}.AppImage
|
|
|
|
ls ./ci-artifacts/
|
|
|
|
|
|
|
|
- name: Upload Assets and Potential Publish Release
|
2021-11-02 00:39:00 +00:00
|
|
|
if: github.repository == 'PCSX2/pcsx2' && startsWith(github.ref, 'refs/tags/') && matrix.appimage == true
|
2021-10-18 04:18:25 +00:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.BOT_PAT }}
|
|
|
|
ASSET_DIR: ${{ github.WORKSPACE }}/ci-artifacts
|
2021-10-19 00:42:48 +00:00
|
|
|
ASSET_EXTENSION: AppImage
|
2021-10-18 04:18:25 +00:00
|
|
|
TAG_TO_SEARCH_FOR: ${{ github.REF }}
|
|
|
|
run: |
|
|
|
|
cd ./.github/workflows/scripts/releases/upload-release-artifacts
|
|
|
|
npm ci
|
|
|
|
node index.js
|