name: Smoke Test permissions: contents: read on: push: branches: - "dev-v2" paths: - ".github/workflows/smoke-testing.yml" - "3rdparty/include/**" - "cmake/**" - "CMakeLists.txt" - "include/**" - "resource/**" - "src/Cpp/**" - "src/MaaCore/**" - "tools/maadeps-download.py" - "tools/SmokeTesting/**" - "!**/*.md" pull_request: paths: - ".github/workflows/smoke-testing.yml" - "3rdparty/include/**" - "cmake/**" - "CMakeLists.txt" - "include/**" - "resource/**" - "src/Cpp/**" - "src/MaaCore/**" - "tools/maadeps-download.py" - "tools/SmokeTesting/**" - "!**/*.md" workflow_dispatch: concurrency: group: ${{ github.workflow }}-${{ github.event.pull_request.head.repo.full_name || github.repository }}-${{ github.head_ref || github.ref_name }}${{ github.ref == 'refs/heads/dev-v2' && format('-{0}', github.sha) || '' }} cancel-in-progress: true jobs: smoke-testing: name: Run Smoke Test runs-on: macos-latest steps: - name: Checkout repository uses: actions/checkout@v7 with: show-progress: false - name: Generate cache key id: cache_key continue-on-error: true 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 for Smoke Test if: ${{ steps.cache_key.outputs.key != '' }} id: smoke-cache uses: actions/cache/restore@v6 continue-on-error: true with: key: ${{ steps.cache_key.outputs.key }} path: | ./install/libfastdeploy_ppocr.dylib ./install/libMaaCore.dylib ./install/libMaaUtils.dylib ./install/libonnxruntime.1.19.2.dylib ./install/libopencv_world4.4.11.0.dylib ./install/smoke_test - name: Fetch submodules if: steps.smoke-cache.outputs.cache-hit != 'true' shell: bash run: bash ./.github/scripts/sync-optional-submodules.sh --init --depth 1 src/MaaUtils - name: Cache MaaDeps if: steps.smoke-cache.outputs.cache-hit != 'true' id: maadeps-cache uses: actions/cache@v6 continue-on-error: true with: path: ./src/MaaUtils/MaaDeps key: ${{ runner.os }}-arm64-maadeps-${{ hashFiles('tools/maadeps-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 arm64-osx - name: Configure, build and install if: steps.smoke-cache.outputs.cache-hit != 'true' run: | cmake -B build --preset smoke-test cmake --build build --preset smoke-test --parallel $(sysctl -n hw.logicalcpu) cmake --install build --config Debug - name: Make link to Smoke Test cache if: steps.smoke-cache.outputs.cache-hit == 'true' run: | ln -s "$(pwd)/resource" install/resource - name: Run tests run: | sh ./tools/SmokeTesting/run_tests.sh - name: Save cache for Smoke Test (only in dev-v2) if: steps.smoke-cache.outputs.cache-hit != 'true' && github.ref == 'refs/heads/dev-v2' uses: actions/cache/save@v6 continue-on-error: true with: key: ${{ steps.cache_key.outputs.key }} path: | ./install/libfastdeploy_ppocr.dylib ./install/libMaaCore.dylib ./install/libMaaUtils.dylib ./install/libonnxruntime.1.19.2.dylib ./install/libopencv_world4.4.11.0.dylib ./install/smoke_test - name: Upload logs if: always() uses: actions/upload-artifact@v7 with: name: logs path: ./install/debug