-
Notifications
You must be signed in to change notification settings - Fork 2
132 lines (117 loc) · 4.76 KB
/
testing.yml
File metadata and controls
132 lines (117 loc) · 4.76 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
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
name: Testing
on: [push, pull_request]
jobs:
test:
name: Run tests
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
codespell_pip_version: ['codespell']
experimental: [false]
include:
- codespell_pip_version: 'git+https://github.com/codespell-project/codespell.git'
# Set this to true if git master is breaking the action's tests
experimental: false
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: '3.10'
- name: Install codespell via pip using ${{ matrix.codespell_pip_version }}
run: pip install ${{ matrix.codespell_pip_version }}
- name: Check codespell
run: codespell --version
- name: Install Bats
run: |
git clone --quiet https://github.com/bats-core/bats-core.git
cd bats-core
git fetch --tags
# Checkout the latest tag
git checkout --quiet $(git describe --tags `git rev-list --tags --max-count=1`)
sudo ./install.sh "/usr/local" > /dev/null
- name: Run Bats tests
run: bats "./test"
run_action:
name: Test run action
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./
with:
path: test/testdata
only_warn: 1
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./
with:
check_filenames: true
check_hidden: true
# When using this Action in other repos, the --skip option below can be removed
skip: ./.git,./codespell-problem-matcher/test,./test,./README.md,./.github/workflows/testing.yml,./.pre-commit-config.yaml
# Check our README (and this workflow) ignoring the two intentional typos
- uses: ./
with:
check_filenames: true
check_hidden: true
path: ./README.md,./.github/workflows/testing.yml
ignore_words_list: abandonned,ackward
diagnose_bats:
name: Diagnose bats
needs: test
if: always() && needs.test.result == 'failure'
runs-on: ubuntu-latest
continue-on-error: true
strategy:
fail-fast: false
matrix:
codespell_pip_version: ['codespell']
include:
- codespell_pip_version: 'git+https://github.com/codespell-project/codespell.git'
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
with:
egress-policy: audit
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
- run: pip3 --quiet --quiet install ${{ matrix.codespell_pip_version }}
- run: |
# Simulate the Dockerfile COPY command
[ -d "${RUNNER_TEMP}/code/" ] || sudo mkdir -p ${RUNNER_TEMP}/code/
[ -f "${RUNNER_TEMP}/code/codespell-matcher.json" ] || sudo cp codespell-problem-matcher/codespell-matcher.json ${RUNNER_TEMP}/code/
#ls -alR ${RUNNER_TEMP}/code/
[ -d "/code/" ] || sudo mkdir -p /code/
[ -f "/code/codespell-matcher.json" ] || sudo cp codespell-problem-matcher/codespell-matcher.json /code/
#ls -alR /code/
# Add a random place BATS tries to put it
[ -d "/github/workflow/" ] || sudo mkdir -p /github/workflow/ && sudo chmod 777 /github/workflow/
#ls -alR /github/workflow/
export INPUT_CHECK_FILENAMES=""
export INPUT_CHECK_HIDDEN=""
export INPUT_EXCLUDE_FILE=""
export INPUT_SKIP=""
export INPUT_IGNORE_WORDS_FILE="./test/ignore-words-file.txt"
export INPUT_IGNORE_WORDS_LIST=""
export INPUT_PATH="./test/testdata"
export INPUT_ONLY_WARN=""
./entrypoint.sh || echo $?