diff --git a/.github/workflows/nightly_snapshot_check.yml b/.github/workflows/nightly_snapshot_check.yml new file mode 100644 index 00000000..6a395cd9 --- /dev/null +++ b/.github/workflows/nightly_snapshot_check.yml @@ -0,0 +1,28 @@ +name: Smoke Test - Nightly Swift Toolchain + +on: + schedule: + - cron: '30 3 * * *' + +env: + SWIFTLY_BOOTSTRAP_VERSION: 1.0.0 + +jobs: + tests-selfhosted: + name: Test (Smoke Test - Nightly Swift Toolchain) / ${{ matrix.container }} + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + container: ["ubuntu:20.04", "ubuntu:22.04", "ubuntu:24.04", "redhat/ubi9", "debian:12", "fedora:39"] + container: + image: ${{ matrix.container }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Prepare the action + run: ./scripts/prep-gh-action.sh --install-swiftly --swift-main-snapshot + - name: Build and Test + # UBI 9 and Ubuntu 20.04 - See https://github.com/swiftlang/swift/issues/80908 + # UBI 9 - See https://github.com/swiftlang/swift/issues/80909 + run: bash -c 'if [[ "${{ matrix.container }}" == "redhat/ubi9" ]]; then swiftly run +main-snapshot swift build --build-tests; elif [[ "${{ matrix.container }}" == "ubuntu:20.04" ]]; then swiftly run +main-snapshot swift build --build-tests; else swiftly run +main-snapshot swift test; fi' diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index 38f8f91c..85e4033a 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -16,6 +16,9 @@ while [ $# -ne 0 ]; do --install-swiftly) installSwiftly=true ;; + --swift-main-snapshot) + swiftMainSnapshot=true + ;; *) ;; esac @@ -34,23 +37,34 @@ if [ "$installSwiftly" == true ]; then echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV" fi - if [ -f .swift-version ]; then - echo "Installing selected swift toolchain" - swiftly install --post-install-file=post-install.sh + selector=() + runSelector=() + + if [ "$swiftMainSnapshot" == true ]; then + echo "Installing latest main-snapshot toolchain" + selector=("main-snapshot") + runSelector=("+main-snapshot") + elif [ -f .swift-version ]; then + echo "Installing selected swift toolchain from .swift-version file" + selector=() + runSelector=() else echo "Installing latest toolchain" - swiftly install --post-install-file=post-install.sh latest + selector=("latest") + runSelector=("+latest") fi + swiftly install --post-install-file=post-install.sh "${selector[@]}" + if [ -f post-install.sh ]; then echo "Performing swift toolchain post-installation" chmod u+x post-install.sh && ./post-install.sh fi echo "Displaying swift version" - swift --version + swiftly run "${runSelector[@]}" swift --version - CC=clang swiftly run "$(dirname "$0")/install-libarchive.sh" + CC=clang swiftly run "${runSelector[@]}" "$(dirname "$0")/install-libarchive.sh" else "$(dirname "$0")/install-libarchive.sh" fi