diff --git a/.github/actions/broken-symlinks-check/action.yml b/.github/actions/broken-symlinks-check/action.yml new file mode 100644 index 00000000..988226b1 --- /dev/null +++ b/.github/actions/broken-symlinks-check/action.yml @@ -0,0 +1,8 @@ +name: broken-symlink-check +description: Check for broken symbolic links +runs: + using: composite + steps: + - name: Run broken symlink check + shell: bash + run: $GITHUB_ACTION_PATH/check-broken-symlinks.sh diff --git a/.github/workflows/scripts/check-broken-symlinks.sh b/.github/actions/broken-symlinks-check/check-broken-symlinks.sh similarity index 100% rename from .github/workflows/scripts/check-broken-symlinks.sh rename to .github/actions/broken-symlinks-check/check-broken-symlinks.sh diff --git a/.github/actions/check-unacceptable-language/action.yml b/.github/actions/check-unacceptable-language/action.yml new file mode 100644 index 00000000..dbefa77d --- /dev/null +++ b/.github/actions/check-unacceptable-language/action.yml @@ -0,0 +1,8 @@ +name: check-unacceptable-language +description: Check Language Format +runs: + using: composite + steps: + - name: Run unacceptable language check + shell: bash + run: $GITHUB_ACTION_PATH/check-unacceptable-language.sh diff --git a/.github/workflows/scripts/check-unacceptable-language.sh b/.github/actions/check-unacceptable-language/check-unacceptable-language.sh similarity index 100% rename from .github/workflows/scripts/check-unacceptable-language.sh rename to .github/actions/check-unacceptable-language/check-unacceptable-language.sh diff --git a/.github/actions/docs-check/action.yml b/.github/actions/docs-check/action.yml new file mode 100644 index 00000000..118e1f93 --- /dev/null +++ b/.github/actions/docs-check/action.yml @@ -0,0 +1,8 @@ +name: docs-check +description: Check Docs +runs: + using: composite + steps: + - name: Run docs check + shell: bash + run: $GITHUB_ACTION_PATH/check-docs.sh diff --git a/.github/workflows/scripts/check-docs.sh b/.github/actions/docs-check/check-docs.sh similarity index 100% rename from .github/workflows/scripts/check-docs.sh rename to .github/actions/docs-check/check-docs.sh diff --git a/.github/actions/format-check/action.yml b/.github/actions/format-check/action.yml new file mode 100644 index 00000000..0d7fc86f --- /dev/null +++ b/.github/actions/format-check/action.yml @@ -0,0 +1,8 @@ +name: format-check +description: Check Swift Format +runs: + using: composite + steps: + - name: Run format check + shell: bash + run: $GITHUB_ACTION_PATH/check-swift-format.sh diff --git a/.github/workflows/scripts/check-swift-format.sh b/.github/actions/format-check/check-swift-format.sh similarity index 100% rename from .github/workflows/scripts/check-swift-format.sh rename to .github/actions/format-check/check-swift-format.sh diff --git a/.github/actions/license-header-check/action.yml b/.github/actions/license-header-check/action.yml new file mode 100644 index 00000000..c78892b3 --- /dev/null +++ b/.github/actions/license-header-check/action.yml @@ -0,0 +1,8 @@ +name: license-header-check +description: Check License Headers +runs: + using: composite + steps: + - name: Run license header check + shell: bash + run: $GITHUB_ACTION_PATH/check-license-header.sh diff --git a/.github/workflows/scripts/check-license-header.sh b/.github/actions/license-header-check/check-license-header.sh similarity index 100% rename from .github/workflows/scripts/check-license-header.sh rename to .github/actions/license-header-check/check-license-header.sh diff --git a/.github/workflows/configs/.flake8 b/.github/actions/python-lint-check/.flake8 similarity index 100% rename from .github/workflows/configs/.flake8 rename to .github/actions/python-lint-check/.flake8 diff --git a/.github/actions/python-lint-check/action.yml b/.github/actions/python-lint-check/action.yml new file mode 100644 index 00000000..ac010f43 --- /dev/null +++ b/.github/actions/python-lint-check/action.yml @@ -0,0 +1,14 @@ +name: python-lint-check +description: Check python files +runs: + using: composite + steps: + - name: Install flake + shell: bash + run: pip3 install flake8 flake8-import-order + - name: Copy flake8 config + shell: bash + run: cp $GITHUB_ACTION_PATH/.flake8 .flake8 + - name: Run flake8 + shell: bash + run: flake8 diff --git a/.github/actions/yamllint-check/action.yml b/.github/actions/yamllint-check/action.yml new file mode 100644 index 00000000..6a956d45 --- /dev/null +++ b/.github/actions/yamllint-check/action.yml @@ -0,0 +1,11 @@ +name: yamllint-check +description: Check yaml files +runs: + using: composite + steps: + - name: Install yamllint + shell: bash + run: which yamllint || (apt -q update && apt install -yq yamllint) + - name: Run yaml lint + shell: bash + run: yamllint --strict --config-file $GITHUB_ACTION_PATH/yamllint.yml . diff --git a/.github/workflows/configs/yamllint.yml b/.github/actions/yamllint-check/yamllint.yml similarity index 100% rename from .github/workflows/configs/yamllint.yml rename to .github/actions/yamllint-check/yamllint.yml diff --git a/.github/workflows/soundness.yml b/.github/workflows/soundness.yml index c1b7b59a..4c543663 100644 --- a/.github/workflows/soundness.yml +++ b/.github/workflows/soundness.yml @@ -118,7 +118,7 @@ jobs: timeout-minutes: 40 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: # This is set to true since swift package diagnose-api-breaking-changes is # cloning the repo again and without it being set to true this job won't work for @@ -158,31 +158,17 @@ jobs: timeout-minutes: 20 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Pre-build if: ${{ inputs.linux_pre_build_command }} run: ${{ inputs.linux_pre_build_command }} - name: Run documentation check env: ADDITIONAL_DOCC_ARGUMENTS: ${{ inputs.docs_check_additional_arguments }} - run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-docs.sh + uses: ./.github/actions/docs-check docs-check-macos: name: Documentation check (macOS) @@ -191,24 +177,10 @@ jobs: timeout-minutes: 20 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Select Xcode run: echo "DEVELOPER_DIR=/Applications/Xcode_${{ inputs.docs_check_macos_xcode_version }}.app" >> $GITHUB_ENV - name: Swift version @@ -218,7 +190,7 @@ jobs: - name: Run documentation check env: ADDITIONAL_DOCC_ARGUMENTS: ${{ inputs.docs_check_macos_additional_arguments }} - run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-docs.sh + uses: ./.github/actions/docs-check unacceptable-language-check: name: Unacceptable language check @@ -227,28 +199,14 @@ jobs: timeout-minutes: 1 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Run unacceptable language check env: UNACCEPTABLE_WORD_LIST: ${{ inputs.unacceptable_language_check_word_list}} - run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-unacceptable-language.sh + uses: ./.github/actions/check-unacceptable-language license-header-check: name: License headers check @@ -257,28 +215,14 @@ jobs: timeout-minutes: 1 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Run license header check env: PROJECT_NAME: ${{ inputs.license_header_check_project_name }} - run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-license-header.sh + uses: ./.github/actions/license-header-check broken-symlink-check: name: Broken symlinks check @@ -287,26 +231,12 @@ jobs: timeout-minutes: 1 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Run broken symlinks check - run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-broken-symlinks.sh + uses: ./.github/actions/broken-symlinks-check format-check: name: Format check @@ -317,29 +247,15 @@ jobs: timeout-minutes: 20 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Mark the workspace as safe # https://github.com/actions/checkout/issues/766 run: git config --global --add safe.directory ${GITHUB_WORKSPACE} - name: Run format check - run: ${{ steps.script_path.outputs.root }}/.github/workflows/scripts/check-swift-format.sh + uses: ./.github/actions/format-check shell-check: name: Shell check @@ -352,7 +268,7 @@ jobs: - name: Install git run: which git || (apt -q update && apt -yq install git) - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true @@ -371,33 +287,12 @@ jobs: timeout-minutes: 5 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Run yamllint - run: | - which yamllint || (apt -q update && apt install -yq yamllint) - cd ${GITHUB_WORKSPACE} - if [ ! -f ".yamllint.yml" ]; then - echo "Downloading default yamllint config file" - cat ${{ steps.script_path.outputs.root }}/.github/workflows/configs/yamllint.yml > .yamllint.yml - fi - yamllint --strict --config-file .yamllint.yml . + uses: ./.github/actions/yamllint-check python-lint-check: name: Python lint check @@ -406,30 +301,9 @@ jobs: timeout-minutes: 5 steps: - name: Checkout repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 with: persist-credentials: false submodules: true - - name: Checkout swiftlang/github-workflows repository - if: ${{ github.repository != 'swiftlang/github-workflows' }} - uses: actions/checkout@v4 - with: - repository: swiftlang/github-workflows - path: github-workflows - - name: Determine script-root path - id: script_path - run: | - if [ "${{ github.repository }}" = "swiftlang/github-workflows" ]; then - echo "root=$GITHUB_WORKSPACE" >> $GITHUB_OUTPUT - else - echo "root=$GITHUB_WORKSPACE/github-workflows" >> $GITHUB_OUTPUT - fi - name: Run flake8 - run: | - pip3 install flake8 flake8-import-order - cd ${GITHUB_WORKSPACE} - if [ ! -f ".flake8" ]; then - echo "Downloading default flake8 config file" - cat ${{ steps.script_path.outputs.root }}/.github/workflows/configs/.flake8 > .flake8 - fi - flake8 + uses: ./.github/actions/python-lint-check diff --git a/.licenseignore b/.licenseignore index ee4247a1..d5a53537 100644 --- a/.licenseignore +++ b/.licenseignore @@ -1,4 +1,4 @@ -.github/workflows/configs/.flake8 +.github/actions/python-lint-check/.flake8 **/*.yml CODEOWNERS LICENSE.txt