diff --git a/.github/workflows/build_release.yml b/.github/workflows/build_release.yml index 7519af5e..e03ec3dd 100644 --- a/.github/workflows/build_release.yml +++ b/.github/workflows/build_release.yml @@ -18,8 +18,8 @@ env: SWIFTLY_BOOTSTRAP_VERSION: 1.0.0 jobs: - buildrelease: - name: Build Release + buildrelease-linux: + name: Build Release / Linux x86_64 runs-on: ubuntu-latest container: image: "redhat/ubi9" @@ -44,3 +44,20 @@ jobs: name: swiftly-docs path: .build/docs/** if-no-files-found: error + + buildrelease-macos: + name: Build Release / macOS + runs-on: [self-hosted, macos, sequoia, ARM64] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Prepare the action + run: ./scripts/prep-gh-action.sh --install-swiftly + - name: Build Release Artifact + run: swift run build-swiftly-release ${{ inputs.skip }} ${{ inputs.version }} + - name: Upload Release Artifact + uses: actions/upload-artifact@v4 + with: + name: swiftly-release-x86_64 + path: .build/release/swiftly-*.tar.gz + if-no-files-found: error diff --git a/.github/workflows/nightly_snapshot_check.yml b/.github/workflows/nightly_snapshot_check.yml index 6a395cd9..be05bba3 100644 --- a/.github/workflows/nightly_snapshot_check.yml +++ b/.github/workflows/nightly_snapshot_check.yml @@ -8,7 +8,7 @@ env: SWIFTLY_BOOTSTRAP_VERSION: 1.0.0 jobs: - tests-selfhosted: + tests-selfhosted-linux: name: Test (Smoke Test - Nightly Swift Toolchain) / ${{ matrix.container }} runs-on: ubuntu-latest strategy: @@ -26,3 +26,14 @@ jobs: # 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' + + tests-selfhosted-macos: + name: Test (Smoke Test - Nightly Swift Toolchain) / macOS Sequoia ARM64 + runs-on: [self-hosted, macos, sequoia, ARM64] + 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 + run: swift test diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 9aff96fb..6b28c1b9 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -7,7 +7,7 @@ on: branches: [main] env: - SWIFTLY_BOOTSTRAP_VERSION: 1.0.0 + SWIFTLY_BOOTSTRAP_VERSION: 1.0.1-dev jobs: soundness: @@ -22,6 +22,20 @@ jobs: shell_check_enabled: false unacceptable_language_check_enabled: true + macos-tests-selfhosted: + name: Test (Self Hosted) / macOS Sequoia ARM64 + runs-on: [self-hosted, macos, sequoia, ARM64] + strategy: + fail-fast: false + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Prepare the action + run: ./scripts/prep-gh-action.sh --install-swiftly + - name: Build and Test + run: swift test + timeout-minutes: 60 + tests-selfhosted: name: Test (Self Hosted) / ${{ matrix.container }} runs-on: ubuntu-latest @@ -42,7 +56,7 @@ jobs: run: bash -c 'if [[ "${{ matrix.container }}" == "redhat/ubi9" ]]; then swift build --build-tests; elif [[ "${{ matrix.container }}" == "ubuntu:20.04" ]]; then swift build --build-tests; else swift test; fi' releasebuildcheck: - name: Release Build Check + name: Release Build Check / Linux runs-on: ubuntu-latest container: image: "redhat/ubi9" @@ -63,11 +77,36 @@ jobs: - name: Upload Tests uses: actions/upload-artifact@v4 with: - name: swiftly-tests-x86_64 + name: test-swiftly-linux-x86_64 path: .build/debug/test-swiftly-linux-x86_64.tar.gz if-no-files-found: error retention-days: 1 + releasebuildcheckmacos: + name: Release Build Check / macOS + runs-on: [self-hosted, macos, sequoia, ARM64] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + - name: Prepare the action + run: ./scripts/prep-gh-action.sh --install-swiftly + - name: Build Artifact + run: swift run build-swiftly-release --test --skip "999.0.0" + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: swiftly-release-darwin + path: .build/release/swiftly-*.pkg + if-no-files-found: error + retention-days: 1 + - name: Upload Tests + uses: actions/upload-artifact@v4 + with: + name: test-swiftly-macos + path: .build/release/test-swiftly-macos.tar.gz + if-no-files-found: error + retention-days: 1 + releasetest: name: Test Release / ${{matrix.shell.pkg}} needs: releasebuildcheck @@ -92,7 +131,7 @@ jobs: - name: Download Tests uses: actions/download-artifact@v4 with: - name: swiftly-tests-x86_64 + name: test-swiftly-linux-x86_64 - name: Extract and Run Workflow Tests run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y ./swiftly.tar.gz @@ -112,7 +151,7 @@ jobs: - name: Download Tests uses: actions/download-artifact@v4 with: - name: swiftly-tests-x86_64 + name: test-swiftly-linux-x86_64 - name: Extract and Run Workflow Tests run: cp swiftly-*.tar.gz /root/swiftly.tar.gz && cp test-swiftly-*.tar.gz /root && cd /root && tar zxf test-swiftly-*.tar.gz && ./test-swiftly -y --custom-location ./swiftly.tar.gz diff --git a/scripts/prep-gh-action.sh b/scripts/prep-gh-action.sh index 85e4033a..85a420b6 100755 --- a/scripts/prep-gh-action.sh +++ b/scripts/prep-gh-action.sh @@ -2,11 +2,13 @@ # This script does a bit of extra preparation of the docker containers used to run the GitHub workflows # that are specific to this project's needs when building/testing. Note that this script runs on -# every supported Linux distribution so it must adapt to the distribution that it is running. +# every supported Linux distribution and macOS so it must adapt to the distribution that it is running. -# Install the basic utilities depending on the type of Linux distribution -apt-get --help && apt-get update && TZ=Etc/UTC apt-get -y install curl make gpg tzdata -yum --help && (curl --help && yum -y install curl) && yum install make gpg +if [[ "$(uname -s)" == "Linux" ]]; then + # Install the basic utilities depending on the type of Linux distribution + apt-get --help && apt-get update && TZ=Etc/UTC apt-get -y install curl make gpg tzdata + yum --help && (curl --help && yum -y install curl) && yum install make gpg +fi set -e @@ -27,14 +29,25 @@ done if [ "$installSwiftly" == true ]; then echo "Installing swiftly" - curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install - . "/root/.local/share/swiftly/env.sh" + if [[ "$(uname -s)" == "Linux" ]]; then + curl -O https://download.swift.org/swiftly/linux/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}-$(uname -m).tar.gz && tar zxf swiftly-*.tar.gz && ./swiftly init -y --skip-install + . "/root/.local/share/swiftly/env.sh" + else + export SWIFTLY_HOME_DIR="$(pwd)/swiftly-bootstrap" + export SWIFTLY_BIN_DIR="$SWIFTLY_HOME_DIR/bin" + export SWIFTLY_TOOLCHAINS_DIR="$SWIFTLY_HOME_DIR/toolchains" + + curl -O https://download.swift.org/swiftly/darwin/swiftly-${SWIFTLY_BOOTSTRAP_VERSION}.pkg && pkgutil --check-signature swiftly-*.pkg && pkgutil --verbose --expand swiftly-*.pkg "${SWIFTLY_HOME_DIR}" && tar -C "${SWIFTLY_HOME_DIR}" -xvf "${SWIFTLY_HOME_DIR}"/swiftly-*/Payload && "$SWIFTLY_HOME_DIR/bin/swiftly" init -y --skip-install + + . "$SWIFTLY_HOME_DIR/env.sh" + fi + hash -r if [ -n "$GITHUB_ENV" ]; then echo "Updating GitHub environment" - echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV" + echo "PATH=$PATH" >> "$GITHUB_ENV" && echo "SWIFTLY_HOME_DIR=$SWIFTLY_HOME_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_BIN_DIR=$SWIFTLY_BIN_DIR" >> "$GITHUB_ENV" && echo "SWIFTLY_TOOLCHAINS_DIR=$SWIFTLY_TOOLCHAINS_DIR" >> "$GITHUB_ENV" fi selector=() @@ -64,7 +77,11 @@ if [ "$installSwiftly" == true ]; then echo "Displaying swift version" swiftly run "${runSelector[@]}" swift --version - CC=clang swiftly run "${runSelector[@]}" "$(dirname "$0")/install-libarchive.sh" + if [[ "$(uname -s)" == "Linux" ]]; then + CC=clang swiftly run "${runSelector[@]}" "$(dirname "$0")/install-libarchive.sh" + fi else - "$(dirname "$0")/install-libarchive.sh" + if [[ "$(uname -s)" == "Linux" ]]; then + "$(dirname "$0")/install-libarchive.sh" + fi fi