Make GH Actions use matrix for runs-on

This commit is contained in:
Margen67 2022-02-16 18:37:15 -08:00 committed by Gliniak
parent 8698062213
commit 81ca27575c

View file

@ -23,50 +23,58 @@ on:
jobs: jobs:
build-windows: build-windows:
runs-on: windows-2019 runs-on: ${{ matrix.runs-on }}
env: env:
POWERSHELL_TELEMETRY_OPTOUT: 1 POWERSHELL_TELEMETRY_OPTOUT: 1
strategy: strategy:
fail-fast: false fail-fast: false
matrix:
runs-on: [windows-2019, windows-latest]
include:
- runs-on: windows-latest
vsver: VS2022
- runs-on: windows-2019
vsver: VS2019
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v2
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Setup - name: Setup
run: .\xb setup run: .\xb setup
- name: Build - name: Build
run: .\xb build --config=Release --target=src\xenia-app --target=src\xenia-vfs-dump run: .\xb build --config=Release --target=src\xenia-app --target=src\xenia-vfs-dump
- name: Prepare artifacts - name: Prepare artifacts
run: | run: |
robocopy . build\bin\${{ runner.os }}\Release LICENSE /r:0 /w:0 robocopy . build\bin\${{ runner.os }}\Release LICENSE /r:0 /w:0
robocopy build\bin\${{ runner.os }}\Release artifacts\xenia_canary xenia_canary.exe xenia_canary.pdb LICENSE /r:0 /w:0 robocopy build\bin\${{ runner.os }}\Release artifacts\xenia_canary xenia_canary.exe xenia_canary.pdb LICENSE /r:0 /w:0
robocopy build\bin\${{ runner.os }}\Release artifacts\xenia-vfs-dump xenia-vfs-dump.exe xenia-vfs-dump.pdb LICENSE /r:0 /w:0 robocopy build\bin\${{ runner.os }}\Release artifacts\xenia-vfs-dump xenia-vfs-dump.exe xenia-vfs-dump.pdb LICENSE /r:0 /w:0
If ($LastExitCode -le 7) { echo "LastExitCode = $LastExitCode";$LastExitCode = 0 } If ($LastExitCode -le 7) { echo "LastExitCode = $LastExitCode";$LastExitCode = 0 }
- name: Upload xenia-vfs-dump artifacts - name: Upload xenia-vfs-dump artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: xenia-vfs-dump_canary name: xenia-vfs-dump_canary
path: artifacts\xenia-vfs-dump path: artifacts\xenia-vfs-dump
if-no-files-found: error if-no-files-found: error
- name: Upload xenia artifacts - name: Upload xenia artifacts
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2
with: with:
name: xenia_canary name: xenia_canary_${{ matrix.vsver }}
path: artifacts\xenia_canary path: artifacts\xenia_canary
if-no-files-found: error if-no-files-found: error
- name: Create release - name: Create release
if: | if: |
github.repository == 'xenia-canary/xenia-canary' && matrix.runs-on == 'windows-2019' &&
github.event.action != 'pull_request' && github.repository == 'xenia-canary/xenia-canary' &&
contains(github.ref, 'refs/heads/canary') github.event.action != 'pull_request' &&
env: contains(github.ref, 'refs/heads/canary')
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} env:
run: | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
$asset="xenia_canary.zip" run: |
7z a $asset .\artifacts\xenia_canary\*.exe LICENSE $asset="xenia_canary.zip"
If ($(Get-Item $asset).length -le 100000) { 7z a $asset .\artifacts\xenia_canary\*.exe LICENSE
Throw "Error: Archive $asset too small!" If ($(Get-Item $asset).length -le 100000) {
} Throw "Error: Archive $asset too small!"
$tag=$env:GITHUB_SHA.SubString(0,7) }
$title="${tag}_$($env:GITHUB_REF -replace 'refs/heads/', '')" $tag=$env:GITHUB_SHA.SubString(0,7)
gh release create $tag $asset --target $env:GITHUB_SHA -t $title $title="${tag}_$($env:GITHUB_REF -replace 'refs/heads/', '')"
gh release create $tag $asset --target $env:GITHUB_SHA -t $title