This repository has been archived by the owner on Aug 22, 2024. It is now read-only.
forked from stacks-network/stacks-core
-
Notifications
You must be signed in to change notification settings - Fork 0
242 lines (214 loc) · 8.17 KB
/
mutants.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
name: Mutants
# to be tried cache vs artifacts
# only run on push in order to update the artifact output
# flow:
# download artifact
# run sh script for cargo mutants diff
# upload artifact
on:
push:
branches:
- master
- develop
- next
- deployer/testing-shell-script
jobs:
save_cache:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Restore mutants-output cached folder
id: cache-restore
uses: actions/cache/restore@v3
with:
path: ./mutation-testing/packages-output
key: mutants-stable-develop
- name: Install cargo-mutants crate
run: cargo install cargo-mutants
- name: Create file with current commit hash if it doesn't exist
run: |
if [ ! -f last_commit_hash.txt ]; then
echo "${{ github.sha }}" > last_commit_hash.txt
fi
working-directory: ./mutation-testing/packages-output
- name: Print old commit hash
run: cat ./mutation-testing/packages-output/last_commit_hash.txt
- name: Run the mutation testing on the differences
run: |
if [ -f ../packages-output/last_commit_hash.txt ]; then
./git-diff.sh
fi
working-directory: ./mutation-testing/scripts
- name: Re-write the old commit hash with the current one
run: |
echo "${{ github.sha }}" > last_commit_hash.txt
working-directory: ./mutation-testing/packages-output
- name: Print new commit hash
run: cat ./mutation-testing/packages-output/last_commit_hash.txt
- name: Delete Previous Cache
if: ${{ steps.cache-restore.outputs.cache-hit }}
continue-on-error: true
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "mutants-stable-develop" --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# TODO: feature for retrying the save in case it fails for any reason (in order not to lose the cache)
- name: Save Cache
uses: actions/cache/save@v3
with:
path: ./mutation-testing/packages-output
key: mutants-stable-develop
# cache_mutants:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the latest code
# id: git_checkout
# uses: actions/checkout@v3
# - name: Cache mutants-initial folder
# uses: actions/cache@v3
# with:
# path: mutants-initial
# key: mutants-initial
# - name: Print caught mutants
# run: cat mutants-initial/caught.txt
# - name: Print missed mutants
# run: cat mutants-initial/missed.txt
# - name: Print unviable mutants
# run: cat mutants-initial/unviable.txt
# - name: Print timeout mutants
# run: cat mutants-initial/timeout.txt
# Upload cache stable output version
# cache_mutants_output:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the latest code
# id: git_checkout
# uses: actions/checkout@v3
# - name: Cache mutants-initial folder
# uses: actions/cache@v3
# with:
# path: mutation-testing/packages-output
# key: mutants-stable-develop
# # - name: Print caught mutants
# # run: cat mutants-initial/caught.txt
# ## Mutants testing: Execute on push on packages that have tested functions modified
# cache_update_output:
# runs-on: ubuntu-latest
# steps:
# - name: Checkout the latest code
# id: git_checkout
# uses: actions/checkout@v3
# - name: Restore mutants-output cached folder
# uses: actions/cache/restore@v3
# with:
# path: mutation-testing/packages-output
# key: mutants-stable-develop
# - name: Print caught mutants
# run: cat mutation-testing/packages-output/pox-locking/missed.txt
# - run: cargo install cargo-mutants
# # - name: Update stable mutants with modified functions
# # run: ./git-diff.sh
# # working-directory: mutation-testing/scripts
# # - name: Print updated missed mutants
# # run: cat mutation-testing/packages-output/pox-locking/missed.txt
# - name: Append 2 line to one file
# run: |
# echo "text 1" >> missed.txt
# echo "text 2" >> missed.txt
# working-directory: mutation-testing/packages-output/pox-locking
# - name: outshow new cached file
# run: cat missed.txt
# working-directory: mutation-testing/packages-output/pox-locking
# # - name: Cache mutants-initial folder
# # uses: actions/cache/save@v3
# # with:
# # path: mutation-testing/packages-output
# # key: mutants-stable-develop
# - name: Save Cache
# uses: Wandalen/wretry.action@a163f62ae554a8f3cbe27b23db15b60c0ae2e93c # v1.3.0
# with:
# action: actions/cache/save@704facf57e6136b1bc63b828d79edcd491f0ee84 # v3.3.2
# with: |
# path: mutation-testing/packages-output
# key: mutants-stable-develop
# attempt_limit: 5
# attempt_delay: 3000
# # Upload stable output version
# stable-mutants:
# name: Upload Stable Mutants Testing
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# with:
# fetch-depth: 0 # do we want to fetch all?
# - name: Archive mutants output
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: mutants-stable-develop
# path: mutation-testing/packages-output
# ## Mutants testing: Execute on PR on packages that have tested functions modified
# ### download it && see how it is
# incremental-mutants:
# name: Incremental Mutants Testing
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Download stable output artifact
# uses: actions/download-artifact@v3
# with:
# name: mutants-stable-develop
# path: mutation-testing/packages-output
# - name: Display structure of downloaded files
# run: ls -R
# working-directory: mutation-testing/packages-output
# - run: cargo install cargo-mutants
# - name: Update stable mutants with modified functions
# run: ./git-diff.sh
# working-directory: mutation-testing/scripts
# - name: Archive mutants output
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: mutants-stable-develop
# path: mutation-testing/packages-output
# incremental-mutants-2:
# name: Incremental Mutants Testing
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v3
# - name: Check for the existence of the stable output artifact
# id: check-artifact
# uses: actions/github-script@v5
# with:
# script: |
# const artifacts = await github.rest.actions.listWorkflowRunArtifacts({
# owner: context.repo.owner,
# repo: context.repo.repo,
# run_id: context.runId,
# });
# const artifactExists = artifacts.data.artifacts.some(artifact => artifact.name === 'mutants-stable-develop');
# core.setOutput('exists', artifactExists);
# - name: Download stable output artifact
# if: steps.check-artifact.outputs.exists == 'true'
# uses: actions/download-artifact@v3
# with:
# name: mutants-stable-develop
# path: mutation-testing/packages-output
# - name: Display structure of downloaded files
# if: steps.check-artifact.outputs.exists == 'true'
# run: ls -R
# working-directory: mutation-testing/packages-output
# - run: cargo install cargo-mutants
# - name: Update stable mutants with modified functions
# if: steps.check-artifact.outputs.exists == 'true'
# run: ./git-diff.sh
# working-directory: mutation-testing/scripts
# - name: Archive mutants output
# uses: actions/upload-artifact@v3
# if: always()
# with:
# name: mutants-stable-develop
# path: mutation-testing/packages-output