release v1.0.2 #36
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Build with Dual Cache (示例) | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| # 🔄 第1层:Docker BuildKit缓存(您已有的) | |
| - name: Docker cache - restore | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/.buildx-cache | |
| key: buildx-${{ runner.os }}-${{ github.sha }} | |
| restore-keys: | | |
| buildx-${{ runner.os }}- | |
| # 🔄 第2层:ccache编译缓存(新增) | |
| - name: ccache - restore | |
| uses: actions/cache@v4 | |
| with: | |
| path: /tmp/ccache | |
| key: ccache-${{ runner.os }}-${{ hashFiles('**/*.cpp', '**/*.cu', '**/*.h') }} | |
| restore-keys: | | |
| ccache-${{ runner.os }}- | |
| - name: Set up Docker Buildx | |
| uses: docker/setup-buildx-action@v3 | |
| # 🚀 使用双重缓存构建 | |
| - name: Build with dual cache | |
| uses: docker/build-push-action@v5 | |
| with: | |
| context: . | |
| file: ./Dockerfile | |
| push: false | |
| tags: lightkernel:latest | |
| cache-from: type=local,src=/tmp/.buildx-cache | |
| cache-to: type=local,dest=/tmp/.buildx-cache-new,mode=max | |
| # 挂载ccache缓存到容器中 | |
| cache-mount: | | |
| type=cache,target=/tmp/ccache,source=/tmp/ccache | |
| # 更新buildx缓存 | |
| - name: Move cache | |
| run: | | |
| rm -rf /tmp/.buildx-cache | |
| mv /tmp/.buildx-cache-new /tmp/.buildx-cache |