Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions .github/workflows/soundness.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ on:
type: boolean
description: "Boolean to enable the Python lint check job. Defaults to true."
default: true
linux_pre_run_command:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this really be executed before every soundness check. It seems like this is only relevant for the ones that need to build something e.g. docs and api break

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wondered that myself but I think it's plausible that a caller may want to do some other source preparations, munging, generation that this would permit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not set on it being this way though if you'd rather we solve the immediate requirement.

Copy link
Contributor

@ktoso ktoso Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

swift-java needs a bunch of weird stuff, like installing a JDK for builds to work.

I agree that it is only for things which "build" the formatting check for example does no need it. At least so far AFAICS, let's start with that and we can extend if necessary?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe have a more specific name, like linux_pre_build_command, and only run it in actions that build? And in the future, there can be another linux_pre_foo_command that doesn't interfere with the build one, and could be added to all of them (e.g. to print the environment or something).

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On a side note. I am wondering if the longer term strategy is to allow overriding the docker image.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, I'm happy taking this approach. Thanks for the feedback everyone.

type: string
description: "Linux command to execute before building the Swift package"
default: ""

## We are cancelling previously triggered workflow runs
concurrency:
Expand All @@ -86,6 +90,9 @@ jobs:
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run API breakage check
run: |
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
Expand All @@ -104,6 +111,9 @@ jobs:
with:
persist-credentials: false
submodules: true
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run documentation check
run: |
apt-get -qq update && apt-get -qq -y install curl yq
Expand All @@ -120,6 +130,9 @@ jobs:
with:
persist-credentials: false
submodules: true
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run unacceptable language check
env:
UNACCEPTABLE_WORD_LIST: ${{ inputs.unacceptable_language_check_word_list}}
Expand All @@ -136,6 +149,9 @@ jobs:
with:
persist-credentials: false
submodules: true
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run license header check
env:
PROJECT_NAME: ${{ inputs.license_header_check_project_name }}
Expand All @@ -152,6 +168,9 @@ jobs:
with:
persist-credentials: false
submodules: true
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run broken symlinks check
run: curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/scripts/check-broken-symlinks.sh | bash

Expand All @@ -171,6 +190,9 @@ jobs:
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run format check
run: |
apt-get -qq update && apt-get -qq -y install curl
Expand All @@ -192,6 +214,9 @@ jobs:
- name: Mark the workspace as safe
# https://github.com/actions/checkout/issues/766
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run shellcheck
run: |
apt-get -qq update && apt-get -qq -y install shellcheck
Expand All @@ -208,6 +233,9 @@ jobs:
with:
persist-credentials: false
submodules: true
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run yamllint
run: |
which yamllint >/dev/null || ( apt-get update && apt-get install -y yamllint )
Expand All @@ -217,6 +245,7 @@ jobs:
curl -s https://raw.githubusercontent.com/swiftlang/github-workflows/refs/heads/main/.github/workflows/configs/yamllint.yml > .yamllint.yml
fi
yamllint --strict --config-file .yamllint.yml .

python-lint-check:
name: Python lint check
if: ${{ inputs.python_lint_check_enabled }}
Expand All @@ -228,6 +257,9 @@ jobs:
with:
persist-credentials: false
submodules: true
- name: Pre-run setup
if: ${{ inputs.linux_pre_run_command }}
run: ${{ inputs.linux_pre_run_command }}
- name: Run flake8
run: |
pip3 install flake8 flake8-import-order
Expand Down