Repository navigation
69 lines (69 loc) · 2.5 KB
/
Copy path__test-action-lint.yml
File metadata and controls
69 lines (69 loc) · 2.5 KB
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
---
name: Internal - Test lint action
"on":
workflow_call: null
permissions: {}
jobs:
lint:
runs-on: ubuntu-latest
timeout-minutes: 20
permissions:
contents: read
outputs:
artifact-id: ${{ steps.failed-lint.outputs.report-artifact-id }}
steps:
- name: Arrange - Check out the repository
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- name: Assert - Action contract tests pass
uses: hoverkraft-tech/ci-github-nodejs/actions/test@98d91b1cc347efc64cd5fb20bc0ebc076acad114 # 3.1.0
with:
command: test:ci
arguments: '["actions/lint/action.test.cjs"]'
coverage: ""
comment: "false"
- name: Arrange - Install the project runtime and dependencies
uses: $/actions/setup-python
with:
working-directory: tests/python-project
- name: Act - Run the default lint checks
uses: $/actions/lint
with:
working-directory: tests/python-project
- name: Act - Retain diagnostics from a failing command
uses: $/actions/lint
with:
working-directory: tests/python-project
command: |
printf '%s\n' '<checkstyle version="4.3"><file name="fixture"><error line="1" severity="error" message="expected lint failure" source="fixture"/></file></checkstyle>' > checkstyle.xml
exit 23
id: failed-lint
continue-on-error: true
- name: Assert - Failure propagates and reports survive
shell: bash
run: |
test "$OUTCOME" = failure
test -n "$ARTIFACT"
env:
OUTCOME: ${{ steps.failed-lint.outcome }}
ARTIFACT: ${{ steps.failed-lint.outputs.report-artifact-id }}
verify:
needs: lint
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
steps:
- name: Assert - Download retained lint reports
uses: hoverkraft-tech/ci-github-common/actions/download-artifact@af0bdd6313bd49aaf4a8a7f0de005fb0db856b03 # 4.3.3
with:
artifact-ids: ${{ needs.lint.outputs.artifact-id }}
path: ${{ runner.temp }}/lint-reports
- name: Assert - Retained report contains the diagnostic
shell: bash
run: |
test -f "$REPORT_DIRECTORY/checkstyle.xml"
grep -q 'message="expected lint failure"' "$REPORT_DIRECTORY/checkstyle.xml"
env:
REPORT_DIRECTORY: ${{ runner.temp }}/lint-reports