From c7897c33763f7c245eaa7470f0d4f4e793cd7ea6 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 18:29:07 -0700 Subject: [PATCH 01/12] Fix macOS; fail unless we really got it installed. --- .github/workflows/test-install.yml | 3 ++- action.yml | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 29a04a3..4792883 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -23,4 +23,5 @@ jobs: tag: DEVELOPMENT-SNAPSHOT-2023-05-20-a - name: check swift version - run: swift --version + run: swift --version | grep -q 5.9-dev + shell: bash diff --git a/action.yml b/action.yml index bcdcc8c..7189e16 100644 --- a/action.yml +++ b/action.yml @@ -285,5 +285,5 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg - echo "TOOLCHAINS=$(plutil -extract 'CFBundleIdentifier' xml1 ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist | xmllint --xpath '//plist/string/text()' -)" >> $GITHUB_ENV + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - || grep 'let Info = ' | sed -Ee 's/.*"(.*)".*/\1/')") >> $GITHUB_ENV shell: bash From fbf1f99e0d6d228c788ee0e83d9afaaa383ee1cf Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 18:30:32 -0700 Subject: [PATCH 02/12] Maybe don't suppress the output of grep. --- .github/workflows/test-install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 4792883..0c9c660 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -23,5 +23,5 @@ jobs: tag: DEVELOPMENT-SNAPSHOT-2023-05-20-a - name: check swift version - run: swift --version | grep -q 5.9-dev + run: swift --version | grep 5.9-dev shell: bash From 464a9c49217122efc52ed84cd012bfc567aa318f Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 18:32:02 -0700 Subject: [PATCH 03/12] Repair typo --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 7189e16..44b596d 100644 --- a/action.yml +++ b/action.yml @@ -285,5 +285,5 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg - echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - || grep 'let Info = ' | sed -Ee 's/.*"(.*)".*/\1/')") >> $GITHUB_ENV + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - || grep 'let Info = ' | sed -Ee 's/.*"(.*)".*/\1/')" >> $GITHUB_ENV shell: bash From 82388883416fabdd5750efda26988782b26de792 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 18:39:06 -0700 Subject: [PATCH 04/12] Typo again. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 44b596d..e9631b1 100644 --- a/action.yml +++ b/action.yml @@ -285,5 +285,5 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg - echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - || grep 'let Info = ' | sed -Ee 's/.*"(.*)".*/\1/')" >> $GITHUB_ENV + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep 'let Info = ' | sed -Ee 's/.*"(.*)".*/\1/')" >> $GITHUB_ENV shell: bash From 5284872c0ec669954b0ff08f85ac2a2eea5c6e9c Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 18:49:34 -0700 Subject: [PATCH 05/12] Shot in the dark: use cut instead of sed. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index e9631b1..101083a 100644 --- a/action.yml +++ b/action.yml @@ -285,5 +285,5 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg - echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep 'let Info = ' | sed -Ee 's/.*"(.*)".*/\1/')" >> $GITHUB_ENV + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep 'let Info = ' | cut -f 2 -d '"')" >> $GITHUB_ENV shell: bash From aa6efbb3d689392b4560dfc06438c5d04703c265 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 18:50:30 -0700 Subject: [PATCH 06/12] Add some diagnostic output --- action.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/action.yml b/action.yml index 101083a..1282da9 100644 --- a/action.yml +++ b/action.yml @@ -285,5 +285,9 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg + echo "-----------" + plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - + echo "-----------" + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep 'let Info = ' | cut -f 2 -d '"')" >> $GITHUB_ENV shell: bash From 31abcdc64272c90a12e1a1137164b8b5a53a7e3f Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 18:56:34 -0700 Subject: [PATCH 07/12] More diagnostics; try to make it work regardless of .plist format. --- action.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 1282da9..66245f2 100644 --- a/action.yml +++ b/action.yml @@ -285,9 +285,11 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg + echo "-----------" + cat ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist echo "-----------" plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - echo "-----------" - echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep 'let Info = ' | cut -f 2 -d '"')" >> $GITHUB_ENV + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep '"org.swift.' | cut -f 2 -d '"')" >> $GITHUB_ENV shell: bash From 0f43d3e4d62531b69a4ed91d682821e3544a80a7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 19:03:57 -0700 Subject: [PATCH 08/12] Try a more resilient sed invocation. --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 66245f2..2b7400e 100644 --- a/action.yml +++ b/action.yml @@ -291,5 +291,5 @@ runs: plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - echo "-----------" - echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep '"org.swift.' | cut -f 2 -d '"')" >> $GITHUB_ENV + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep '"org.swift.' | sed -E -e 's/.*"(org.swift[^"]*)".*/\1/')" >> $GITHUB_ENV shell: bash From 9a5a5372638c5d3aa81db4603d9fa1e5ac405353 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Wed, 20 Mar 2024 19:07:58 -0700 Subject: [PATCH 09/12] Nix diagnostic echoes --- action.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/action.yml b/action.yml index 2b7400e..da6411a 100644 --- a/action.yml +++ b/action.yml @@ -285,11 +285,5 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg - echo "-----------" - cat ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist - echo "-----------" - plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - - echo "-----------" - echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep '"org.swift.' | sed -E -e 's/.*"(org.swift[^"]*)".*/\1/')" >> $GITHUB_ENV shell: bash From 13fcffded5aeb432642222c25f60d24d382b5ef7 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 21 Mar 2024 01:28:11 -0700 Subject: [PATCH 10/12] GHA: repair the Ubuntu environment Correct variable substitution to repair the Ubuntu usage of the task. Furthermore, enable testing on the Ubuntu runner as well. --- .github/workflows/test-install.yml | 2 +- action.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 0c9c660..888b860 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -8,7 +8,7 @@ jobs: strategy: fail-fast: false matrix: - os: [macos-latest, windows-latest] # ubuntu-latest is not working at the moment + os: [macos-latest, windows-latest, ubuntu-latest] name: Test Swift toolchain install on ${{ matrix.os }} runs-on: ${{ matrix.os }} diff --git a/action.yml b/action.yml index da6411a..d70dfb8 100644 --- a/action.yml +++ b/action.yml @@ -255,7 +255,7 @@ runs: if [[ "${{ steps.validation.outputs.use_custom_url }}" == "1" ]]; then mv "${{ inputs.release-asset-name }}" swift-toolchain.tar.gz else - curl -sL https://download.swift.org/${{ inputs.branch }}/ubuntu${release/./}/swift-${{ inputs.tag }}/swift-${{ inputs.tag }}-ubuntu${release}.tar.gz -o swift-toolchain.tar.gz + curl -sL https://download.swift.org/${{ inputs.branch }}/ubuntu${VERSION_ID/./}/swift-${{ inputs.tag }}/swift-${{ inputs.tag }}-ubuntu${VERSION_ID}.tar.gz -o swift-toolchain.tar.gz fi tar zxf swift-toolchain.tar.gz -C ${HOME} rm -f swift-toolchain.tar.gz From 0776936787f8b48948209af8185c8bd2c1b005bf Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Thu, 21 Mar 2024 14:56:46 -0700 Subject: [PATCH 11/12] Adjust version check for ubuntu build reporting itself as 5.10 --- .github/workflows/test-install.yml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-install.yml b/.github/workflows/test-install.yml index 888b860..dde4eb8 100644 --- a/.github/workflows/test-install.yml +++ b/.github/workflows/test-install.yml @@ -9,6 +9,11 @@ jobs: fail-fast: false matrix: os: [macos-latest, windows-latest, ubuntu-latest] + include: + - expected-version: 5.9-dev + + - os: ubuntu-latest + expected-version: 5.10 name: Test Swift toolchain install on ${{ matrix.os }} runs-on: ${{ matrix.os }} @@ -23,5 +28,5 @@ jobs: tag: DEVELOPMENT-SNAPSHOT-2023-05-20-a - name: check swift version - run: swift --version | grep 5.9-dev + run: swift --version && swift --version | grep -q 'version ${{ matrix.expected-version }} ' shell: bash From 3395352e248309529b32f9263bc9e5963c836d59 Mon Sep 17 00:00:00 2001 From: Dave Abrahams Date: Mon, 25 Mar 2024 15:37:27 -0700 Subject: [PATCH 12/12] take suggestion. Co-authored-by: Saleem Abdulrasool --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index d70dfb8..b4a6776 100644 --- a/action.yml +++ b/action.yml @@ -285,5 +285,5 @@ runs: installer -pkg swift-${{ inputs.tag }}-osx.pkg -target CurrentUserHomeDirectory rm -f swift-${{ inputs.tag }}-osx.pkg - echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | grep '"org.swift.' | sed -E -e 's/.*"(org.swift[^"]*)".*/\1/')" >> $GITHUB_ENV + echo "TOOLCHAINS=$(plutil -convert swift ${HOME}/Library/Developer/Toolchains/swift-${{ inputs.tag }}.xctoolchain/Info.plist -o - | sed -E -e '/"org.swift./s/.*"(org.swift[^"]*)".*/\1/')" >> $GITHUB_ENV shell: bash