File tree 2 files changed +24
-2
lines changed
2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change 7
7
type : string
8
8
description : " The name of the workflow used for the concurrency group."
9
9
required : true
10
+ cache_key_prefix :
11
+ type : string
12
+ description : " The prefix for the cache key. If empty, caching is disabled"
13
+ default : ' '
10
14
matrix_linux_command :
11
15
type : string
12
16
description : " The command of the current Swift version linux matrix job to execute."
71
75
concurrency :
72
76
group : ${{ github.workflow }}-${{ github.ref }}-${{ inputs.name }}
73
77
cancel-in-progress : true
74
-
78
+
75
79
jobs :
76
80
linux :
77
81
name : Linux (${{ matrix.swift.swift_version }})
@@ -108,6 +112,16 @@ jobs:
108
112
if : ${{ matrix.swift.enabled }}
109
113
# https://github.com/actions/checkout/issues/766
110
114
run : git config --global --add safe.directory ${GITHUB_WORKSPACE}
115
+
116
+ - name : Restore .build
117
+ if : ${{ matrix.swift.enabled && (inputs.cache_key_prefix != '') }}
118
+ id : " restore-cache"
119
+ uses : actions/cache/restore@v4
120
+ with :
121
+ path : .build
122
+ key : " ${{ inputs.cache_key_prefix }}${{ github.event.repository.name }}-build-${{ matrix.swift.swift_version }}-${{ runner.os }}-${{ (github.event.pull_request.base.sha != null) && github.event.pull_request.base.sha || github.event.before }}"
123
+ restore-keys : " ${{ inputs.cache_key_prefix }}${{ github.event.repository.name }}-build-${{ matrix.swift.swift_version }}-${{ runner.os }}"
124
+
111
125
- name : Run matrix job
112
126
if : ${{ matrix.swift.enabled }}
113
127
env :
@@ -121,3 +135,10 @@ jobs:
121
135
run : |
122
136
apt-get -qq update && apt-get -qq -y install curl
123
137
curl -s https://raw.githubusercontent.com/apple/swift-nio/main/scripts/check-matrix-job.sh | bash
138
+
139
+ - name : Cache .build
140
+ if : ${{ matrix.swift.enabled && (inputs.cache_key_prefix != '') && (steps.restore-cache.outputs.cache-hit != 'true') }}
141
+ uses : actions/cache/save@v4
142
+ with :
143
+ path : .build
144
+ key : " ${{ inputs.cache_key_prefix }}${{ github.event.repository.name }}-build-${{ matrix.swift.swift_version }}-${{ runner.os }}-${{ (github.event.pull_request.base.sha != null) && github.event.pull_request.base.sha || github.event.before }}"
Original file line number Diff line number Diff line change 43
43
type : string
44
44
description : " The arguments passed to swift test in the Linux nightly main Swift version matrix job."
45
45
default : " "
46
-
46
+
47
47
jobs :
48
48
unit-tests :
49
49
name : Unit tests
50
50
uses : ./.github/workflows/swift_matrix.yml
51
51
with :
52
52
name : " Unit tests"
53
+ cache_key_prefix : " unit-tests-"
53
54
matrix_linux_command : " swift test"
54
55
matrix_linux_5_8_enabled : ${{ inputs.linux_5_8_enabled }}
55
56
matrix_linux_5_8_command_override : " swift test ${{ inputs.linux_5_8_arguments_override }}"
You can’t perform that action at this time.
0 commit comments