Skip to content

Commit 86aea66

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

File tree

3 files changed

+38
-15
lines changed

3 files changed

+38
-15
lines changed

.github/workflows/autogen.yaml

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
name: Autogenerate
22
on:
3-
# Note: When testing with nektos/act, the workflow_dispatch does not work as of version 0.2.63
4-
workflow_dispatch:
3+
push:
4+
paths-ignore:
5+
- "**.md"
6+
- LICENSE
57

68
pull_request:
79
paths-ignore:
8-
- '*.md'
10+
- "**.md"
11+
- LICENSE
12+
# Note: When testing with nektos/act, the workflow_dispatch does not work as of version 0.2.63
13+
workflow_dispatch:
914

1015
jobs:
1116
mockery:
@@ -31,17 +36,16 @@ jobs:
3136
uses: jaxxstorm/action-install-gh-release@v1.10.0
3237
with: # Grab a specific tag
3338
repo: vektra/mockery
34-
tag: v2.51.0
39+
tag: v2.53.3
3540

3641
- name: Generate mocks
3742
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' }}
43+
- name: Cache generated mocks
44+
uses: actions/cache@v4
45+
with:
46+
path: |
47+
ocpp1.6_test/mocks/
48+
ocpp2.0.1_test/mocks/
49+
ocppj/mocks/
50+
ws/mocks/
51+
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

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,10 @@
1818
certs/
1919

2020
central_system_sim
21-
charge_point_sim
21+
charge_point_sim
22+
23+
# Generatd files
24+
ocpp1.6_test/mocks/
25+
ocpp2.0.1_test/mocks/
26+
ocppj/mocks/
27+
ws/mocks/

0 commit comments

Comments
 (0)