xenia-canary/.github/workflows/Windows_build.yml

107 lines
3.2 KiB
YAML
Raw Normal View History

name: Windows build
2021-01-31 10:10:55 +00:00
on:
push:
paths-ignore:
2022-03-07 22:53:58 +00:00
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
2021-01-31 10:10:55 +00:00
- '.github/*'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- 'docs/**'
2022-03-07 22:53:58 +00:00
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
2021-01-31 10:10:55 +00:00
- 'LICENSE'
pull_request:
paths-ignore:
2022-03-07 22:53:58 +00:00
- '.clang-format'
- '.drone.star'
- '.gitattributes'
- '.gitignore'
- '.gdbinit'
2021-01-31 10:10:55 +00:00
- '.github/*'
- '.github/*_TEMPLATE/**'
- '*.md'
- '*.yml'
- 'docs/**'
2022-03-07 22:53:58 +00:00
- 'src/**/*_posix.*'
- 'src/**/*_linux.*'
- 'src/**/*_gnulinux.*'
- 'src/**/*_x11.*'
- 'src/**/*_gtk.*'
- 'src/**/*_android.*'
- 'src/**/*_mac.*'
2021-01-31 10:10:55 +00:00
- 'LICENSE'
workflow_dispatch:
jobs:
lint:
name: Lint
runs-on: windows-2022
steps:
2024-03-21 13:32:31 +00:00
- uses: actions/checkout@v4
- name: Check Clang-Format Version
run: clang-format --version
- name: Lint
run: .\xb lint --all
2021-01-31 10:10:55 +00:00
build-windows:
2024-02-16 01:30:44 +00:00
name: Build (Windows) # runner.os can't be used here
runs-on: windows-2019
2024-03-21 13:32:31 +00:00
needs: lint
2021-01-31 10:10:55 +00:00
env:
POWERSHELL_TELEMETRY_OPTOUT: 1
steps:
2024-02-07 08:45:49 +00:00
- uses: actions/checkout@v4
2022-02-17 02:37:15 +00:00
with:
fetch-depth: 0
- name: Setup
run: .\xb setup
- name: Build
run: .\xb build --config=Release --target=src\xenia-app
2022-02-17 02:37:15 +00:00
- name: Prepare artifacts
run: |
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
If ($LastExitCode -le 7) { echo "LastExitCode = $LastExitCode";$LastExitCode = 0 }
2024-02-16 01:30:44 +00:00
- name: Upload xenia canary artifacts
2024-02-07 08:45:49 +00:00
uses: actions/upload-artifact@v4
2022-02-17 02:37:15 +00:00
with:
2024-02-16 01:30:44 +00:00
name: xenia_canary
2022-02-17 02:37:15 +00:00
path: artifacts\xenia_canary
if-no-files-found: error
- name: Create release
if: |
github.repository == 'xenia-canary/xenia-canary' &&
github.event.action != 'pull_request' &&
contains(github.ref, 'refs/heads/canary') &&
github.ref != 'refs/heads/canary_base'
2022-02-17 02:37:15 +00:00
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$asset="xenia_canary.zip"
2022-07-22 04:58:43 +00:00
rm -recurse -force artifacts\xenia_canary\*.pdb # Ideally this would use xr, but I can't get it to work
7z a $asset .\artifacts\xenia_canary\*
2022-02-17 02:37:15 +00:00
If ($(Get-Item $asset).length -le 100000) {
Throw "Error: Archive $asset too small!"
}
$tag=$env:GITHUB_SHA.SubString(0,7)
2022-05-18 05:47:04 +00:00
$branch=$($env:GITHUB_REF -replace 'refs/heads/')
$title="${tag}_$branch"
2022-02-17 02:37:15 +00:00
gh release create $tag $asset --target $env:GITHUB_SHA -t $title
2022-02-28 14:54:53 +00:00
# Remove canary_ to prevent conflicts from tag
2022-05-18 05:47:04 +00:00
$tag=$($branch -replace 'canary_')
2022-02-28 14:54:53 +00:00
gh release delete $tag -y
2022-03-05 08:52:16 +00:00
git push --delete origin $tag
git tag -d $tag
2022-02-28 14:54:53 +00:00
gh release create $tag $asset --target $env:GITHUB_SHA -t $branch