Skip to content

Commit 9c0d779

Browse files
authored
Merge pull request #1612 from ychin/fix-failed-test-artifact-uploads
ci: Fix test artifact upload not working
2 parents 91d6fa5 + 5d94afb commit 9c0d779

File tree

3 files changed

+52
-25
lines changed

3 files changed

+52
-25
lines changed

.github/actions/test_artifacts/action.yml

Lines changed: 34 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,41 @@
11
name: 'test_artifacts'
22
description: "Upload failed test artifacts"
3+
inputs:
4+
artifact-name:
5+
description: Name of the artifact
6+
required: true
7+
38
runs:
49
using: "composite"
510
steps:
6-
- name: Collect matrix properties for naming
7-
uses: actions/github-script@v8
8-
id: matrix-props
9-
env:
10-
MATRIX_PROPS: ${{ toJSON(matrix) }}
11-
with:
12-
# An array-flattening-to-string JavaScript function.
13-
script: |
14-
const f = function (x) { return x.toString().length > 0; }
15-
const g = function (x) {
16-
return (Array.isArray(x))
17-
? x.filter(f)
18-
.map((function (h) { return function (y) { return h(y); }; })(g))
19-
.join('-')
20-
: x;
21-
}
22-
return Object.values(JSON.parse(process.env.MATRIX_PROPS))
23-
.filter(f)
24-
.map(g)
25-
.join('-');
26-
# By default, the JSON-encoded return value of the function is
27-
# set as the "result".
28-
result-encoding: string
11+
# MacVim: We don't use a matrix within the reused
12+
# workflow, and so would prefer to manually pass
13+
# in the name of the artifact rather than deriving
14+
# it from the matrix automatically like in Vim
15+
# upstream.
16+
# - name: Collect matrix properties for naming
17+
# uses: actions/github-script@v8
18+
# id: matrix-props
19+
# env:
20+
# MATRIX_PROPS: ${{ toJSON(inputs) }}
21+
# with:
22+
# # An array-flattening-to-string JavaScript function.
23+
# script: |
24+
# const f = function (x) { return x.toString().length > 0; }
25+
# const g = function (x) {
26+
# return (Array.isArray(x))
27+
# ? x.filter(f)
28+
# .map((function (h) { return function (y) { return h(y); }; })(g))
29+
# .join('-')
30+
# : x;
31+
# }
32+
# return Object.values(JSON.parse(process.env.MATRIX_PROPS))
33+
# .filter(f)
34+
# .map(g)
35+
# .join('-');
36+
# # By default, the JSON-encoded return value of the function is
37+
# # set as the "result".
38+
# result-encoding: string
2939
- name: Upload failed tests
3040
uses: actions/upload-artifact@v4
3141
with:
@@ -35,7 +45,7 @@ runs:
3545
github.run_attempt,
3646
github.job,
3747
strategy.job-index,
38-
steps.matrix-props.outputs.result) }}
48+
inputs.artifact-name) }}
3949

4050
# A file, directory or wildcard pattern that describes what
4151
# to upload.

.github/actions/test_macvim_artifacts/action.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
# This is a clone of test_artifacts for MacVim-specific files
2+
# This should be almost identical to test_artifacts, other than the artifact
3+
# name/path. In the future we could potentially combine the two, but for now
4+
# it's simpler to keep them separate to ease upstream merging.
25
name: 'test_macvim_artifacts'
36
description: "Upload failed MacVim test artifacts"
7+
inputs:
8+
artifact-name:
9+
description: Name of the artifact
10+
required: true
11+
412
runs:
513
using: "composite"
614
steps:
715
- name: Upload failed tests
816
uses: actions/upload-artifact@v4
917
with:
1018
# Name of the artifact to upload.
11-
name: ${{ github.workflow }}-${{ github.job }}-${{ join(matrix.*, '-') }}-failed-macvim-tests
19+
name: ${{ format('GH-{0}-{1}-{2}-{3}-{4}-failed-macvim-tests',
20+
github.run_id,
21+
github.run_attempt,
22+
github.job,
23+
strategy.job-index,
24+
inputs.artifact-name) }}
1225

1326
# A file, directory or wildcard pattern that describes what
1427
# to upload.

.github/workflows/macvim-buildtest.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,8 @@ jobs:
353353
- name: Upload failed MacVim test results
354354
if: ${{ !cancelled() && failure() && steps.test_macvim.conclusion == 'failure' }}
355355
uses: ./.github/actions/test_macvim_artifacts
356+
with:
357+
artifact-name: ${{ format('{0}-{1}', inputs.os, inputs.xcode) }}
356358

357359
- name: Build Vim test binaries
358360
run: |
@@ -385,6 +387,8 @@ jobs:
385387
- name: Upload failed test files
386388
if: ${{ !cancelled() && failure() }}
387389
uses: ./.github/actions/test_artifacts
390+
with:
391+
artifact-name: ${{ format('{0}-{1}', inputs.os, inputs.xcode) }}
388392

389393
- name: Build MacVim dmg image
390394
if: inputs.publish && (startsWith(github.ref, 'refs/tags/') || github.ref == 'refs/heads/master')

0 commit comments

Comments
 (0)