Skip to content

Commit

Permalink
Cache the git repository in Github workflows.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-rapp committed Nov 11, 2023
1 parent a5fe468 commit 205179a
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/test_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,19 @@ jobs:
python_tests: ${{ steps.filter.outputs.python_tests }}
doc: ${{ steps.filter.outputs.doc }}
steps:
- name: Look up Git repository in cache
uses: actions/cache/restore@v3
with:
path: Boomer/.git/
key: test-build-git
- name: Checkout
uses: actions/checkout@v4
with:
path: Boomer/
- uses: dorny/paths-filter@v2
id: filter
with:
working-directory: Boomer/
filters: |
cpp: &cpp
- 'scons/**'
Expand All @@ -44,13 +52,26 @@ jobs:
doc:
- 'scons/**'
- 'doc/**'
- name: Save Git repository to cache
uses: actions/cache/save@v3
if: always()
with:
path: Boomer/.git/
key: test-build-git
linux_build:
needs: changes
name: Test Linux build
runs-on: ubuntu-latest
steps:
- name: Look up Git repository in cache
uses: actions/cache/restore@v3
with:
path: Boomer/.git/
key: test-build-git
- name: Checkout
uses: actions/checkout@v4
with:
path: Boomer/
- name: Install OpenCL
if: ${{ needs.changes.outputs.cpp_tests == 'true' || needs.changes.outputs.python_tests == 'true' || needs.changes.outputs.doc == 'true' }}
run: |
Expand Down Expand Up @@ -86,8 +107,15 @@ jobs:
name: Test MacOS build
runs-on: macos-latest
steps:
- name: Look up Git repository in cache
uses: actions/cache/restore@v3
with:
path: Boomer/.git/
key: test-build-git
- name: Checkout
uses: actions/checkout@v4
with:
path: Boomer/
- name: Install OpenMP
run: |
brew install libomp
Expand All @@ -102,8 +130,16 @@ jobs:
name: Test Windows build
runs-on: windows-latest
steps:
- name: Look up Git repository in cache
uses: actions/cache/restore@v3
with:
enableCrossOsArchive: true
path: Boomer/.git/
key: test-build-git
- name: Checkout
uses: actions/checkout@v4
with:
path: Boomer/
- name: Prepare MSVC
uses: ilammy/msvc-dev-cmd@v1
- name: Remove conflicting link.exe
Expand Down
14 changes: 14 additions & 0 deletions .github/workflows/test_format.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,20 @@ jobs:
name: Check code style
runs-on: ubuntu-latest
steps:
- name: Look up Git repository in cache
uses: actions/cache/restore@v3
with:
path: Boomer/.git/
key: test-format-git
- name: Checkout
uses: actions/checkout@v4
with:
path: Boomer/
- name: Detect changes
uses: dorny/paths-filter@v2
id: filter
with:
working-directory: Boomer/
filters: |
cpp:
- 'scons/**'
Expand All @@ -40,3 +48,9 @@ jobs:
- name: Check Python code style
if: steps.filter.outputs.python == 'true'
run: ./build test_format_python
- name: Save Git repository to cache
uses: actions/cache/save@v3
if: always()
with:
path: Boomer/.git/
key: test-format-git

0 comments on commit 205179a

Please sign in to comment.