From 97e6839d5aa6fb093feee7c7e7d75e49c3a0f310 Mon Sep 17 00:00:00 2001 From: Parker Timmerman Date: Sat, 27 Jul 2024 13:54:32 -0400 Subject: [PATCH] implement a workflow to package up a macos sysroot with the option to remove troublesome files --- .github/workflows/macos-sysroot.yml | 66 +++++++++++++++-------------- macos-sysroot/remove.txt | 1 + 2 files changed, 36 insertions(+), 31 deletions(-) create mode 100644 macos-sysroot/remove.txt diff --git a/.github/workflows/macos-sysroot.yml b/.github/workflows/macos-sysroot.yml index 14a6179..42f4530 100644 --- a/.github/workflows/macos-sysroot.yml +++ b/.github/workflows/macos-sysroot.yml @@ -19,39 +19,43 @@ jobs: permissions: contents: write steps: - - name: Package SDK + - name: List Available SDKs run: | ls -lAh /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs + ls -lAh /Applications/Xcode* + - name: Determine Path to SDK + run: | + SDK_NAME="MacOSX${{ inputs.macos_sdk_version }}.sdk" + SDK_PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/$SDK_NAME + + if [ ! -d "$SDK_PATH" ]; then + echo "$SDK_PATH does not exist." + exit 1 + fi + echo "SDK_NAME=$SDK_NAME" >> $GITHUB_ENV + echo "SDK_PATH=$SDK_PATH" >> $GITHUB_ENV + - name: Package SDK + run: | + mkdir working + mkdir artifacts - # mkdir downloads - # mkdir artifacts - - # component=${{ matrix.component }} - # target=${{ matrix.target }} - # version=${{ inputs.rust_version }} - - # cd downloads - # full_name="$component-$version-$target" - # xz_name="$full_name.tar.xz" - - # wget https://static.rust-lang.org/dist/$xz_name - - # tar -xJf $xz_name - # tar -cf - $full_name | zstd --ultra -22 -o "../artifacts/$full_name.tar.zst" - - # - name: Determine Release Tag - # run: | - # RELEASE_TAG="rust-${{ inputs.rust_version }}" - # if [ -n "${{ inputs.github_tag }}" ]; then - # RELEASE_TAG="${{ inputs.github_tag }}" - # fi - # echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV + cp -rP $SDK_PATH working/$SDK_NAME + cat macos-sysroot/remove.txt | while read -r val; do eval rm -v working/$SDK_NAME/$val; done + tar -cf - working/$SDK_NAME | zstd --ultra -22 -o "working/$SDK_NAME.tar.zst" - # - name: Upload zstd Compressed Artifacts to Release - # uses: svenstaro/upload-release-action@v2 - # with: - # file: "artifacts/*.tar.zst" - # file_glob: true - # tag: ${{ env.RELEASE_TAG }} - # overwrite: true + - name: Determine Release Tag + run: | + RELEASE_TAG="macos-sysroot-sdk-${{ inputs.macos_sdk_version }}" + if [ -n "${{ inputs.github_tag }}" ]; then + RELEASE_TAG="${{ inputs.github_tag }}" + fi + echo "RELEASE_TAG=$RELEASE_TAG" >> $GITHUB_ENV + + - name: Upload zstd Compressed Artifacts to Release + uses: svenstaro/upload-release-action@v2 + with: + file: "artifacts/*.tar.zst" + file_glob: true + tag: ${{ env.RELEASE_TAG }} + overwrite: true diff --git a/macos-sysroot/remove.txt b/macos-sysroot/remove.txt new file mode 100644 index 0000000..8e42167 --- /dev/null +++ b/macos-sysroot/remove.txt @@ -0,0 +1 @@ +System/Library/Frameworks/Ruby.framework/Versions/2.6/Headers/ruby/ruby