Files
MaaAssistantArknights/.github/workflows/smoke-testing.yml
2025-09-13 14:55:15 +02:00

145 lines
4.3 KiB
YAML

name: smoke-testing
on:
push:
paths:
- "3rdparty/include/**"
- "include/**"
- "src/Cpp/**"
- "src/MaaCore/**"
- "resource/**"
- "!**/*.md"
- "cmake/**"
- "CMakeLists.txt"
- "tools/maadeps-download.py"
pull_request:
paths:
- "3rdparty/include/**"
- "include/**"
- "src/Cpp/**"
- "src/MaaCore/**"
- "resource/**"
- "!**/*.md"
- "cmake/**"
- "CMakeLists.txt"
- "tools/maadeps-download.py"
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
smoke-testing:
# 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: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v5
with:
show-progress: false
- name: Generate cache key
id: cache_key
run: |
echo "key=Smoke-testing-${{ hashFiles('src/Cpp/**', 'src/MaaCore/**', '3rdparty/include/**', 'include/**', 'cmake/**', 'CMakeLists.txt', 'tools/maadeps-download.py', 'tools/linux-toolchain-download.py') }}" >> $GITHUB_OUTPUT
- name: Restore cache smoke-testing
id: smoke-cache
uses: actions/cache/restore@v4
with:
key: ${{ steps.cache_key.outputs.key }}
path: |
./AsstCaller.h
./AsstPort.h
./libc++.so.1
./libc++abi.so.1
./libfastdeploy_ppocr.so
./libMaaCore.so
./libonnxruntime.so.1
./libopencv_world4.so.411
./libunwind.so.1
./smoke_test
- name: Fetch submodules
if: steps.smoke-cache.outputs.cache-hit != 'true'
run: |
git submodule update --init --depth 1 3rdparty/EmulatorExtras
- name: Cache MaaDeps
if: steps.smoke-cache.outputs.cache-hit != 'true'
id: maadeps-cache
uses: actions/cache@v4
with:
path: ./MaaDeps
key: ${{ runner.os }}-x64-maadeps-${{ hashFiles('tools/maadeps-download.py', 'tools/linux-toolchain-download.py') }}
- name: Bootstrap MaaDeps
if: steps.smoke-cache.outputs.cache-hit != 'true' && steps.maadeps-cache.outputs.cache-hit != 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
python3 tools/maadeps-download.py x64-linux
python3 tools/linux-toolchain-download.py x64
- name: Install llvm-20
if: steps.smoke-cache.outputs.cache-hit != 'true'
run: |
wget https://apt.llvm.org/llvm.sh
chmod +x llvm.sh
sudo ./llvm.sh 20
rm llvm.sh
- name: Config cmake
if: steps.smoke-cache.outputs.cache-hit != 'true'
run: |
mkdir -p build
cmake -B build \
-DCMAKE_BUILD_TYPE=Debug \
-DMAADEPS_TRIPLET='maa-x64-linux' \
-DBUILD_SMOKE_TEST=ON \
-DINSTALL_RESOURCE=ON \
-DCMAKE_TOOLCHAIN_FILE=cmake/linux/maa-x64-linux-toolchain.cmake
- name: Build
if: steps.smoke-cache.outputs.cache-hit != 'true'
run: |
cmake --build build --config Debug --parallel $(nproc)
- name: Install
if: steps.smoke-cache.outputs.cache-hit != 'true'
run: |
mkdir -p install
cmake --install build --prefix ./ --config Debug
- name: Run tests
run: |
./tools/SmokeTesting/run_tests.sh
- name: Save cache smoke-testing (only in dev)
if: steps.smoke-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/dev'
uses: actions/cache/save@v4
with:
key: ${{ steps.cache_key.outputs.key }}
path: |
./AsstCaller.h
./AsstPort.h
./libc++.so.1
./libc++abi.so.1
./libfastdeploy_ppocr.so
./libMaaCore.so
./libonnxruntime.so.1
./libopencv_world4.so.411
./libunwind.so.1
./smoke_test
- name: Upload logs
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: ./install/debug