diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2e620efb..40a4d7b2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -90,143 +90,11 @@ jobs: - name: Deduplicate dependencies run: pnpm dedupe --check - run: - name: Run task - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - submodules: true - - - uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0 - with: - save-cache: ${{ github.ref_name == 'main' }} - cache-key: run - - - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 - - - name: Build self - run: pnpm bootstrap-cli - - - name: Run self - run: vite run -r build - - - name: Print help for built-in commands - run: | - vite -h - vite run -h - vite lint -h - vite test -h - vite build -h - vite fmt -h - - cli-e2e-test: - name: CLI E2E test - strategy: - fail-fast: false - matrix: - include: - - os: ubuntu-latest - - os: namespace-profile-mac-default - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - submodules: true - - - run: | - brew install rustup - rustup install stable - echo "PATH=/opt/homebrew/opt/rustup/bin:$PATH" >> $GITHUB_ENV - if: ${{ matrix.os == 'namespace-profile-mac-default' }} - - - uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0 - with: - save-cache: ${{ github.ref_name == 'main' }} - cache-key: cli-e2e-test - - - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 - - - name: Build CLI - run: pnpm run bootstrap-cli - - - name: Run CLI lint - run: pnpm lint - - - name: Install Playwright browsers - run: pnpx playwright install chromium - - - name: Run CLI E2E tests - run: | - pnpm test - git diff --exit-code - - install-e2e-test: - name: vite install E2E test - # FIXME: Error: spawnSync esbuild ENOTSOCK - # runs-on: ubuntu-latest - runs-on: namespace-profile-mac-default - if: ${{ github.ref_name == 'main' }} - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - submodules: true - - - uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.0 - with: - save-cache: ${{ github.ref_name == 'main' }} - cache-key: install-e2e-test - - - uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0 - - - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 - - - name: Build vite rust binary - run: cargo build --bin vite --release - - - name: Run vite install - run: | - export PATH=$PWD/target/release:$PATH - - # Test vite install on various repositories with different package managers - repos=( - # pnpm workspace - "pnpm/pnpm:pnpm" - "vitejs/vite:vite" - # yarn workspace - "napi-rs/napi-rs:napi-rs" - "toeverything/AFFiNE:AFFiNE" - # npm workspace - "npm/cli:npm" - "redhat-developer/vscode-extension-tester:vscode-extension-tester" - ) - - for repo_info in "${repos[@]}"; do - IFS=':' read -r repo dir_name <<< "$repo_info" - echo "Testing vite install on $repo..." - # remove the directory if it exists - if [ -d "tmp/$dir_name" ]; then - rm -rf "tmp/$dir_name" - fi - git clone --depth 1 "https://github.com/$repo.git" "tmp/$dir_name" - cd "tmp/$dir_name" - vite install - # run again to show install cache increase by time - time vite install - echo "✓ Successfully installed dependencies for $repo" - echo "" - done - done: runs-on: ubuntu-latest needs: - test - lint - - run - - cli-e2e-test steps: - run: exit 1 # Thank you, next https://github.com/vercel/next.js/blob/canary/.github/workflows/build_and_test.yml#L379 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index a6b7f654..00000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,134 +0,0 @@ -name: Release - -on: - workflow_dispatch: - -permissions: {} - -jobs: - build-rust: - runs-on: ${{ matrix.settings.os }} - permissions: - contents: read - strategy: - fail-fast: false - matrix: - settings: - - target: aarch64-apple-darwin - os: namespace-profile-mac-default - - target: aarch64-unknown-linux-gnu - os: ubuntu-latest - - target: x86_64-unknown-linux-gnu - os: ubuntu-latest - - target: x86_64-pc-windows-msvc - os: windows-latest - # - aarch64-pc-windows-msvc - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - submodules: true - - - uses: oxc-project/setup-rust@d286d43bc1f606abbd98096666ff8be68c8d5f57 # v1.0.2 - with: - save-cache: ${{ github.ref_name == 'main' }} - cache-key: release - - - name: Rustup Adds Target - run: rustup target add ${{ matrix.settings.target }} - - - name: Add musl target (x86_64) - if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} - run: rustup target add x86_64-unknown-linux-musl - - - name: Add musl target (aarch64) - if: ${{ matrix.settings.target == 'aarch64-unknown-linux-gnu' }} - run: rustup target add aarch64-unknown-linux-musl - - - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 - - - name: Set binding version - run: pnpm exec tool replace-file-content packages/cli/binding/Cargo.toml 'version = "0.0.0"' 'version = "0.0.0-${{ github.sha }}"' - - - name: Build - if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} - run: pnpm --filter=@voidzero-dev/vite-plus build --target ${{ matrix.settings.target }} --use-napi-cross - env: - CC: x86_64-unknown-linux-gnu-cc - TARGET_CC: clang - - - name: Build - if: ${{ matrix.settings.target == 'aarch64-unknown-linux-gnu' }} - run: pnpm --filter=@voidzero-dev/vite-plus build --target ${{ matrix.settings.target }} --use-napi-cross - env: - TARGET_CC: clang - - - name: Build - if: ${{ !contains(matrix.settings.target, 'linux') }} - run: pnpm --filter=@voidzero-dev/vite-plus build --target ${{ matrix.settings.target }} - - - name: Upload artifact - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - with: - name: bindings-${{ matrix.settings.target }} - path: ./packages/cli/binding/*.node - if-no-files-found: error - - - name: Upload cli dist - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2 - if: ${{ matrix.settings.target == 'x86_64-unknown-linux-gnu' }} - with: - name: cli - path: ./packages/cli/dist - if-no-files-found: error - - Release: - runs-on: ubuntu-latest - needs: build-rust - permissions: - contents: read - packages: write - steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - persist-credentials: false - submodules: true - - - uses: oxc-project/setup-node@fdbf0dfd334c4e6d56ceeb77d91c76339c2a0885 # v1.0.4 - - - name: Bootstrap - run: pnpm bootstrap-cli:ci - - - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - path: packages/cli/dist - pattern: cli - merge-multiple: true - - - uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 - with: - path: packages/cli/dist - pattern: bindings-* - merge-multiple: true - - - name: Set npm packages version - run: | - sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/global/package.json - sed -i 's/"version": "0.0.0"/"version": "0.0.0-${{ github.sha }}"/' packages/cli/package.json - - # Setup node correctly for publishing to github registry - - uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 - with: - node-version-file: .node-version - registry-url: 'https://npm.pkg.github.com' - scope: '@voidzero-dev' - package-manager-cache: false - - - run: npm install -g npm@latest # For trusted publishing support - - - name: Publish - run: | - pnpm publish --filter=./packages/global --registry https://npm.pkg.github.com --no-git-checks - pnpm publish --filter=./packages/cli --registry https://npm.pkg.github.com --no-git-checks - env: - NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}