mirror of https://github.com/PCSX2/pcsx2.git
121 lines
4.3 KiB
YAML
121 lines
4.3 KiB
YAML
name: Windows Build
|
|
|
|
# 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
|
|
paths-ignore:
|
|
- .gitignore
|
|
- "**/*.md"
|
|
- .clang-format
|
|
- debian-packager/
|
|
- bin/PCSX2_keys.ini.default
|
|
- "pcsx2/PAD/Linux/**"
|
|
pull_request:
|
|
branches:
|
|
- master
|
|
paths-ignore:
|
|
- .gitignore
|
|
- "**/*.md"
|
|
- .clang-format
|
|
- debian-packager/
|
|
- bin/PCSX2_keys.ini.default
|
|
- "pcsx2/PAD/Linux/**"
|
|
workflow_dispatch:
|
|
inputs:
|
|
retainDebugArtifacts:
|
|
description: 'Retain debug artifacts (.pdb/.exp/.lib) for an easier debugging experience'
|
|
required: true
|
|
default: 'false'
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
# Prevent one build from failing everything (although maybe those should be included as experimental builds instead)
|
|
fail-fast: false
|
|
matrix:
|
|
os: [windows-2019]
|
|
platform: [Win32, x64]
|
|
experimental: [false]
|
|
|
|
name: ${{ matrix.os }}-${{ matrix.platform }}
|
|
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.
|
|
timeout-minutes: 30
|
|
|
|
steps:
|
|
# NOTE - useful for debugging
|
|
# - name: Dump GitHub context
|
|
# env:
|
|
# GITHUB_CONTEXT: ${{ toJson(github) }}
|
|
# run: |
|
|
# echo "$GITHUB_CONTEXT"
|
|
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Checkout Submodules
|
|
if: steps.cache-submodules.outputs.cache-hit != 'true'
|
|
run: git submodule update --init --recursive --jobs 2
|
|
|
|
- name: Verify VS Project Files
|
|
shell: powershell
|
|
run: .\.github\workflows\scripts\windows\validate-vs-filters.ps1
|
|
|
|
- name: Setup msbuild
|
|
uses: microsoft/setup-msbuild@v1.0.2
|
|
with:
|
|
vs-version: 16.7
|
|
|
|
- name: Build PCSX2
|
|
env:
|
|
# Set to 'true' to retain the .pdb / .exp / .lib, etc files which can be useful for repro'ing issues that only occur in the compiled .exe
|
|
RetainDebuggingArtifacts: "${{ github.event.inputs.retainDebugArtifacts == 'true' }}"
|
|
run: msbuild "buildbot.xml" /m /v:n /t:ReleaseAll /p:Platform=${{ matrix.platform }}
|
|
|
|
- name: Prepare Artifact Metadata
|
|
id: artifact-metadata
|
|
shell: bash
|
|
run: |
|
|
ARCH=$([ "${{ matrix.platform }}" == Win32 ] && 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: Prepare Artifact Folder
|
|
shell: bash
|
|
working-directory: ./bin
|
|
run: |
|
|
shopt -s extglob dotglob
|
|
mkdir "${{ steps.artifact-metadata.outputs.name }}"
|
|
mv !("${{ steps.artifact-metadata.outputs.name }}") "${{ steps.artifact-metadata.outputs.name }}"
|
|
shopt -u dotglob
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v2
|
|
continue-on-error: true
|
|
with:
|
|
name: ${{ steps.artifact-metadata.outputs.name }}
|
|
path: bin
|
|
retention-days: 30 # https://docs.github.com/en/free-pro-team@latest/actions/reference/usage-limits-billing-and-administration#artifact-and-log-retention-policy
|