diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml deleted file mode 100644 index 44537f1338a7..000000000000 --- a/.github/workflows/benchmark.yml +++ /dev/null @@ -1,105 +0,0 @@ -name: Benchmark - -on: - issue_comment: - types: [created] - workflow_dispatch: - -env: - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - FORCE_COLOR: true - -jobs: - benchmark: - if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!bench') }} - runs-on: ubuntu-latest - permissions: - contents: read - outputs: - PR-BENCH: ${{ steps.benchmark-pr.outputs.BENCH_RESULT }} - MAIN-BENCH: ${{ steps.benchmark-main.outputs.BENCH_RESULT }} - steps: - # https://github.com/actions/checkout/issues/331#issuecomment-1438220926 - - uses: actions/checkout@v4 - with: - persist-credentials: false - ref: refs/pull/${{ github.event.issue.number }}/head - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run build - - - name: Get bench command - id: bench-command - env: - # protects from untrusted user input and command injection - COMMENT: ${{ github.event.comment.body }} - run: | - benchcmd=$(echo "$COMMENT" | grep '!bench' | awk -F ' ' '{print $2}') - echo "bench=$benchcmd" >> $GITHUB_OUTPUT - shell: bash - - - name: Run benchmark - id: benchmark-pr - run: | - result=$(pnpm run --silent benchmark ${{ steps.bench-command.outputs.bench }}) - processed=$(node ./benchmark/ci-helper.js "$result") - echo "BENCH_RESULT<> $GITHUB_OUTPUT - echo "### PR Benchmark" >> $GITHUB_OUTPUT - echo "$processed" >> $GITHUB_OUTPUT - echo "BENCHEOF" >> $GITHUB_OUTPUT - shell: bash - - # main benchmark - - uses: actions/checkout@v4 - with: - persist-credentials: false - ref: "main" - - - name: Install - run: | - pnpm install - - - name: Build Packages - run: pnpm run build - - - name: Run benchmark - id: benchmark-main - run: | - result=$(pnpm run --silent benchmark ${{ steps.bench-command.outputs.bench }}) - processed=$(node ./benchmark/ci-helper.js "$result") - echo "BENCH_RESULT<> $GITHUB_OUTPUT - echo "### Main Benchmark" >> $GITHUB_OUTPUT - echo "$processed" >> $GITHUB_OUTPUT - echo "BENCHEOF" >> $GITHUB_OUTPUT - shell: bash - - output-benchmark: - if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && startsWith(github.event.comment.body, '!bench') }} - needs: [benchmark] - runs-on: ubuntu-latest - permissions: - pull-requests: write - steps: - - name: Comment PR - uses: peter-evans/create-or-update-comment@v4 - continue-on-error: true - with: - issue-number: ${{ github.event.issue.number }} - body: | - ${{ needs.benchmark.outputs.PR-BENCH }} - - ${{ needs.benchmark.outputs.MAIN-BENCH }} - edit-mode: replace diff --git a/.github/workflows/check-merge.yml b/.github/workflows/check-merge.yml deleted file mode 100644 index 8a2b3243b780..000000000000 --- a/.github/workflows/check-merge.yml +++ /dev/null @@ -1,96 +0,0 @@ -name: Check mergeability - -on: pull_request_target - -permissions: - pull-requests: write - checks: write - statuses: write - -jobs: - check: - runs-on: ubuntu-latest - steps: - - name: Check if there is already a block on this PR - id: blocked - uses: actions/github-script@v7 - env: - issue_number: ${{ github.event.number }} - with: - script: | - const { data: reviews } = await github.rest.pulls.listReviews({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: process.env.issue_number, - }); - - for (const review of reviews) { - if (review.user.login === 'github-actions[bot]' && review.state === 'CHANGES_REQUESTED') { - return 'true' - } - } - return 'false' - result-encoding: string - - - uses: actions/checkout@v4 - if: steps.blocked.outputs.result != 'true' - with: - repository: ${{ github.event.pull_request.head.repo.full_name }} - ref: ${{ github.event.pull_request.head.sha }} - fetch-depth: 0 - - - name: Get changed files in the .changeset folder - id: changed-files - uses: tj-actions/changed-files@v44 - if: steps.blocked.outputs.result != 'true' - with: - files: | - .changeset/**/*.md - - - name: Check if any changesets contain minor or major changes - id: check - if: steps.blocked.outputs.result != 'true' - env: - ALL_CHANGED_FILES: ${{ steps.changed-files.outputs.all_changed_files }} - run: | - echo "Checking for changesets marked as minor or major" - echo "found=false" >> $GITHUB_OUTPUT - - regex="[\"']astro[\"']: (minor|major)" - for file in ${ALL_CHANGED_FILES}; do - if [[ $(cat $file) =~ $regex ]]; then - version="${BASH_REMATCH[1]}" - echo "version=$version" >> $GITHUB_OUTPUT - echo "found=true" >> $GITHUB_OUTPUT - echo "$file has a $version release tag" - fi - done - - - name: Add label - uses: actions/github-script@v7 - if: steps.check.outputs.found == 'true' - env: - issue_number: ${{ github.event.number }} - with: - script: | - github.rest.issues.addLabels({ - issue_number: process.env.issue_number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ['semver: ${{ steps.check.outputs.version }}'] - }); - - - name: Change PR Status - uses: actions/github-script@v7 - if: steps.check.outputs.found == 'true' - env: - issue_number: ${{ github.event.number }} - with: - script: | - github.rest.pulls.createReview({ - owner: context.repo.owner, - repo: context.repo.repo, - pull_number: process.env.issue_number, - event: 'REQUEST_CHANGES', - body: 'This PR is blocked because it contains a `${{ steps.check.outputs.version }}` changeset. A reviewer will merge this at the next release if approved.' - }); diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml deleted file mode 100644 index c1b4919901ab..000000000000 --- a/.github/workflows/check.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Examples astro check - -on: - workflow_dispatch: - push: - branches: - - main - merge_group: - pull_request: - paths: - - "examples/**" - - ".github/workflows/check.yml" - - "scripts/smoke/check.js" - - "packages/astro/src/@types/astro.ts" - - "pnpm-lock.yaml" - - "packages/astro/types.d.ts" - -env: - ASTRO_TELEMETRY_DISABLED: true - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - FORCE_COLOR: true - -jobs: - check: - name: astro check - runs-on: ubuntu-latest - timeout-minutes: 7 - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build - run: pnpm run build - - - name: Status - run: git status - - - name: astro check - run: pnpm run test:check-examples diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79962c07e1ce..5077fa68d8db 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -4,13 +4,7 @@ on: workflow_dispatch: push: branches: - - main - merge_group: - pull_request: - paths-ignore: - - ".vscode/**" - - "**/*.md" - - ".github/ISSUE_TEMPLATE/**" + - 'preview/**' # Automatically cancel older in-progress jobs on the same branch concurrency: @@ -32,139 +26,20 @@ env: jobs: # Build primes out Turbo build cache and pnpm cache build: - name: "Build: ${{ matrix.os }}" - runs-on: ${{ matrix.os }} - timeout-minutes: 3 - strategy: - matrix: - OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [18] - fail-fast: true - steps: - # Disable crlf so all OS can share the same Turbo cache - # https://github.com/actions/checkout/issues/135 - - name: Disable git crlf - run: git config --global core.autocrlf false - - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup node@${{ matrix.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.NODE_VERSION }} - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - # Only build in ubuntu as windows can share the build cache. - # Also only build in core repo as forks don't have access to the Turbo cache. - - name: Build Packages - if: ${{ matrix.os == 'ubuntu-latest' && github.repository_owner == 'withastro' }} - run: pnpm run build - - lint: - name: Lint + name: Build runs-on: ubuntu-latest - timeout-minutes: 5 - needs: build - steps: - - name: Disable git crlf - run: git config --global core.autocrlf false - - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run build - - - name: Lint - run: pnpm run lint - - test: - name: "Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})" - runs-on: ${{ matrix.os }} - timeout-minutes: 25 - needs: build - strategy: - matrix: - OS: [ubuntu-latest] - NODE_VERSION: [18, 20] - include: - - os: macos-14 - NODE_VERSION: 18 - - os: windows-latest - NODE_VERSION: 18 - fail-fast: false - env: - NODE_VERSION: ${{ matrix.NODE_VERSION }} - steps: - - name: Disable git crlf - run: git config --global core.autocrlf false - - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup node@${{ matrix.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.NODE_VERSION }} - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run build - - - name: Test - run: pnpm run test - - e2e: - name: "Test (E2E): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})" - runs-on: ${{ matrix.os }} - timeout-minutes: 25 - needs: build - strategy: - matrix: - OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [18] - fail-fast: false - env: - NODE_VERSION: ${{ matrix.NODE_VERSION }} + timeout-minutes: 3 steps: - - name: Disable git crlf - run: git config --global core.autocrlf false - - name: Checkout uses: actions/checkout@v4 - name: Setup PNPM uses: pnpm/action-setup@v3 - - name: Setup node@${{ matrix.NODE_VERSION }} + - name: Setup node uses: actions/setup-node@v4 with: - node-version: ${{ matrix.NODE_VERSION }} + node-version: 20 cache: "pnpm" - name: Install dependencies @@ -173,75 +48,5 @@ jobs: - name: Build Packages run: pnpm run build - - name: Test - run: pnpm run test:e2e - - smoke: - name: "Test (Smoke): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})" - runs-on: ${{ matrix.os }} - timeout-minutes: 25 - needs: build - strategy: - matrix: - OS: [ubuntu-latest, windows-latest] - NODE_VERSION: [18] - env: - NODE_VERSION: ${{ matrix.NODE_VERSION }} - steps: - - name: Disable git crlf - run: git config --global core.autocrlf false - - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup node@${{ matrix.NODE_VERSION }} - uses: actions/setup-node@v4 - with: - node-version: ${{ matrix.NODE_VERSION }} - cache: "pnpm" - - - name: Checkout docs - uses: actions/checkout@v4 - with: - repository: withastro/docs - path: smoke/docs - - - name: Install dependencies - run: pnpm install --no-frozen-lockfile - - # Reset lockfile changes so that Turbo can reuse the old build cache - - name: Reset lockfile changes - run: git reset --hard - - - name: Build Packages - run: pnpm run build - - - name: Remove docs translations except for English and Korean - run: find smoke/docs/src/content/docs ! -name 'en' ! -name 'ko' -type d -mindepth 1 -maxdepth 1 -exec rm -rf {} + - - - name: Check if docs changed - id: changes - uses: dorny/paths-filter@v3 - with: - filters: | - docs: - - 'packages/integrations/*/README.md' - - 'packages/astro/src/@types/astro.ts' - - 'packages/astro/src/core/errors/errors-data.ts' - - - name: Build autogenerated docs pages from current astro branch - if: ${{ steps.changes.outputs.docs == 'true' }} - run: cd smoke/docs && pnpm docgen && pnpm docgen:errors - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SOURCE_REPO: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }} - SOURCE_BRANCH: ${{ github.head_ref || github.ref_name }} - - - name: Test - run: pnpm run test:smoke - env: - SKIP_OG: true - PUBLIC_TWO_LANG: true + - name: Publish previews + run: pnpm dlx pkg-pr-new publish packages/db diff --git a/.github/workflows/cleanup-cache.yml b/.github/workflows/cleanup-cache.yml deleted file mode 100644 index 9d8205cc5390..000000000000 --- a/.github/workflows/cleanup-cache.yml +++ /dev/null @@ -1,44 +0,0 @@ -name: Cleanup cache - -on: - schedule: - - cron: "0 11 * * *" - pull_request: - types: - - closed - -jobs: - cleanup: - runs-on: ubuntu-latest - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Cleanup caches older than 5 days - if: github.event_name == 'schedule' - uses: MyAlbum/purge-cache@v2 - with: - max-age: 432000 - - # https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries - - name: Cleanup on PR close - if: github.event_name == 'pull_request' - run: | - gh extension install actions/gh-actions-cache - - REPO=${{ github.repository }} - BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge" - - echo "Fetching list of cache key" - cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | cut -f 1 ) - - ## Setting this to not fail the workflow while deleting cache keys. - set +e - echo "Deleting caches..." - for cacheKey in $cacheKeysForPR - do - gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm - done - echo "Done" - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml deleted file mode 100644 index 9faaa1886608..000000000000 --- a/.github/workflows/format.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Format - -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - prettier: - if: github.repository_owner == 'withastro' - uses: withastro/automation/.github/workflows/format.yml@main - with: - command: "format" - secrets: inherit diff --git a/.github/workflows/issue-labeled.yml b/.github/workflows/issue-labeled.yml deleted file mode 100644 index 8723639c7ff7..000000000000 --- a/.github/workflows/issue-labeled.yml +++ /dev/null @@ -1,30 +0,0 @@ -name: Issue Labeled - -on: - issues: - types: [labeled] - -jobs: - reply-labeled: - if: github.repository == 'withastro/astro' - runs-on: ubuntu-latest - steps: - - name: remove triage - if: contains(github.event.label.description, '(priority)') && contains(github.event.issue.labels.*.name, 'needs triage') - uses: actions-cool/issues-helper@v3 - with: - actions: "remove-labels" - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - labels: "needs triage" - - - name: needs repro - if: github.event.label.name == 'needs repro' - uses: actions-cool/issues-helper@v3 - with: - actions: "create-comment, remove-labels" - token: ${{ secrets.GITHUB_TOKEN }} - issue-number: ${{ github.event.issue.number }} - body: | - Hello @${{ github.event.issue.user.login }}. Please provide a [minimal reproduction](https://stackoverflow.com/help/minimal-reproducible-example) using a GitHub repository or [StackBlitz](https://astro.new). Issues marked with `needs repro` will be closed if they have no activity within 3 days. - labels: "needs triage" diff --git a/.github/workflows/issue-needs-repro.yml b/.github/workflows/issue-needs-repro.yml deleted file mode 100644 index a859d85ad7ed..000000000000 --- a/.github/workflows/issue-needs-repro.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Close Issues (needs repro) - -on: - schedule: - - cron: "0 0 * * *" - -jobs: - close-issues: - if: github.repository == 'withastro/astro' - runs-on: ubuntu-latest - steps: - - name: needs repro - uses: actions-cool/issues-helper@v3 - with: - actions: "close-issues" - token: ${{ secrets.GITHUB_TOKEN }} - labels: "needs repro" - inactive-day: 3 diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml deleted file mode 100644 index 7171a1b9b7bc..000000000000 --- a/.github/workflows/issue-opened.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Label issues -on: - issues: - types: - - reopened - - opened - -jobs: - label_issues: - runs-on: ubuntu-latest - if: github.repository == 'withastro/astro' - permissions: - issues: write - steps: - - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ["needs triage"] - }) diff --git a/.github/workflows/label.yml b/.github/workflows/label.yml deleted file mode 100644 index 616463c273bc..000000000000 --- a/.github/workflows/label.yml +++ /dev/null @@ -1,16 +0,0 @@ -# Automatically labels PRs based on the configuration file -# you are probably looking for 👉 `.github/labeler.yml` -name: Label PRs - -on: - - pull_request_target - -jobs: - triage: - runs-on: ubuntu-latest - if: github.repository_owner == 'withastro' - steps: - - uses: actions/labeler@v4 - with: - repo-token: "${{ secrets.GITHUB_TOKEN }}" - sync-labels: true diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index cb2cdd59d2a7..000000000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,77 +0,0 @@ -name: Main Checks - -on: - workflow_dispatch: - push: - branches: - - main - -env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - -# Automatically cancel in-progress actions on the same branch -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.head_ref || github.ref }} - cancel-in-progress: true - -jobs: - congrats: - name: congratsbot - if: ${{ github.repository_owner == 'withastro' && github.event.head_commit.message != '[ci] format' }} - uses: withastro/automation/.github/workflows/congratsbot.yml@main - with: - EMOJIS: '🎉,🎊,🧑‍🚀,🥳,🙌,🚀,👏,<:houston_golden:1068575433647456447>,<:astrocoin:894990669515489301>,<:astro_pride:1130501345326157854>' - secrets: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK_CONGRATS }} - - check_for_update: - name: Check for Updates - runs-on: ubuntu-latest - outputs: - run_job: ${{ steps.check_files.outputs.run_job }} - steps: - - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Check Modified - run: pnpm exec changeset status --output ./status.json - - - name: Check Output - id: check_files - run: | - output=`echo $(cat status.json)` - if [[ $output = '{ "changesets": [], "releases": [] }' ]] - then - echo 'No changeset found' - echo "run_job=true" >> $GITHUB_OUTPUT - else - echo 'changes found, push to latest skipped' - echo "run_job=false" >> $GITHUB_OUTPUT - fi - - update: - name: Update the latest branch - needs: check_for_update - if: needs.check_for_update.outputs.run_job == 'true' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Push - uses: ad-m/github-push-action@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - branch: latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml deleted file mode 100644 index eb5cd362e54b..000000000000 --- a/.github/workflows/release.yml +++ /dev/null @@ -1,75 +0,0 @@ -name: Release - -on: - push: - branches: - - main - - "1-legacy" - - "2-legacy" - - "3-legacy" - - next - -defaults: - run: - shell: bash - -env: - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - FORCE_COLOR: true - -jobs: - changelog: - name: Changelog PR or Release - if: ${{ github.repository_owner == 'withastro' }} - runs-on: ubuntu-latest - permissions: - contents: write - id-token: write - steps: - - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run build - - - name: Create Release Pull Request or Publish - id: changesets - uses: changesets/action@v1 - with: - # Note: pnpm install after versioning is necessary to refresh lockfile - version: pnpm run version - publish: pnpm exec changeset publish - commit: "[ci] release" - title: "[ci] release" - env: - # Needs access to push to main - GITHUB_TOKEN: ${{ secrets.FREDKBOT_GITHUB_TOKEN }} - # Needs access to publish to npm - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - - - name: Generate Announcement - id: message - if: steps.changesets.outputs.published == 'true' - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - run: node .github/scripts/announce.mjs '${{ steps.changesets.outputs.publishedPackages }}' - - - name: Send message on Discord - if: steps.changesets.outputs.published == 'true' - env: - DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} - uses: Ilshidur/action-discord@0.3.2 - with: - args: "${{ steps.message.outputs.DISCORD_MESSAGE }}" diff --git a/.github/workflows/scripts.yml b/.github/workflows/scripts.yml deleted file mode 100644 index df934876abd3..000000000000 --- a/.github/workflows/scripts.yml +++ /dev/null @@ -1,52 +0,0 @@ -name: Scripts - -on: - workflow_dispatch: - pull_request: - branches: - - "main" - paths: - - "packages/astro/src/runtime/client/**/*" - - "!packages/astro/src/runtime/client/dev-toolbar/**/*" - -# Automatically cancel in-progress actions on the same branch -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} - cancel-in-progress: true - -defaults: - run: - shell: bash - -jobs: - bundle: - name: Bundle Size - runs-on: ubuntu-latest - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - - - name: Checkout Main into tmp - uses: actions/checkout@v4 - with: - ref: main - path: main - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Check Bundle Size - uses: actions/github-script@v7 - with: - script: | - const { default: script } = await import('${{ github.workspace }}/.github/scripts/bundle-size.mjs') - await script({ github, context }) diff --git a/.github/workflows/snapshot-release.yml b/.github/workflows/snapshot-release.yml deleted file mode 100644 index bee678c962a8..000000000000 --- a/.github/workflows/snapshot-release.yml +++ /dev/null @@ -1,161 +0,0 @@ -name: Create a Snapshot Release - -on: - workflow_dispatch: - issue_comment: - types: [created] - -defaults: - run: - shell: bash - -env: - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - FORCE_COLOR: 1 - -jobs: - snapshot-release: - name: Create a snapshot release of a pull request - if: ${{ github.repository_owner == 'withastro' && github.event.issue.pull_request && (contains(github.event.comment.body, '!preview') || contains(github.event.comment.body, '/preview') || contains(github.event.comment.body, '!snapshot') || contains(github.event.comment.body, '/snapshot')) }} - runs-on: ubuntu-latest - permissions: - contents: read - id-token: write - issues: write - pull-requests: write - steps: - - name: "Check if user has write access" - uses: "lannonbr/repo-permission-check-action@2.0.2" - with: - permission: "write" - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Extract the snapshot name from comment body - id: getSnapshotName - uses: actions/github-script@v7 - with: - script: | - const { body } = context.payload.comment; - const PREVIEW_RE = /^[!\/](?:preview|snapshot)\s+(\S*)\s*$/gim; - const [_, name] = PREVIEW_RE.exec(body) ?? []; - if (name) return name; - - const error = 'Invalid command. Expected: "/preview "' - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: error, - }) - core.setFailed(error) - result-encoding: string - - - name: resolve pr refs - id: refs - uses: eficode/resolve-pr-refs@main - with: - token: ${{ secrets.GITHUB_TOKEN }} - - - uses: actions/checkout@v4 - with: - ref: ${{ steps.refs.outputs.head_ref }} - fetch-depth: 0 - - - run: git fetch origin main:main - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - registry-url: "https://registry.npmjs.org" - cache: "pnpm" - - - name: Install dependencies - run: pnpm install - - - name: Build Packages - run: pnpm run build - - - name: Bump Package Versions - id: changesets - run: | - pnpm exec changeset status --output status.output.json 2>&1 - pnpm exec changeset version --snapshot ${{ steps.getSnapshotName.outputs.result }} - - EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - echo "status<<$EOF" >> $GITHUB_OUTPUT - echo "$(cat status.output.json)" >> $GITHUB_OUTPUT - echo "$EOF" >> $GITHUB_OUTPUT - env: - # Needs access to run the script - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # Disable color - FORCE_COLOR: 0 - NO_COLOR: 1 - - - name: Publish Release - id: publish - run: | - GITHUB_ACTIONS=0 pnpm run build > build.output.txt 2>&1 - pnpm exec changeset publish --tag experimental--${{ steps.getSnapshotName.outputs.result }} > publish.output.txt 2>&1 - - EOF=$(dd if=/dev/urandom bs=15 count=1 status=none | base64) - - echo "build<<$EOF" >> $GITHUB_OUTPUT - echo "$(cat build.output.txt)" >> $GITHUB_OUTPUT - echo "$EOF" >> $GITHUB_OUTPUT - cat build.output.txt - - echo "publish<<$EOF" >> $GITHUB_OUTPUT - echo "$(cat publish.output.txt)" >> $GITHUB_OUTPUT - echo "$EOF" >> $GITHUB_OUTPUT - cat publish.output.txt - env: - # Needs access to publish to npm - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - # Disable color - FORCE_COLOR: 0 - NO_COLOR: 1 - - - name: Pull Request Notification - uses: actions/github-script@v7 - env: - TAG: ${{ steps.getSnapshotName.outputs.result }} - STATUS_DATA: ${{ steps.changesets.outputs.status }} - BUILD_LOG: ${{ steps.publish.outputs.build }} - PUBLISH_LOG: ${{ steps.publish.outputs.publish }} - with: - script: | - let changeset = { releases: [] }; - try { - changeset = JSON.parse(process.env.STATUS_DATA); - } catch (e) {} - let message = 'Snapshots have been released for the following packages:' - for (const release of changeset.releases) { - if (release.type === 'none') continue; - message += `\n- \`${release.name}@experimental--${process.env.TAG}\``; - } - - function details(title, body) { - message += '\n'; - message += `
${title}` - message += '\n\n```\n'; - message += body; - message += '\n```\n\n
'; - } - - details('Publish Log', process.env.PUBLISH_LOG); - details('Build Log', process.env.BUILD_LOG); - - github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: message, - }) diff --git a/.github/workflows/test-hosts.yml b/.github/workflows/test-hosts.yml deleted file mode 100644 index e26e250d232b..000000000000 --- a/.github/workflows/test-hosts.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: Hosted tests - -on: - schedule: - - cron: '0 0 * * 0' - -env: - ASTRO_TELEMETRY_DISABLED: true - TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} - TURBO_TEAM: ${{ secrets.TURBO_TEAM }} - VERCEL_ORG_ID: ${{ secrets.VERCEL_TEST_ORG_ID }} - VERCEL_PROJECT_ID: ${{ secrets.VERCEL_TEST_PROJECT_ID }} - VERCEL_TOKEN: ${{ secrets.VERCEL_TEST_TOKEN }} - FORCE_COLOR: true - -jobs: - test: - name: Run tests - runs-on: ubuntu-latest - steps: - - name: Check out repository - uses: actions/checkout@v4 - - - name: Setup PNPM - uses: pnpm/action-setup@v3 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: 'pnpm' - - - name: Install dependencies - run: pnpm install - - - name: Build Astro - run: pnpm turbo build --filter astro --filter @astrojs/vercel - - - name: Build test project - working-directory: ./packages/integrations/vercel/test/hosted/hosted-astro-project - run: pnpm run build - - - name: Deploy to Vercel - working-directory: ./packages/integrations/vercel/test/hosted/hosted-astro-project - run: pnpm dlx vercel --prod --prebuilt - - - name: Test - run: pnpm run test:e2e:hosts