Skip to content

Version Packages

Version Packages #747

Workflow file for this run

name: C3 Tests
on:
pull_request:
paths:
- packages/create-cloudflare/**
env:
node-version: 18.17.1
bun-version: 1.0.3
jobs:
check:
name: "Checks"
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
uses: ./.github/actions/install-dependencies
- name: Check Types
run: pnpm run --filter create-cloudflare check:type
- name: Lint
run: pnpm run --filter create-cloudflare check:lint
- name: Unit Tests
run: pnpm run --filter create-cloudflare test:unit
cleanup:
name: "Cleanup Test Projects"
if: ${{ github.repository_owner == 'cloudflare' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
uses: ./.github/actions/install-dependencies
- name: Cleanup E2E test projects
run: pnpm run --filter create-cloudflare test:e2e:cleanup
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }}
e2e:
needs: cleanup
name: ${{ format('E2E ({0}) {1}', matrix.pm, matrix.quarantine == true && '[quarantine]' || '') }}
continue-on-error: ${{ matrix.quarantine }}
if: |
github.event.pull_request.user.login != 'dependabot[bot]'
strategy:
matrix:
os: [ubuntu-latest]
pm: [npm, pnpm, bun]
quarantine: [true, false]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
uses: ./.github/actions/install-dependencies
- name: Install Bun ${{ env.bun-version }}
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.bun-version }}
# Needed because gatsby requires git
- name: Configure Git
run: |
git config --global user.email wrangler@cloudflare.com
git config --global user.name 'Wrangler automated PR updater'
- name: E2E Tests
run: pnpm run --filter create-cloudflare test:e2e:${{matrix.pm}}
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }}
E2E_QUARANTINE: ${{ matrix.quarantine }}
get-dependabot-bumped-framework:
name: "Get bumped framework (dependabot-only)"
runs-on: ubuntu-latest
outputs:
bumped-framework-cli: ${{ steps.detect.outputs.result }}
if: |
github.event.pull_request.user.login == 'dependabot[bot]'
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 2
ref: ${{ github.head_ref }}
- name: Get PR description as string
id: get-pr-description
run: |
str=$(sed 's/`/\`/g' <<EOF
${{ github.event.pull_request.body }}
EOF
)
echo 'result<<EOF' >> $GITHUB_OUTPUT
echo $str >> $GITHUB_OUTPUT
echo 'EOF' >> $GITHUB_OUTPUT
- name: detect-bumped-framework
id: detect
uses: actions/github-script@v6
with:
result-encoding: string
script: |
const json = require('./packages/create-cloudflare/src/frameworks/package.json')
const frameworkCliPackages = Object.values(json.frameworkCliMap);
const body = `${{ steps.get-pr-description.outputs.result }}`;
const semverRegexStr = '\\d+\\.\\d+\\.\\d+';
const frameworkCliRegex = new RegExp(
`(?:^|\\s+)Bumps\\s+\\[(${frameworkCliPackages.join(
'|'
)})\\]\\(.*?\\)\\s+from\\s+${semverRegexStr}\\s+to\\s+${semverRegexStr}`
);
const bumpedFrameworkCli = body.match(frameworkCliRegex)?.[1] ?? '';
return bumpedFrameworkCli;
# For dependabot versioning PRs we only want to run the e2es for the specifically bumped
# framework (this is both for optimization and in order to reduce unnecessary flakiness)
e2e-only-dependabot-bumped-framework:
needs: [cleanup, get-dependabot-bumped-framework]
name: ${{ format('Dependabot E2E ({0}) {1}', matrix.pm, matrix.quarantine == true && '[quarantine]' || '') }}
continue-on-error: ${{ matrix.quarantine }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
pm: [npm, pnpm, bun]
quarantine: [true, false]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout Repo
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Dependencies
uses: ./.github/actions/install-dependencies
- name: Install Bun ${{ env.bun-version }}
uses: oven-sh/setup-bun@v1
with:
bun-version: ${{ env.bun-version }}
- name: E2E Tests
run: pnpm run --filter create-cloudflare test:e2e:${{matrix.pm}}
env:
FRAMEWORK_CLI_TO_TEST: ${{ needs.get-dependabot-bumped-framework.outputs.bumped-framework-cli }}
CLOUDFLARE_API_TOKEN: ${{ secrets.C3_TEST_CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.C3_TEST_CLOUDFLARE_ACCOUNT_ID }}
E2E_QUARANTINE: ${{ matrix.quarantine }}