Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
bluebeel committed Aug 2, 2023
2 parents 1dae8e0 + 648570e commit 54cce0c
Show file tree
Hide file tree
Showing 148 changed files with 52,645 additions and 9,297 deletions.
5 changes: 0 additions & 5 deletions .changeset/breezy-owls-rescue.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/chilly-comics-doubt.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/early-crabs-talk.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/seven-socks-roll.md

This file was deleted.

12 changes: 0 additions & 12 deletions .changeset/tame-goats-perform.md

This file was deleted.

21 changes: 21 additions & 0 deletions .github/actions/cache-turbo/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: Cache turbo
description: Attempts to cache turborepo files for the current workflow and job
inputs:
script:
description: target script for the turborepo cache
required: true
runs:
using: composite
steps:
- name: Cache turbo
id: turbo-cache
uses: actions/cache@v3
with:
path: ./turbo-cache
key: cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ inputs.script }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }}
restore-keys: |
cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ inputs.script }}-${{ github.base_ref }}-${{ github.ref_name }}-${{ github.sha }}
cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ inputs.script }}-${{ github.base_ref }}-${{ github.ref_name }}
cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ inputs.script }}-${{ github.base_ref }}
cache-turbo-${{ github.workflow }}-${{ github.job }}-${{ inputs.script }}
cache-turbo-${{ github.workflow }}-${{ github.job }}
34 changes: 34 additions & 0 deletions .github/actions/node-setup/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Node Setup
description: Sets up Node with the required node_modules
runs:
using: composite
steps:
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Get current node version
id: node-version
shell: bash
run: |
node_version=$(node -v)
echo "node_version=$node_version" >> $GITHUB_OUTPUT
# Attempt to cache all the node_modules directories based on the node version and package lock.
- name: Cache node_modules
id: npm-cache
uses: actions/cache@v3
env:
cache-name: cache-node-modules-${{ steps.node-version.outputs.node_version }}
with:
key: ${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
path: |
**/node_modules
!/pages-e2e/workspaces/**/node_modules
# If the cache missed then install using `npm ci` to follow package lock exactly
- if: ${{ steps.npm-cache.outputs.cache-hit != 'true'}}
name: Install NPM Dependencies
shell: bash
run: npm ci
9 changes: 2 additions & 7 deletions .github/workflows/beta-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Dependencies
run: npm ci
- name: Setup Node
uses: ./.github/actions/node-setup

- name: Modify package.json version
run: node .github/version-script.js BETA
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/configs-docs-scraping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,29 @@ on:

jobs:
scrape_docs:
if: ${{ github.repository_owner == 'cloudflare' }}
name: Scrape docs and create/update issue if needed
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Checkout Repo
uses: actions/checkout@v3
- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Install NPM Dependencies
run: npm ci

- name: Setup Node
uses: ./.github/actions/node-setup

- name: Run Checker
id: run-checker
working-directory: internal-packages/docs-scraper
run: GH_ACTION=true npm run check-docs

- name: Generate table
id: generate-table
if: steps.run-checker.outputs.result == 'out-of-date'
working-directory: internal-packages/docs-scraper
run: GH_ACTION=true npm run generate-configs-table

- name: Create or update issue
if: steps.run-checker.outputs.result == 'out-of-date'
working-directory: internal-packages/docs-scraper
Expand Down
10 changes: 2 additions & 8 deletions .github/workflows/create-pullrequest-prerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,8 @@ jobs:
with:
fetch-depth: 0

- name: Use Node.js 16.13
uses: actions/setup-node@v3
with:
node-version: 16.13
cache: 'npm' # cache ~/.npm in case 'npm ci' needs to run

- name: Install NPM Dependencies
run: npm ci
- name: Setup Node
uses: ./.github/actions/node-setup

- name: Modify package.json version
run: node .github/version-script.js PR=${{ github.event.number }}
Expand Down
105 changes: 26 additions & 79 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,102 +12,49 @@ concurrency:
cancel-in-progress: true

jobs:
formatting:
name: Formatting
simple-checks:
strategy:
matrix:
check:
[
{ name: formatting, script: 'prettier:check' },
{ name: linting, script: lint },
{ name: type checking, script: types-check },
{ name: building, script: build },
{ name: unit testing, script: 'test:unit' },
]
name: ${{ matrix.check.name }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16.13.x

- name: Install
run: npm ci
- name: Setup Node
uses: ./.github/actions/node-setup

- name: Check formatting
run: npm run prettier:check
linting:
name: Linting
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
- name: Cache Turbo
uses: ./.github/actions/cache-turbo
with:
node-version: 16.13.x

- name: Install
run: npm ci
script: ${{ matrix.check.script }}

- name: Check linting
run: npm run lint
types:
name: Types
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16.13.x

- name: Install
run: npm ci

- name: Check types
run: npm run types-check
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16.13.x

- name: Install
run: npm ci

- name: Build
run: npm run build
unit-tests:
name: Unit tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 16.13.x

- name: Install
run: npm ci

- name: Run unit tests
run: npm run test:unit
- name: Run Script
run: npm run ${{ matrix.check.script }} -- --cache-dir ./turbo-cache
e2e-tests:
name: e2e tests
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup node
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: Install
run: npm ci
- name: Setup Node
uses: ./.github/actions/node-setup

- name: Run e2e tests
run: npm run test:e2e
uses: nick-fields/retry@v2
with:
max_attempts: 3
timeout_minutes: 20
command: npm run test:e2e -- -- --log-timestamp
env:
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ vars.CLOUDFLARE_ACCOUNT_ID }}
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ jobs:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Setup Node.js 16.x
uses: actions/setup-node@v3
with:
node-version: 16.x

- name: Install Dependencies
run: npm ci
- name: Setup Node
uses: ./.github/actions/node-setup

- name: Create Release Pull Request or Publish to npm
id: changesets
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ dist

# Turobrepo
.turbo/
turbo-cache

# pages-e2e
/pages-e2e/workspaces
Expand Down
Loading

0 comments on commit 54cce0c

Please sign in to comment.