Skip to content

Commit

Permalink
Opt, 使用缓存提升构建速度
Browse files Browse the repository at this point in the history
  • Loading branch information
mingkuang-Chuyu committed Sep 9, 2024
1 parent ffde8b1 commit 5e44c30
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion .github/workflows/Build&Test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ jobs:

steps:
- uses: actions/checkout@v2

- name: 恢复编译产物
id: BinCache
uses: actions/cache@v2
with:
path: |
objs/**/*.obj
Lib/**/*
YY.Depends.Analyzer.exe
key: BinCache_${{github.sha}}

- name: 初始化
working-directory: ${{env.GITHUB_WORKSPACE}}
Expand Down Expand Up @@ -93,6 +103,7 @@ jobs:
}
- name: 执行编译
if: steps.BinCache.outputs.cache-hit != 'true'
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: cmd
run: |
Expand All @@ -114,6 +125,7 @@ jobs:
msbuild src\YY.Depends.Analyzer\YY.Depends.Analyzer.vcxproj "-p:Configuration=Release;Platform=Win32;OutDir=%GITHUB_WORKSPACE%\;SolutionDir=%GITHUB_WORKSPACE%\src\\"
if %ErrorLevel% NEQ 0 exit /b %ErrorLevel%
- name: 执行单元测试
if: steps.BinCache.outputs.cache-hit != 'true'
working-directory: ${{env.GITHUB_WORKSPACE}}
shell: pwsh
run: |
Expand Down Expand Up @@ -154,7 +166,7 @@ jobs:
throw "YY-Thunks.UnitTest单元测试失败!"
}
- uses: dorny/test-reporter@v1
if: success() || failure()
if: steps.BinCache.outputs.cache-hit != 'true' && (success() || failure())
with:
name: 单元测试报告
path: TestResults/*.trx
Expand Down

0 comments on commit 5e44c30

Please sign in to comment.