From 1a841faf8aebbfef9594fdc37b9a7b23fc799e38 Mon Sep 17 00:00:00 2001 From: Franz Busch Date: Mon, 14 Oct 2024 14:35:26 +0100 Subject: [PATCH] [CI] Create uses-with-expression action # Motivation # Modification # Result --- .../actions/uses_with_expression/action.yml | 35 +++++++++++++++++++ .github/workflows/pull_request.yml | 15 ++++---- 2 files changed, 44 insertions(+), 6 deletions(-) create mode 100644 .github/actions/uses_with_expression/action.yml diff --git a/.github/actions/uses_with_expression/action.yml b/.github/actions/uses_with_expression/action.yml new file mode 100644 index 0000000000..131216918d --- /dev/null +++ b/.github/actions/uses_with_expression/action.yml @@ -0,0 +1,35 @@ +name: Uses with expression +description: Dynamic step that allows `uses` with expressions. +inputs: + uses_with_expression: + description: Reference to an action that allows expressions. + required: true + with: + description: Inputs for the action as JSON. + required: false + default: "{}" +runs: + using: composite + steps: + - name: Create local action + shell: bash + run: | + mkdir -p ./.uses_with_expression && + cat <<'LOCAL_ACTION' >./.uses_with_expression/action.yml + runs: + using: composite + steps: + - run: rm -rf ./.uses_with_expression + shell: sh + - name: Run + id: run + uses: ${{ inputs.uses_with_expression }} + with: ${{ inputs.with || '{}' }} + LOCAL_ACTION + - name: Run local action + id: run + uses: ./.uses_with_expression + - name: Cleanup local action + if: always() && steps.run.outcome != 'success' + shell: bash + run: rm -rf ./.uses_with_expression \ No newline at end of file diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 120c7472e9..64467191d6 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -16,13 +16,16 @@ jobs: unit-tests: name: Unit tests # Workaround https://github.com/nektos/act/issues/1875 - uses: apple/swift-nio/.github/workflows/unit_tests.yml@main + uses: ./.github/actions/uses_with_expression/ with: - linux_5_8_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" - linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" - linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" - linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error" - linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error" + uses_with_expression: apple/swift-nio/.github/workflows/unit_tests.yml@main + with: | + '{linux_5_9_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" + linux_5_10_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" + linux_6_0_arguments_override: "-Xswiftc -warnings-as-errors --explicit-target-dependency-import-check error" + linux_nightly_6_0_arguments_override: "--explicit-target-dependency-import-check error" + linux_nightly_main_arguments_override: "--explicit-target-dependency-import-check error"}' + benchmarks: name: Benchmarks