From 20fd76723433fa38323767967e7559d40130fbba Mon Sep 17 00:00:00 2001 From: Nate Moore Date: Wed, 10 Aug 2022 16:34:01 -0500 Subject: [PATCH] Revert "debug ci" This reverts commit c0caf7e353e96de32e8de7453bba41072c0ddb36. --- .github/workflows/ci.yml | 248 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 244 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73292f8ac..286e99dc7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,6 +9,10 @@ on: - '.vscode/**' - '**/*.md' +# 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: @@ -20,10 +24,246 @@ env: FORCE_COLOR: true ASTRO_TELEMETRY_DISABLED: true + jobs: - debug: - name: Debug + lint: + name: Lint runs-on: ubuntu-latest steps: - - name: Debug - run: env + - name: Check out repository + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Status + run: git status + + # Lint autofix cannot run on forks, so just skip those! See https://github.com/wearerequired/lint-action/issues/13 + - name: Lint (External) + if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }} + run: pnpm run lint + + # Otherwise, run lint autofixer + - name: Lint + if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.repository_owner }} + uses: wearerequired/lint-action@v1.11.1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + eslint: true + prettier: false + auto_fix: true + git_name: github-actions[bot] + git_email: github-actions[bot]@users.noreply.github.com + commit_message: 'chore(lint): ${linter} fix' + github_token: ${{ secrets.GITHUB_TOKEN }} + neutral_check_on_warning: true + + # Checks that the formatter runs successfully on all files + # In the future, we may have this fail PRs on unformatted code + - name: Format Check + run: pnpm run format --list + + # Build primes out build caches for Turbo + build: + name: 'Build: ${{ matrix.os }}' + runs-on: ${{ matrix.os }} + strategy: + matrix: + OS: [ubuntu-latest] + NODE_VERSION: [14] + fail-fast: true + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup node@${{ matrix.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.NODE_VERSION }} + cache: 'pnpm' + + - name: Install dependencies + run: pnpm install + + - name: Build Packages + run: pnpm run build + + test: + name: 'Test: ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})' + runs-on: ${{ matrix.os }} + needs: build + strategy: + matrix: + OS: [ubuntu-latest, windows-latest] + # TODO: Enable node@18! + NODE_VERSION: [14, 16] + include: + - os: macos-latest + NODE_VERSION: 14 + fail-fast: false + env: + NODE_VERSION: ${{ matrix.NODE_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup node@${{ matrix.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.NODE_VERSION }} + cache: 'pnpm' + + - name: Use Deno + uses: denoland/setup-deno@v1 + with: + deno-version: v1.19.3 + + - 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: 20 + needs: build + strategy: + matrix: + OS: [ubuntu-latest, windows-latest] + NODE_VERSION: [14] + fail-fast: false + env: + NODE_VERSION: ${{ matrix.NODE_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup node@${{ matrix.NODE_VERSION }} + uses: actions/setup-node@v3 + 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 + + smoke: + name: 'Test (Smoke): ${{ matrix.os }} (node@${{ matrix.NODE_VERSION }})' + runs-on: ${{ matrix.os }} + needs: build + strategy: + matrix: + OS: [ubuntu-latest, windows-latest] + NODE_VERSION: [14] + env: + NODE_VERSION: ${{ matrix.NODE_VERSION }} + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup node@${{ matrix.NODE_VERSION }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.NODE_VERSION }} + cache: 'pnpm' + + - name: Checkout docs + uses: actions/checkout@v3 + with: + repository: withastro/docs + path: smoke/docs + + - name: Install dependencies + run: pnpm install --no-frozen-lockfile + + - name: Build Packages + run: pnpm run build + + - name: Test + run: pnpm run test:smoke + + changelog: + name: Changelog PR or Release + if: ${{ (github.ref_name == 'main' || github.head_ref == 'next') && github.repository_owner == 'withastro' }} + runs-on: ubuntu-latest + needs: build + steps: + - uses: actions/checkout@v3 + + - name: Setup PNPM + uses: pnpm/action-setup@v2.2.1 + + - name: Setup Node + uses: actions/setup-node@v3 + with: + node-version: 16 + 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 Notification + id: notification + if: steps.changesets.outputs.published == 'true' + run: message=$(node scripts/notify/index.js '${{ steps.changesets.outputs.publishedPackages }}') && echo ::set-output name=message::${message//$'\n'/'%0A'} + + - name: Discord Notification + if: steps.changesets.outputs.published == 'true' + id: discord-notification + env: + DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }} + uses: Ilshidur/action-discord@0.3.2 + with: + args: ${{ steps.notification.outputs.message }}