From 4e15d3f3b2cee55383052195dc0b29ab3ccbbf49 Mon Sep 17 00:00:00 2001 From: Tim <0xtimc@gmail.com> Date: Mon, 21 Oct 2024 18:26:50 +0100 Subject: [PATCH 1/2] Add workflow for testing musl --- .github/workflows/swift_package_test.yml | 36 ++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index 8866fc8..77bb007 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -27,6 +27,10 @@ on: type: string description: "Linux command to execute before building the Swift package" default: "" + musl_pre_build_command: + type: string + description: "Linux command to execute before building the Swift package" + default: "" linux_build_command: type: string description: "Linux Build command default is swift test" @@ -35,6 +39,10 @@ on: type: string description: "Linux Build command default is swift test" default: "swift test" + musl_build_command: + type: string + description: "MUSL Build command default is swift test" + default: "swift test" linux_env_vars: description: "List of environment variables" type: string @@ -42,6 +50,10 @@ on: type: boolean description: "Boolean to enable windows testing. Defaults to true." default: true + enable_musl_checks: + type: boolean + description: "Boolean to enable musl testing. Defaults to true." + default: true jobs: linux-build: @@ -110,3 +122,27 @@ jobs: - name: Build / Test timeout-minutes: 60 run: docker run -v ${{ github.workspace }}:C:\source swiftlang/swift:${{ matrix.swift_version }}-windowsservercore-1809 cmd /s /c "swift --version & swift test --version & cd C:\source\ & ${{ inputs.windows_build_command }} ${{ inputs.swift_nightly_flags }}" + + musl-build: + name: MUSL + if: ${{ inputs.enable_musl_checks }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + container: swift:6.0-noble + steps: + - name: Check out code + uses: actions/checkout@v4 + - name: Install SDK + run: swift sdk install https://download.swift.org/swift-6.0.1-release/static-sdk/swift-6.0.1-RELEASE/swift-6.0.1-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz --checksum d4f46ba40e11e697387468e18987ee622908bc350310d8af54eb5e17c2ff5481 + - name: Set environment variables + if: ${{ inputs.linux_env_vars }} + run: | + for i in "${{ inputs.linux_env_vars }}" + do + printf "%s\n" $i >> $GITHUB_ENV + done + - name: Pre-build + run: ${{ inputs.musl_pre_build_command }} + - name: Build / Test + run: ${{ inputs.musl_build_command }} ${{ inputs.swift_flags }} \ No newline at end of file From 415c9a126cca0834080cab32904f9d6c26084696 Mon Sep 17 00:00:00 2001 From: Tim <0xtimc@gmail.com> Date: Mon, 21 Oct 2024 18:52:24 +0100 Subject: [PATCH 2/2] Fix linting error --- .github/workflows/swift_package_test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/swift_package_test.yml b/.github/workflows/swift_package_test.yml index 77bb007..cd0f95b 100644 --- a/.github/workflows/swift_package_test.yml +++ b/.github/workflows/swift_package_test.yml @@ -145,4 +145,4 @@ jobs: - name: Pre-build run: ${{ inputs.musl_pre_build_command }} - name: Build / Test - run: ${{ inputs.musl_build_command }} ${{ inputs.swift_flags }} \ No newline at end of file + run: ${{ inputs.musl_build_command }} ${{ inputs.swift_flags }}