Skip to content

Commit cfcfce9

Browse files
committed
Add linux_pre_run_command to soundness
Add a `linux_pre_run_command` input parameter to the soundness workflow jobs to allow callers to set up any dependencies or perform any other preparations before the soundness checks are executed. This is useful for example for repositories which require dependencies to be installed before the build.
1 parent 1c8350b commit cfcfce9

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/soundness.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ on:
6363
type: boolean
6464
description: "Boolean to enable the Python lint check job. Defaults to true."
6565
default: true
66+
linux_pre_run_command:
67+
type: string
68+
description: "Linux command to execute before building the Swift package"
69+
default: ""
6670

6771
## We are cancelling previously triggered workflow runs
6872
concurrency:
@@ -86,6 +90,9 @@ jobs:
8690
- name: Mark the workspace as safe
8791
# https://github.com/actions/checkout/issues/766
8892
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
93+
- name: Pre-run setup
94+
if: ${{ inputs.linux_pre_run_command }}
95+
run: ${{ inputs.linux_pre_run_command }}
8996
- name: Run API breakage check
9097
run: |
9198
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
@@ -104,6 +111,9 @@ jobs:
104111
with:
105112
persist-credentials: false
106113
submodules: true
114+
- name: Pre-run setup
115+
if: ${{ inputs.linux_pre_run_command }}
116+
run: ${{ inputs.linux_pre_run_command }}
107117
- name: Run documentation check
108118
run: |
109119
apt-get -qq update && apt-get -qq -y install curl yq
@@ -120,6 +130,9 @@ jobs:
120130
with:
121131
persist-credentials: false
122132
submodules: true
133+
- name: Pre-run setup
134+
if: ${{ inputs.linux_pre_run_command }}
135+
run: ${{ inputs.linux_pre_run_command }}
123136
- name: Run unacceptable language check
124137
env:
125138
UNACCEPTABLE_WORD_LIST: ${{ inputs.unacceptable_language_check_word_list}}
@@ -136,6 +149,9 @@ jobs:
136149
with:
137150
persist-credentials: false
138151
submodules: true
152+
- name: Pre-run setup
153+
if: ${{ inputs.linux_pre_run_command }}
154+
run: ${{ inputs.linux_pre_run_command }}
139155
- name: Run license header check
140156
env:
141157
PROJECT_NAME: ${{ inputs.license_header_check_project_name }}
@@ -152,6 +168,9 @@ jobs:
152168
with:
153169
persist-credentials: false
154170
submodules: true
171+
- name: Pre-run setup
172+
if: ${{ inputs.linux_pre_run_command }}
173+
run: ${{ inputs.linux_pre_run_command }}
155174
- name: Run broken symlinks check
156175
run: curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/check-broken-symlinks.sh | bash
157176

@@ -171,6 +190,9 @@ jobs:
171190
- name: Mark the workspace as safe
172191
# https://github.com/actions/checkout/issues/766
173192
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
193+
- name: Pre-run setup
194+
if: ${{ inputs.linux_pre_run_command }}
195+
run: ${{ inputs.linux_pre_run_command }}
174196
- name: Run format check
175197
run: |
176198
apt-get -qq update && apt-get -qq -y install curl
@@ -192,6 +214,9 @@ jobs:
192214
- name: Mark the workspace as safe
193215
# https://github.com/actions/checkout/issues/766
194216
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
217+
- name: Pre-run setup
218+
if: ${{ inputs.linux_pre_run_command }}
219+
run: ${{ inputs.linux_pre_run_command }}
195220
- name: Run shellcheck
196221
run: |
197222
apt-get -qq update && apt-get -qq -y install shellcheck
@@ -208,6 +233,9 @@ jobs:
208233
with:
209234
persist-credentials: false
210235
submodules: true
236+
- name: Pre-run setup
237+
if: ${{ inputs.linux_pre_run_command }}
238+
run: ${{ inputs.linux_pre_run_command }}
211239
- name: Run yamllint
212240
run: |
213241
which yamllint >/dev/null || ( apt-get update && apt-get install -y yamllint )
@@ -217,6 +245,7 @@ jobs:
217245
curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/configs/yamllint.yml > .yamllint.yml
218246
fi
219247
yamllint --strict --config-file .yamllint.yml .
248+
220249
python-lint-check:
221250
name: Python lint check
222251
if: ${{ inputs.python_lint_check_enabled }}
@@ -228,6 +257,9 @@ jobs:
228257
with:
229258
persist-credentials: false
230259
submodules: true
260+
- name: Pre-run setup
261+
if: ${{ inputs.linux_pre_run_command }}
262+
run: ${{ inputs.linux_pre_run_command }}
231263
- name: Run flake8
232264
run: |
233265
pip3 install flake8 flake8-import-order

0 commit comments

Comments
 (0)