Skip to content

Commit 5bd198f

Browse files
committed
Autogen cache without checkin to vcs
Signed-off-by: Lorenzo <lorenzo.donini90@gmail.com>
1 parent 7bee131 commit 5bd198f

2 files changed

Lines changed: 23 additions & 11 deletions

File tree

.github/workflows/autogen.yaml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,16 @@ jobs:
3131
uses: jaxxstorm/action-install-gh-release@v1.10.0
3232
with: # Grab a specific tag
3333
repo: vektra/mockery
34-
tag: v2.51.0
34+
tag: v2.53.3
3535

3636
- name: Generate mocks
3737
run: mockery
38-
39-
# Commit all changed files back to the repository
40-
- uses: stefanzweifel/git-auto-commit-action@v5
41-
#with:
42-
# commit_message: [ Autogen ] Generated mocks
43-
# # Mockery can generate new files, so we need to add them to the commit as well
44-
# add_options: '$(git ls-files -o --exclude-standard)'
45-
# file_pattern: '*.go' # Only commit changes to Go files
46-
# # Only create a branch when the workflow is triggered manually
47-
# create_branch: ${{ github.event_name == 'workflow_dispatch' }}
38+
- name: Cache generated mocks
39+
uses: actions/cache@v4
40+
with:
41+
path: |
42+
ocpp1.6_test/mocks/
43+
ocpp2.0.1_test/mocks/
44+
ocppj/mocks/
45+
ws/mocks/
46+
key: ${{ runner.os }}-mocks-${{ github.sha }}

.github/workflows/test.yaml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,19 @@ jobs:
1919
steps:
2020
- name: Checkout code
2121
uses: actions/checkout@v4.2.2
22+
- name: Restore generated mocks
23+
id: cache-mocks
24+
uses: actions/cache/restore@v4
25+
with:
26+
path: |
27+
ocpp1.6_test/mocks/
28+
ocpp2.0.1_test/mocks/
29+
ocppj/mocks/
30+
ws/mocks/
31+
key: ${{ runner.os }}-mocks-${{ github.sha }}
32+
- name: Check cache hit
33+
if: steps.cache.outputs.cache-hit != 'true'
34+
run: exit 1
2235
- name: Run tests
2336
run: |
2437
docker compose -f docker-compose.test.yaml up unit_test --abort-on-container-exit

0 commit comments

Comments
 (0)