mirror of
https://github.com/MaaAssistantArknights/MaaAssistantArknights.git
synced 2026-07-16 09:50:40 +08:00
135 lines
3.7 KiB
YAML
135 lines
3.7 KiB
YAML
name: smoke-testing
|
|
|
|
on:
|
|
push:
|
|
paths:
|
|
- "3rdparty/include/**"
|
|
- "include/**"
|
|
- "src/**"
|
|
- "cmake/**"
|
|
- "CMakeLists.txt"
|
|
- "MAA.sln"
|
|
- "resource/**"
|
|
- "MaaDeps/**"
|
|
- "!**/*.md"
|
|
pull_request:
|
|
paths:
|
|
- "3rdparty/include/**"
|
|
- "include/**"
|
|
- "src/**"
|
|
- "cmake/**"
|
|
- "CMakeLists.txt"
|
|
- "MAA.sln"
|
|
- "resource/**"
|
|
- "MaaDeps/**"
|
|
- "!**/*.md"
|
|
workflow_dispatch:
|
|
|
|
concurrency:
|
|
group: ${{ github.workflow }}-${{ github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
build:
|
|
# Prevent duplicate runs on organization branches with PRs
|
|
if: github.event_name != 'pull_request' ||
|
|
github.event.pull_request.head.repo.full_name !=
|
|
github.event.pull_request.base.repo.full_name
|
|
runs-on: windows-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
with:
|
|
show-progress: false
|
|
submodules: recursive
|
|
|
|
- name: Cache .nuke/temp, ~/.nuget/packages
|
|
id: cache-nuget
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
.nuke/temp
|
|
~/.nuget/packages
|
|
key: ${{ runner.os }}-x64-${{ hashFiles('**/global.json', '**/*.csproj') }}
|
|
|
|
- name: Restore dependencies
|
|
if: steps.cache-nuget.outputs.cache-hit != 'true'
|
|
run: dotnet restore
|
|
|
|
- name: Cache MaaDeps
|
|
id: cache-maadeps
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
./MaaDeps
|
|
key: ${{ runner.os }}-x64-maadeps-${{ hashFiles('./maadeps-download.py') }}
|
|
|
|
- name: Bootstrap MaaDeps
|
|
if: steps.cache-maadeps.outputs.cache-hit != 'true'
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
python3 maadeps-download.py x64-windows
|
|
|
|
- name: Add msbuild to PATH
|
|
uses: microsoft/setup-msbuild@v2
|
|
|
|
- name: Build MaaSample
|
|
run: |
|
|
MSBUILD src/Cpp/MaaSample.slnf -t:restore,build -p:Configuration="Debug" -p:Platform="x64" -m
|
|
|
|
- name: Save build artifact to cache
|
|
uses: actions/cache/save@v4
|
|
with:
|
|
key: DELETE_KEY-smoke-testing-artifact-${{ github.ref }}
|
|
path: |
|
|
./x64/Debug
|
|
|
|
test:
|
|
# Prevent duplicate runs on organization branches with PRs
|
|
if: github.event_name != 'pull_request' ||
|
|
github.event.pull_request.head.repo.full_name !=
|
|
github.event.pull_request.base.repo.full_name
|
|
|
|
needs: build
|
|
runs-on: windows-latest
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
client: [Official, YostarJP, YostarEN, YostarKR, txwy]
|
|
|
|
steps:
|
|
- name: Restore build artifact from cache
|
|
id: cache-smoke-testing
|
|
uses: actions/cache/restore@v4
|
|
with:
|
|
key: DELETE_KEY-smoke-testing-artifact-${{ github.ref }}
|
|
path: |
|
|
./x64/Debug
|
|
|
|
- name: Run tests - ${{ matrix.client }}
|
|
run: |
|
|
./x64/Debug/Sample.exe ${{ matrix.client }}
|
|
|
|
- name: Upload logs
|
|
if: always()
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: log-${{ matrix.client }}
|
|
path: ./x64/Debug/debug
|
|
|
|
- name: Delete cache
|
|
if: always()
|
|
run: |
|
|
if ("${{ matrix.client }}" -eq "Official") {
|
|
$cacheKey = "DELETE_KEY-smoke-testing-artifact-${{ github.ref }}"
|
|
|
|
Write-Host "Deleting cache: $cacheKey"
|
|
|
|
curl -L -X DELETE `
|
|
-H "Accept: application/vnd.github+json" `
|
|
-H "Authorization: Bearer ${{secrets.GITHUB_TOKEN}}" `
|
|
-H "X-GitHub-Api-Version: 2022-11-28" `
|
|
"https://api.github.com/repos/MaaAssistantArknights/MaaAssistantArknights/actions/caches?key=$cacheKey"
|
|
}
|