Skip to content

Commit

Permalink
feat(ci): refactor workflows (#5977)
Browse files Browse the repository at this point in the history
  • Loading branch information
BatuhanW authored May 29, 2024
1 parent e5cad51 commit c7574df
Show file tree
Hide file tree
Showing 20 changed files with 273 additions and 256 deletions.
46 changes: 21 additions & 25 deletions .github/workflows/build-examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ jobs:
concurrency:
group: ${{ github.ref }}-build-examples
cancel-in-progress: true
strategy:
matrix:
node-version: [18.x]

name: Create Example Chunks

if: "${{ !github.event.pull_request.draft }}"
Expand All @@ -58,15 +54,15 @@ jobs:
args: [--ignore-scripts]
- name: Fetch commits
run: git fetch origin ${{ github.base_ref || 'master' }} --depth=1
- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18
cache: "pnpm"

- name: Split Into Chunks
id: chunkstep
run: CHUNKS=6 BASE_REF=${{ github.base_ref }} BUILD_ALL_EXAMPLES=${{ (contains(steps.pr-labels.outputs.labels, ' build-examples ') || github.event_name == 'schedule' ) && 'true' || 'false' }} node ./.github/workflows/build-example-chunks.js
run: CHUNKS=6 BASE_REF=${{ github.base_ref }} BUILD_ALL_EXAMPLES=${{ (contains(steps.pr-labels.outputs.labels, ' build-examples ') || github.event_name == 'schedule' ) && 'true' || 'false' }} node ./.github/workflows/scripts/build-example-chunks.js

build-chunk-1:
runs-on: ubuntu-latest
Expand All @@ -91,10 +87,10 @@ jobs:
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18
cache: "pnpm"

- name: Install Dependencies
Expand All @@ -110,7 +106,7 @@ jobs:
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Run E2E Tests
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_1 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-1-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_1 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-1-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js

build-chunk-2:
runs-on: ubuntu-latest
Expand All @@ -135,10 +131,10 @@ jobs:
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18
cache: "pnpm"

- name: Install Dependencies
Expand All @@ -154,7 +150,7 @@ jobs:
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Run E2E Tests
run: REFINE_NO_TELEMETRY=true BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_2 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-2-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js
run: REFINE_NO_TELEMETRY=true BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_2 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-2-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js

build-chunk-3:
runs-on: ubuntu-latest
Expand All @@ -179,10 +175,10 @@ jobs:
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18
cache: "pnpm"

- name: Install Dependencies
Expand All @@ -198,7 +194,7 @@ jobs:
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Run E2E Tests
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_3 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-3-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_3 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-3-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js

build-chunk-4:
runs-on: ubuntu-latest
Expand All @@ -223,10 +219,10 @@ jobs:
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18
cache: "pnpm"

- name: Install Dependencies
Expand All @@ -242,7 +238,7 @@ jobs:
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Run E2E Tests
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_4 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-4-${{ github.run_attempt }}-4 node ./.github/workflows/e2e-examples.js
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_4 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-4-${{ github.run_attempt }}-4 node ./.github/workflows/scripts/e2e-examples.js

build-chunk-5:
runs-on: ubuntu-latest
Expand All @@ -267,10 +263,10 @@ jobs:
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18
cache: "pnpm"

- name: Install Dependencies
Expand All @@ -286,7 +282,7 @@ jobs:
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Run E2E Tests
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_5 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-5-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_5 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-5-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js

build-chunk-6:
runs-on: ubuntu-latest
Expand All @@ -311,10 +307,10 @@ jobs:
with:
version: 9

- name: Use Node.js ${{ matrix.node-version }}
- name: Use Node.js 18
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
node-version: 18
cache: "pnpm"

- name: Install Dependencies
Expand All @@ -330,4 +326,4 @@ jobs:
run: echo "::set-output name=sha7::$(echo ${GITHUB_SHA} | cut -c1-7)"

- name: Run E2E Tests
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_6 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-6-${{ github.run_attempt }} node ./.github/workflows/e2e-examples.js
run: BASE_REF=${{ github.base_ref }} EXAMPLES=${{ needs.chunks.outputs.CHUNK_6 }} CYPRESS_PROJECT_ID=${{ secrets.CYPRESS_PROJECT_ID }} CYPRESS_RECORD_KEY=${{ secrets.CYPRESS_RECORD_KEY }} CI_BUILD_ID=refine-${{ github.ref_name }}-${{ steps.slug.outputs.sha7 }}-chunk-6-${{ github.run_attempt }} node ./.github/workflows/scripts/e2e-examples.js
28 changes: 0 additions & 28 deletions .github/workflows/doc-checks.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,36 +1,40 @@
name: PR Documentation [synchronize]
name: Documentation

on:
pull_request:
types:
- synchronize
- opened
- reopened
paths:
- "documentation/**"

jobs:
documentation:
if: github.repository_owner == 'refinedev'
typos:
name: Check spelling using typos
runs-on: ubuntu-latest
concurrency:
group: ${{ github.ref }}-pr-doc
group: docs-typos-${{ github.ref }}
cancel-in-progress: true
steps:
- name: Check out code.
uses: actions/checkout@v4
- name: typos
id: check_for_typos
uses: crate-ci/typos@master
with:
config: ./typos.toml
deploy_documentation:
name: Documentation Deploy
runs-on: ubuntu-latest
concurrency:
group: docs-deploy-${{ github.ref }}
cancel-in-progress: true
strategy:
matrix:
node-version: [18.x]

name: Deploy Documentation Preview

steps:
- uses: actions/checkout@v4
- uses: pnpm/action-setup@v3
with:
version: 9
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
cache: "pnpm"
node-version: 18
cache: pnpm
- name: Add key to allow access to repository
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
Expand All @@ -44,30 +48,41 @@ jobs:
HostName github.com
IdentityFile ~/.ssh/id_rsa
EOT
- name: Install Package Dependencies
- name: Install & build dependencies
run: pnpm install
- name: Install dependencies (Docs)
run: |
cd documentation
pnpm install
- name: Install Doc Dependencies
- name: Release to GitHub Pages
if: github.ref == 'refs/heads/master'
env:
USE_SSH: true
GIT_USER: pankod-bot
NODE_ENV: production
NODE_OPTIONS: "--max_old_space_size=4096"
run: |
cd documentation
pnpm install
git config --global user.email "[email protected]"
git config --global user.name "pankod-bot"
LIVE_PREVIEW_URL=https://next.live-previews.refine.dev/preview pnpm run deploy
- name: Wait for Netlify Deploy (Live Previews)
uses: probablyup/[email protected]
id: waitForDeployment
if: github.ref != 'refs/heads/master'
continue-on-error: true
with:
site_id: ${{ secrets.NETLIFY_PREVIEW_SITE_ID }}
max_timeout: 1200
env:
NETLIFY_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
- name: output test
run: |
echo ${{ steps.waitForDeployment.outputs.url }}
- name: Build Documentation
if: github.ref != 'refs/heads/master'
run: |
cd documentation
LIVE_PREVIEW_URL=${{ steps.waitForDeployment.outputs.url }}/preview pnpm build
- name: Deploy to Netlify
if: github.ref != 'refs/heads/master'
id: netlify-deploy
uses: nwtgck/[email protected]
with:
Expand All @@ -82,5 +97,5 @@ jobs:
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 15
- name: Check Existing Links in Documentation
if: steps.netlify-deploy.outputs.deploy-url
run: DEPLOY_URL=${{ steps.netlify-deploy.outputs.deploy-url }} SITEMAP_URL=https://refine.dev/sitemap.xml node ./.github/workflows/check-existing-doc-links.js
if: ${{ github.ref != 'refs/heads/master' && steps.netlify-deploy.outputs.deploy-url }}
run: DEPLOY_URL=${{ steps.netlify-deploy.outputs.deploy-url }} SITEMAP_URL=https://refine.dev/sitemap.xml node ./.github/workflows/scripts/check-existing-doc-links.js
Loading

0 comments on commit c7574df

Please sign in to comment.