feat: optimize quick install scripts — version pinning, redirect-base… #574
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: xlings-ci-macos | |
| on: | |
| push: | |
| branches: [main, master] | |
| pull_request: | |
| branches: [main, master] | |
| env: | |
| GIT_TERMINAL_PROMPT: 0 | |
| MACOSX_DEPLOYMENT_TARGET: "11.0" | |
| BOOTSTRAP_XLINGS_VERSION: v0.3.2 | |
| BOOTSTRAP_LLVM_VERSION: 20.1.7 | |
| XMAKE_VERSION: v3.0.7 | |
| jobs: | |
| build-and-test: | |
| runs-on: macos-15 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # ── Phase 1: Configure Environment ────────────────────────── | |
| - name: Install xmake | |
| uses: xmake-io/github-action-setup-xmake@v1 | |
| with: | |
| xmake-version: ${{ env.XMAKE_VERSION }} | |
| - name: Bootstrap legacy xlings | |
| run: | | |
| PKG_VERSION="${BOOTSTRAP_XLINGS_VERSION#v}" | |
| ARCHIVE="xlings-${PKG_VERSION}-macosx-arm64.tar.gz" | |
| DOWNLOAD_URL="https://github.com/d2learn/xlings/releases/download/${BOOTSTRAP_XLINGS_VERSION}/${ARCHIVE}" | |
| BOOTSTRAP_ROOT="$RUNNER_TEMP/bootstrap-xlings" | |
| rm -rf "$BOOTSTRAP_ROOT" | |
| mkdir -p "$BOOTSTRAP_ROOT" | |
| curl -fsSL -o "$BOOTSTRAP_ROOT/$ARCHIVE" "$DOWNLOAD_URL" | |
| tar -xzf "$BOOTSTRAP_ROOT/$ARCHIVE" -C "$BOOTSTRAP_ROOT" | |
| BOOTSTRAP_HOME="$(find "$BOOTSTRAP_ROOT" -mindepth 1 -maxdepth 1 -type d -name 'xlings-*' | head -1)" | |
| [[ -n "$BOOTSTRAP_HOME" ]] || { echo "bootstrap xlings package not found"; exit 1; } | |
| xattr -cr "$BOOTSTRAP_HOME" 2>/dev/null || true | |
| echo "BOOTSTRAP_XLINGS_HOME=$BOOTSTRAP_HOME" >> "$GITHUB_ENV" | |
| - name: Install LLVM toolchain with legacy xlings | |
| run: | | |
| export XLINGS_HOME="$HOME/.xlings" | |
| rm -rf "$XLINGS_HOME" | |
| "$BOOTSTRAP_XLINGS_HOME/bin/xlings" self init | |
| "$BOOTSTRAP_XLINGS_HOME/bin/xlings" install llvm@"$BOOTSTRAP_LLVM_VERSION" -y | |
| ACTUAL_LLVM_PREFIX="$(find "$XLINGS_HOME/data/xpkgs" -path "*/${BOOTSTRAP_LLVM_VERSION}" -type d | head -1)" | |
| [[ -n "$ACTUAL_LLVM_PREFIX" ]] || { echo "installed llvm toolchain not found"; exit 1; } | |
| LLVM_ALIAS_ROOT="$XLINGS_HOME/data/xpkgs/local-x-llvm" | |
| mkdir -p "$LLVM_ALIAS_ROOT" | |
| rm -rf "$LLVM_ALIAS_ROOT/$BOOTSTRAP_LLVM_VERSION" | |
| ln -s "$ACTUAL_LLVM_PREFIX" "$LLVM_ALIAS_ROOT/$BOOTSTRAP_LLVM_VERSION" | |
| LLVM_PREFIX="$LLVM_ALIAS_ROOT/$BOOTSTRAP_LLVM_VERSION" | |
| [[ -x "$LLVM_PREFIX/bin/clang++" ]] || { echo "clang++ missing in $LLVM_PREFIX"; exit 1; } | |
| echo "LLVM_PREFIX=$LLVM_PREFIX" >> "$GITHUB_ENV" | |
| echo "SDKROOT=$(xcrun --sdk macosx --show-sdk-path)" >> "$GITHUB_ENV" | |
| echo "$LLVM_PREFIX/bin" >> "$GITHUB_PATH" | |
| echo "Configured LLVM toolchain path: $LLVM_PREFIX" | |
| "$LLVM_PREFIX/bin/clang++" --version | |
| - name: Prepare fixture index repo | |
| run: | | |
| rm -rf tests/fixtures/xim-pkgindex | |
| git clone --depth 1 https://github.com/d2learn/xim-pkgindex.git tests/fixtures/xim-pkgindex | |
| - name: Configure xmake | |
| run: | | |
| # Temporary workaround: configure xmake with the explicit SDK path | |
| # from the bootstrap-installed LLVM toolchain on the GitHub runner. | |
| xmake f -c -p macosx -m release \ | |
| --toolchain=llvm \ | |
| --sdk="$LLVM_PREFIX" \ | |
| --target_minver=11.0 \ | |
| -y | |
| echo "xmake configured with LLVM SDK: $LLVM_PREFIX" | |
| # ── Phase 1.5: Unit Tests ──────────────────────────────────── | |
| - name: Build and run unit tests | |
| run: | | |
| xmake build xlings_tests | |
| xmake run xlings_tests | |
| # ── Phase 2: Build via Release Script ─────────────────────── | |
| - name: Build (macos_release) | |
| run: | | |
| chmod +x ./tools/macos_release.sh | |
| SKIP_NETWORK_VERIFY=1 ./tools/macos_release.sh | |
| - name: Prepare fixture index repo | |
| run: | | |
| bash tests/e2e/prepare_fixture_index.sh | |
| - name: "E2E-01: Bootstrap Home (portable + installed)" | |
| run: | | |
| bash tests/e2e/bootstrap_home_test.sh | |
| - name: Prepare release artifact | |
| run: | | |
| tarball=$(ls build/xlings-*-macosx-arm64.tar.gz 2>/dev/null | head -1) | |
| [[ -z "$tarball" ]] && { echo "No release tarball found"; exit 1; } | |
| cp "$tarball" build/release.tar.gz | |
| - name: "E2E-02: Release Self Install" | |
| run: | | |
| bash tests/e2e/release_self_install_test.sh build/release.tar.gz | |
| - name: "E2E-03: Quick Install Smoke" | |
| continue-on-error: true # may fail due to GitHub rate limits | |
| env: | |
| XLINGS_NON_INTERACTIVE: 1 | |
| run: | | |
| bash tests/e2e/release_quick_install_test.sh | |
| - name: "E2E-04: Release Subos + d2x Reuse + RPATH" | |
| run: | | |
| bash tests/e2e/release_subos_smoke_test.sh build/release.tar.gz | |
| - name: "E2E-05: Fixed Project Scenarios" | |
| run: | | |
| bash tests/e2e/project_e2e_test.sh | |
| - name: "E2E-06: Script-type package install/export/uninstall" | |
| run: | | |
| bash tests/e2e/script_type_install_test.sh | |
| - name: Attach artifact | |
| uses: actions/upload-artifact@v4 | |
| if: success() | |
| with: | |
| name: xlings-macosx-arm64 | |
| path: build/release.tar.gz |