Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: actions add cache #2088

Merged
merged 1 commit into from
Nov 1, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 36 additions & 16 deletions .github/workflows/pika.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
with:
go-version: 1.19

- name: cache dependencies
- name: Cache dependencies
uses: actions/cache@v2
id: cache
with:
Expand All @@ -34,7 +34,7 @@ jobs:
~/.cache/pip
key: ${{ runner.os }}-dependencies

- name: install Deps
- name: Install Deps
if: ${{ steps.cache.output.cache-hit != 'true' }}
run: |
sudo apt-get install -y autoconf libprotobuf-dev protobuf-compiler
Expand All @@ -47,7 +47,17 @@ jobs:
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address

- name: Cache Build
uses: actions/cache@v3
id: cache-ubuntu
with:
key: ${{ runner.os }}-build-ubuntu-${{ hashFiles('**/CMakeLists.txt') }}

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is CMakeLists used here to calculate hash values?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

下面build命令行cmake用到cmakelists,cmakelist改变不能使用原来的缓存了

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

好的;另外,这里我还有一个疑问,你这里缓存了整个workspace,会不会导致每次新增修改的代码,被缓存中的代码给覆盖掉,最终导致每次编译实际上都是用的旧的代码

path: ${{ github.workspace }}
restore-keys: |
${{ runner.os }}-build-ubuntu-

- name: Build
if: ${{ steps.cache-ubuntu.outputs.cache-hit != 'true' }}
# Build your program with the given configuration
run: cmake --build build --config ${{ env.BUILD_TYPE }}

Expand Down Expand Up @@ -115,7 +125,17 @@ jobs:
source /opt/rh/devtoolset-10/enable
cmake -B build -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DUSE_PIKA_TOOLS=ON -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address

- name: Cache Build
uses: actions/cache@v3
id: cache-centos
with:
key: ${{ runner.os }}-build-centos-${{ hashFiles('**/CMakeLists.txt') }}
path: ${{ github.workspace }}
restore-keys: |
${{ runner.os }}-build-centos-

- name: Build
if: ${{ steps.cache-centos.outputs.cache-hit != 'true' }}
run: |
source /opt/rh/devtoolset-10/enable
cmake --build build --config ${{ env.BUILD_TYPE }}
Expand Down Expand Up @@ -151,17 +171,7 @@ jobs:
with:
go-version: 1.19

- name: cache dependencies
uses: actions/cache@v2
id: cache
with:
path: |
${{ github.workspace }}/${{ env.INSTALL_LOCATION }}
~/.cache/pip
key: ${{ runner.os }}-dependencies

- name: install Deps
if: ${{ steps.cache.output.cache-hit != 'true' }}
- name: Install Deps
run: |
brew update
brew install --overwrite python autoconf protobuf llvm wget git
Expand All @@ -174,13 +184,23 @@ jobs:
export CC=/usr/local/opt/gcc@10/bin/gcc-10
cmake -B build -DCMAKE_C_COMPILER=/usr/local/opt/gcc@10/bin/gcc-10 -DUSE_PIKA_TOOLS=ON -DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }} -DCMAKE_CXX_FLAGS_DEBUG=-fsanitize=address

- name: Cache Build
uses: actions/cache@v3
id: cache-macos
with:
key: ${{ runner.os }}-build-macos-${{ hashFiles('**/CMakeLists.txt') }}
path: ${{ github.workspace }}
restore-keys: |
${{ runner.os }}-build-macos-

- name: Build
if: ${{ steps.cache-macos.outputs.cache-hit != 'true' }}
run: |
cmake --build build --config ${{ env.BUILD_TYPE }}

- name: Test
working-directory: ${{ github.workspace }}/build
run: ctest -C ${{ env.BUILD_TYPE }}
run: ctest --rerun-failed --output-on-failure -C ${{ env.BUILD_TYPE }}

- name: Unit Test
working-directory: ${{ github.workspace }}
Expand Down Expand Up @@ -218,13 +238,13 @@ jobs:

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: pikadb/pika

- name: Build Docker image
uses: docker/build-push-action@3b5e8027fcad23fda98b2e3ac259d8d67585f671
with:
Expand Down
Loading