Skip to content

Cleanup toolchain distribution code #552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 2, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/scripts/build-matrix.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"build_hello_wasm": true,
"clean_build_dir": false,
"free_disk_space": true,
"only_swift_sdk": true,
},
]

Expand Down
57 changes: 3 additions & 54 deletions .github/workflows/build-toolchain.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,26 +180,19 @@ jobs:
--security-opt seccomp=unconfined \
-dit \
-e CI=$CI \
-e ONLY_SWIFT_SDK=${{ matrix.only_swift_sdk }} \
-w /home/build-user/ \
-v ${{ github.workspace }}:/source \
-v oss-swift-package:/home/build-user \
${{ matrix.container }}
docker exec swiftwasm-ci-buildbot /bin/bash -lc 'env; cp -r /source/* /home/build-user/; ./swiftwasm-build/tools/build/ci.sh ${{ matrix.scheme }}'

- name: Extract installable archive from Docker container
if: ${{ matrix.container != null && !matrix.only_swift_sdk }}
run: |
docker cp swiftwasm-ci-buildbot:/home/build-user/swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-${{ matrix.target }}.tar.gz .
docker cp swiftwasm-ci-buildbot:/home/build-user/swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-${{ matrix.target }}.artifactbundle.zip . || true

- name: Extract installable archive from Docker container (wasm32-unknown-wasi)
if: ${{ matrix.container != null && matrix.only_swift_sdk }}
if: ${{ matrix.container != null }}
run: |
docker cp swiftwasm-ci-buildbot:/home/build-user/swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-wasm32-unknown-wasi.artifactbundle.zip .
# release-6.0 doesn't have wasm32-unknown-wasip1-threads SDK support yet
- name: Extract installable archive from Docker container (wasm32-unknown-wasip1-threads)
if: ${{ matrix.container != null && matrix.only_swift_sdk && matrix.scheme != 'release-6.0' }}
if: ${{ matrix.container != null && matrix.scheme != 'release-6.0' }}
run: |
docker cp swiftwasm-ci-buildbot:/home/build-user/swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle.zip .

Expand Down Expand Up @@ -228,23 +221,13 @@ jobs:
name: ${{ matrix.target }}-${{ matrix.scheme }}-installable
path: swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-${{ matrix.target }}.tar.gz

- name: Upload ${{ matrix.target }} SDK artifact bundle
uses: actions/upload-artifact@v4
if: ${{ !matrix.only_swift_sdk }}
with:
name: ${{ matrix.target }}-${{ matrix.scheme }}-artifactbundle
path: swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-${{ matrix.target }}.artifactbundle.zip
if-no-files-found: ignore

- name: Upload Swift SDK artifact bundle (wasm32-unknown-wasi)
uses: actions/upload-artifact@v4
if: ${{ matrix.only_swift_sdk }}
with:
name: ${{ matrix.scheme }}-wasm32-unknown-wasi-artifactbundle
path: swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-wasm32-unknown-wasi.artifactbundle.zip
- name: Upload Swift SDK artifact bundle (wasm32-unknown-wasip1-threads)
uses: actions/upload-artifact@v4
if: ${{ matrix.only_swift_sdk }}
with:
name: ${{ matrix.scheme }}-wasm32-unknown-wasip1-threads-artifactbundle
path: swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-wasm32-unknown-wasip1-threads.artifactbundle.zip
Expand All @@ -270,11 +253,6 @@ jobs:
docker exec swiftwasm-ci-buildbot /bin/bash -lc \
"./swiftwasm-build/schemes/${{ matrix.scheme }}/build/run-test.sh"

# We need this step to save disk space for the next steps when building toolchain
- name: Cleanup build directory
if: ${{ matrix.run_stdlib_test && matrix.container != null && !matrix.only_swift_sdk }}
run: docker exec swiftwasm-ci-buildbot /bin/bash -lc "rm -rf build"

- name: Run stdlib tests for wasi-wasm32
if: ${{ matrix.run_stdlib_test && matrix.container == null }}
run: ./swiftwasm-build/schemes/${{ matrix.scheme }}/build/run-test.sh
Expand All @@ -291,7 +269,7 @@ jobs:
path: ./swift-test-results.tar.gz

- name: Run integration tests (Swift SDK)
if: ${{ matrix.run_e2e_test && matrix.only_swift_sdk }}
if: ${{ matrix.run_e2e_test }}
run: |
docker exec swiftwasm-ci-buildbot /bin/bash -lc \
"./llvm-project/llvm/utils/lit/lit.py \
Expand All @@ -305,32 +283,3 @@ jobs:
docker stop swiftwasm-ci-buildbot
docker rm swiftwasm-ci-buildbot
docker volume rm --force oss-swift-package

# Run e2e test
- name: Prepare E2E test
if: ${{ !matrix.only_swift_sdk }}
run: |
INSTALL_DIR=$(mktemp -d)
tar xf swift-wasm-${{ matrix.toolchain_channel }}-SNAPSHOT-${{ matrix.target }}.tar.gz -C "$INSTALL_DIR"
echo "TOOLCHAIN=$(find "$INSTALL_DIR" -name "swift-wasm-${{ matrix.toolchain_channel }}-*" -type d | head -n1)" >> $GITHUB_ENV
- name: Build hello.wasm
shell: bash
if: ${{ matrix.build_hello_wasm && !matrix.only_swift_sdk }}
run: |
echo 'print("Hello, world!")' > hello.swift
$TOOLCHAIN/usr/bin/swiftc \
-target wasm32-unknown-wasi \
-sdk $TOOLCHAIN/usr/share/wasi-sysroot \
-resource-dir $TOOLCHAIN/usr/lib/swift_static \
hello.swift -o hello.wasm && \
echo "Successfully linked hello.wasm"
- name: Upload hello.wasm
if: ${{ matrix.build_hello_wasm && !matrix.only_swift_sdk && matrix.scheme == 'main' }}
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}-hello.wasm
path: hello.wasm

- name: Run integration tests
if: ${{ matrix.run_e2e_test && !matrix.only_swift_sdk }}
run: ${{ github.workspace }}/llvm-project/llvm/utils/lit/lit.py --param package-path=$TOOLCHAIN --param scheme=${{ matrix.scheme }} ${{ github.workspace }}/swiftwasm-build/test -vv
9 changes: 0 additions & 9 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,6 @@ config.test_exec_root = lit_config.params.get(
config.available_features.add("platform="+platform.system())
config.available_features.add("scheme="+lit_config.params.get("scheme", "main"))

# --param package-path=PATH
package_path = lit_config.params.get("package-path")
if package_path:
package_path = os.path.abspath(package_path)
lit_config.note(f"testing toolchain package: {package_path}")
else:
lit_config.warning("'--param package-path=PATH' is not set, skipping toolchain tests")
config.swift_package_path = package_path

# --param swift-sdk=<swift-sdk-id>
swift_sdk = lit_config.params.get("swift-sdk")
if swift_sdk:
Expand Down
11 changes: 0 additions & 11 deletions test/toolchain/Inputs/clang-module-example/Package.swift

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions test/toolchain/Inputs/imports.swift

This file was deleted.

3 changes: 0 additions & 3 deletions test/toolchain/basic.swift

This file was deleted.

6 changes: 0 additions & 6 deletions test/toolchain/clang-module.swift

This file was deleted.

15 changes: 0 additions & 15 deletions test/toolchain/foundation/Bundle.swift

This file was deleted.

34 changes: 0 additions & 34 deletions test/toolchain/foundation/FileManager.swift

This file was deleted.

Empty file.
Empty file.
Empty file.
1 change: 0 additions & 1 deletion test/toolchain/foundation/Inputs/hello.txt

This file was deleted.

13 changes: 0 additions & 13 deletions test/toolchain/foundation/ProcessInfo.swift

This file was deleted.

23 changes: 0 additions & 23 deletions test/toolchain/foundation/XML.swift

This file was deleted.

2 changes: 0 additions & 2 deletions test/toolchain/import-system-modules.swift

This file was deleted.

11 changes: 0 additions & 11 deletions test/toolchain/lit.local.cfg

This file was deleted.

5 changes: 0 additions & 5 deletions test/toolchain/swiftpm-build.swift

This file was deleted.

12 changes: 0 additions & 12 deletions test/toolchain/swiftpm-test.test

This file was deleted.

6 changes: 1 addition & 5 deletions tools/build/ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,4 @@ export PATH="$SCCACHE_INSTALL_PATH:$PATH"

$TOOLS_BUILD_PATH/build-toolchain.sh "$SCHEME"

if [ "$ONLY_SWIFT_SDK" = "true" ]; then
$TOOLS_BUILD_PATH/package-toolchain --scheme "$SCHEME" --daily-snapshot --only-swift-sdk
else
$TOOLS_BUILD_PATH/package-toolchain --scheme "$SCHEME" --daily-snapshot
fi
$TOOLS_BUILD_PATH/package-toolchain --scheme "$SCHEME" --daily-snapshot
Loading
Loading