-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathaction.yml
90 lines (90 loc) · 3.64 KB
/
action.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
name: "Gateway Conformance Tests"
description: "Runs the Gateway Conformance Tests"
inputs:
gateway-url:
description: "The URL of the IPFS Gateway implementation to be tested."
required: true
subdomain-url:
description: "The Subdomain URL of the IPFS Gateway implementation to be tested."
default: "http://example.com"
required: false
accept-test-failure:
# see https://github.com/orgs/community/discussions/15452
description: "When set to `true`, the action will not fail (become red) if the tests fail. Use the reports to determine the outcome of the tests."
default: "false"
required: false
json:
description: "The path where the JSON test report should be generated."
required: true
default: "report.json"
xml:
description: "The path where the JUnit XML test report should be generated."
required: false
html:
description: "The path where the one-page HTML test report should be generated."
required: false
markdown:
description: "The path where the summary Markdown test report should be generated."
required: false
report:
description: "The path where the summary JSON test report should be generated."
required: false
specs:
description: "A comma-separated list of specs to be tested. Accepts a spec (test only this spec), a +spec (test also this immature spec), or a -spec (do not test this mature spec)."
required: false
default: ""
args:
description: "[DANGER] The `args` input allows you to pass custom, free-text arguments directly to the Go test command that the tool employs to execute tests."
required: false
runs:
using: "composite"
steps:
- id: github
uses: pl-strflt/docker-container-action/.github/actions/github@v1
- name: Run the test
uses: pl-strflt/docker-container-action@v1
env:
URL: ${{ inputs.gateway-url }}
SUBDOMAIN: ${{ inputs.subdomain-url }}
JSON: ${{ inputs.json }}
SPECS: ${{ inputs.specs }}
JOB_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
with:
repository: ${{ steps.github.outputs.action_repository }}
ref: ${{ steps.github.outputs.action_sha || steps.github.outputs.action_ref }}
dockerfile: Dockerfile
allow-exit-codes: ${{ inputs.accept-test-failure == 'false' && '0' || '0,1' }}
opts: --network=host
args: test --url="$URL" --json="$JSON" --specs="$SPECS" --subdomain-url="$SUBDOMAIN" --job-url="$JOB_URL" -- ${{ inputs.args }}
build-args: |
VERSION:${{ steps.github.outputs.action_ref }}
- name: Create the XML
if: (inputs.xml || inputs.html || inputs.markdown) && (failure() || success())
uses: pl-strflt/gotest-json-to-junit-xml@v1
with:
input: ${{ inputs.json }}
output: ${{ inputs.xml }}
- name: Create the HTML
if: inputs.html && (failure() || success())
uses: pl-strflt/junit-xml-to-html@v1
with:
mode: no-frames
input: ${{ inputs.xml }}
output: ${{ inputs.html }}
- name: Create the Markdown
if: inputs.markdown && (failure() || success())
uses: pl-strflt/junit-xml-to-html@v1
with:
mode: summary
input: ${{ inputs.xml }}
output: ${{ inputs.markdown }}
- name: Create the JSON Report
if: inputs.report && (failure() || success())
shell: bash
env:
JSON: ${{ inputs.json }}
REPORT: ${{ inputs.report }}
run: |
# TODO: checkout here.
wget 'https://raw.githubusercontent.com/singulargarden/gateway-conformance/main/munge.js' -O munge.js
cat "${JSON}" | node munge.js > "${REPORT}"