Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Backport CI workflow to release/v4 #2009

Merged
merged 4 commits into from
Nov 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .changeset/blue-lies-drop.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
117 changes: 117 additions & 0 deletions .github/actions/init/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@

name: Setup Action
description: Checkout, setup node and dependencies
inputs:
node-version:
description: 'The node version to use'
required: false
default: '18'
playwright-enabled:
description: 'Enable Playwright?'
required: false
default: 'false'
turbo-enabled:
description: 'Enable Turbo?'
required: false
default: 'true'
turbo-cache-dir:
description: 'The cache dir to use for Turbo'
required: false
default: './.turbo-cache'
turbo-signature:
description: 'The signature to use for Turbo'
required: false
turbo-remote-only:
description: 'Only use remote cache?'
required: false
default: 'true'
turbo-team:
description: 'The team to use for Turbo remote auth'
required: true
turbo-token:
description: 'The token to use for Turbo remote auth'
required: true

runs:
using: "composite"
steps:
- name: Configure Turborepo
id: turbo
uses: actions/github-script@v6
env:
# envs are required to pass inputs to the script
ENABLED: ${{ inputs.turbo-enabled }}
CACHE_DIR: ${{ inputs.turbo-cache-dir }}
REMOTE_ONLY: ${{ inputs.turbo-remote-only }}
SIGNATURE: ${{ inputs.turbo-signature }}
TEAM: ${{ inputs.turbo-team }}
TOKEN: ${{ inputs.turbo-token }}
with:
script: |
const os = require('os')
const cpus =
typeof os.availableParallelism === "function"
? os.availableParallelism()
: os.cpus().length;

const { ENABLED, CACHE_DIR, SIGNATURE, REMOTE_ONLY, TEAM, TOKEN } = process.env

core.exportVariable('TURBO_ARGS',
[
'--output-logs=new-only',
`--cache-dir=${CACHE_DIR}`,
`--concurrency=${cpus}`
].join(' ')
)

if (ENABLED === 'true') {
core.exportVariable('TURBO_TEAM', TEAM)
core.exportVariable('TURBO_TOKEN', TOKEN)
core.exportVariable('TURBO_REMOTE_ONLY', REMOTE_ONLY)
}

if (SIGNATURE && SIGNATURE !== '') {
core.exportVariable('TURBO_REMOTE_CACHE_SIGNATURE_KEY', SIGNATURE)
}

core.exportVariable('FORCE_COLOR', '1')

- name: Turborepo CLI Args
shell: bash
run: echo $TURBO_ARGS

- name: Setup NodeJS ${{ inputs.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node-version }}

- name: Cache node_modules
uses: actions/cache@v3
id: npm-cache
with:
path: ./node_modules
key: ${{ runner.os }}-node-${{ inputs.node-version }}-node-modules-${{ hashFiles('**/package-lock.json') }}

- name: Install NPM Dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm ci --audit=false --fund=false
shell: bash

- name: Get Playwright Version
if: inputs.playwright-enabled == 'true'
shell: bash
id: playwright-version
run: echo "VERSION=$(node -e "console.log($(npm ls @playwright/test --json).dependencies['@playwright/test'].version)")" >> "$GITHUB_OUTPUT"

- name: Cache Playwright Binaries
if: inputs.playwright-enabled == 'true'
uses: actions/cache@v3
id: playwright-cache
with:
path: ~/.cache/ms-playwright
key: ${{ runner.os }}-node-${{ env.NODE_VERSION }}-playwright-${{ steps.playwright-version.outputs.VERSION }}

- name: Install Playwright Browsers
if: inputs.playwright-enabled == 'true' && steps.playwright-cache.outputs.cache-hit != 'true'
shell: bash
run: npx playwright install --with-deps
2 changes: 1 addition & 1 deletion .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ runs:
name: Install dependencies
shell: bash
run: npm ci
- if: ${{ inputs.use-turbo-cache == 'true' }}
- if: ${{ inputs.use-turbo-cache == 'true' }}
name: Download turbo cache
uses: actions/download-artifact@v3
with:
Expand Down
40 changes: 40 additions & 0 deletions .github/actions/verdaccio/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Run Verdaccio
description: Checkout, setup node and dependencies
inputs:
auth-email:
description: 'The email to use for auth'
required: false
default: '[email protected]'
auth-password:
description: 'The pass to use for auth'
required: false
default: 'pass'
auth-user:
description: 'The user to use for auth'
required: false
default: 'user'
publish-cmd:
description: 'The command to use to publish'
required: true
registry:
description: 'The registry to use'
required: false
default: 'http://localhost:4873'

runs:
using: "composite"
steps:
- name: Update NPM Registry to Verdaccio
shell: bash
run: npm set registry ${{ inputs.registry }}

- name: Run Verdaccio
shell: bash
run: |
nohup ./node_modules/.bin/verdaccio --config ./verdaccio.yaml & sleep 5
./node_modules/.bin/npm-cli-adduser -u ${{ inputs.auth-user }} -p ${{ inputs.auth-password }} -e ${{ inputs.auth-email }} -r ${{ inputs.registry }}
./node_modules/.bin/npm-cli-login -u ${{ inputs.auth-user }} -p ${{ inputs.auth-password }} -e ${{ inputs.auth-email }} -r ${{ inputs.registry }}

- name: Publish to Verdaccio
shell: bash
run: ${{ inputs.publish-cmd }}
21 changes: 0 additions & 21 deletions .github/workflows/base-changeset.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/base-prettier.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows/base-registry.yml

This file was deleted.

105 changes: 0 additions & 105 deletions .github/workflows/checks.yml

This file was deleted.

Loading
Loading