Skip to content

Align project-backed config failures with app config validate JSON #3071

Align project-backed config failures with app config validate JSON

Align project-backed config failures with app config validate JSON #3071

Workflow file for this run

name: PR
on:
pull_request:
merge_group:
concurrency:
group: shopify-cli-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
env:
DEBUG: '1'
SHOPIFY_CLI_ENV: development
SHOPIFY_CONFIG: debug
PNPM_VERSION: '10.11.1'
BUNDLE_WITHOUT: 'test:development'
GH_TOKEN: ${{ secrets.SHOPIFY_GH_READ_CONTENT_TOKEN }}
GH_TOKEN_SHOP: ${{ secrets.SHOP_GH_READ_CONTENT_TOKEN }}
DEFAULT_NODE_VERSION: '24.1.0'
jobs:
type-check:
name: 'Type check'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Type check
run: pnpm nx run-many --all --skip-nx-cache --target=type-check --output-style=stream
lint:
name: 'Lint'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Lint
run: pnpm nx run-many --all --skip-nx-cache --target=lint --output-style=stream
bundle:
name: 'Bundle'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: 'Build'
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
- name: 'Bundle'
run: pnpm nx run-many --all --skip-nx-cache --target=bundle --output-style=stream
knip:
name: 'Knip (unused code check)'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Run knip
run: pnpm knip
graphql-schema:
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
name: 'Check graphql-codegen has been run'
runs-on: macos-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Get schemas for codegen
run: pnpm graphql-codegen:get-graphql-schemas
- name: Run graphql-codegen
run: pnpm graphql-codegen
- name: Run git diff
run: git diff
- name: Fail if any changes were made
run: 'test -z "$(git status --porcelain)" || { echo -e "Run pnpm graphql-codegen when queries are changed, committing any fixes and generated files" ; exit 1; }'
oclif-checks:
name: 'Check OCLIF manifests & readme & docs'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Build
run: pnpm build --output-style=stream
- name: Refresh manifests
run: pnpm refresh-manifests
- name: Check if there are changes
run: 'test -z "$(git status --porcelain "**/oclif.manifest.json" )" || { echo -e "Run pnpm refresh-manifests before pushing new commands or flags. Diff here:\n\n$(git diff)" ; exit 1; }'
- name: Refresh readme
run: pnpm refresh-readme
- name: Check if there are changes
run: 'test -z "$(git status --porcelain "packages/cli/README.md" )" || { echo -e "Run pnpm refresh-readme before pushing new commands or flags. Diff here:\n\n$(git diff)" ; exit 1; }'
- name: Refresh code documentation
run: pnpm refresh-code-documentation
- name: Check if there are changes
run: 'test -z "$(git status --porcelain)" || { echo -e "Run pnpm refresh-code-documentation when you update functions with autogenerated examples. Diff here:\n\n$(git diff)" ; exit 1; }'
- name: Build shopify.dev docs
run: pnpm build-dev-docs
- name: Check if there are changes
run: 'test -z "$(git status --porcelain "docs-shopify.dev/generated/*.json" )" || { echo -e "Run (pnpm build-dev-docs) before pushing new commands or flags." ; exit 1; }'
unit-tests:
name: "Unit tests with Node ${{ matrix.node }} in ${{ matrix.os }}${{ matrix.shard != '' && format(' (shard {0})', matrix.shard) || '' }}"
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ 'ubuntu-latest', 'windows-latest', 'macos-latest' ]
node: [ '20.14.0', '22.2.0', '24.1.0' ]
shard: [ '' ]
include:
# Add sharding for Windows jobs to reduce wall-clock time
- os: windows-latest
node: '20.14.0'
shard: '1/2'
- os: windows-latest
node: '20.14.0'
shard: '2/2'
- os: windows-latest
node: '22.2.0'
shard: '1/2'
- os: windows-latest
node: '22.2.0'
shard: '2/2'
- os: windows-latest
node: '24.1.0'
shard: '1/2'
- os: windows-latest
node: '24.1.0'
shard: '2/2'
exclude:
# Exclude the non-sharded Windows entries (replaced by sharded ones above)
- os: windows-latest
node: '20.14.0'
shard: ''
- os: windows-latest
node: '22.2.0'
shard: ''
- os: windows-latest
node: '24.1.0'
shard: ''
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Unit tests
run: pnpm vitest run ${{ env.POOL_OPTIONS }} ${{ env.SHARD_OPTIONS }}
env:
POOL_OPTIONS: ${{ matrix.os == 'macos-latest' && '--pool forks' || '' }}
SHARD_OPTIONS: ${{ matrix.shard && format('--shard {0}', matrix.shard) || '' }}
VITEST_MIN_THREADS: "1"
VITEST_MAX_THREADS: "4"
unit-tests-gate:
name: "Unit tests"
needs: unit-tests
if: always()
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Verify all unit tests passed
if: needs.unit-tests.result != 'success'
run: exit 1
test-coverage-shard:
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
name: "Test Coverage (shard ${{ matrix.shard }})"
runs-on: ubuntu-latest
timeout-minutes: 30
strategy:
matrix:
shard: ['1/2', '2/2']
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Unit tests with coverage (shard)
run: pnpm vitest run --coverage --coverage.all=false --reporter=blob --outputFile=vitest-blob-reports/blob-${{ matrix.shard == '1/2' && '1' || '2' }}.json --shard ${{ matrix.shard }}
env:
VITEST_MIN_THREADS: "1"
VITEST_MAX_THREADS: "4"
- uses: actions/upload-artifact@v4
with:
name: coverage-blob-${{ matrix.shard == '1/2' && '1' || '2' }}
path: vitest-blob-reports/
retention-days: 1
test-coverage-merge:
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
needs: test-coverage-shard
name: 'Test Coverage'
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- uses: actions/download-artifact@v4
with:
pattern: coverage-blob-*
path: vitest-blob-reports
merge-multiple: true
- name: Merge coverage reports
run: pnpm vitest --mergeReports vitest-blob-reports --reporter=json --outputFile=./coverage/report.json --coverage --coverage.all=false
- name: Convert coverage to Jest
run: ./bin/save-coverage-file.js
- name: Take copy of report as new baseline for branch
run: cp ./report.json ./baseline-report.json
- name: Clean ref name
env:
SAFE_REF_NAME: "${{ github.head_ref }}"
run: |
SAFE_REF_NAME="${SAFE_REF_NAME//[\/.]/}"
echo "SAFE_REF_NAME=${SAFE_REF_NAME}" >> $GITHUB_ENV
- uses: actions/upload-artifact@v4
with:
name: ${{ env.SAFE_REF_NAME }}--coverage-report
path: ./baseline-report.json
- name: Download and publish test coverage
uses: ./.github/actions/download-and-publish-test-coverage
with:
base-branch-name: '${{ github.base_ref }}'
e2e-tests:
name: 'E2E tests'
if: github.event.pull_request.head.repo.full_name == github.repository
runs-on: ubuntu-latest
timeout-minutes: 15
continue-on-error: true
steps:
- uses: actions/checkout@v3
with:
repository: ${{ github.event.pull_request.head.repo.full_name || github.event.repository.full_name }}
ref: ${{ github.event.pull_request.head.ref || github.event.merge_group.head_ref }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Build
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
- name: Install Playwright Chromium
run: npx playwright install chromium
working-directory: packages/e2e
- name: Rebuild node-pty
run: pnpm rebuild node-pty
- name: Run E2E tests
working-directory: packages/e2e
env:
SHOPIFY_FLAG_CLIENT_ID: ${{ secrets.E2E_CLIENT_ID }}
E2E_ACCOUNT_EMAIL: ${{ secrets.E2E_ACCOUNT_EMAIL }}
E2E_ACCOUNT_PASSWORD: ${{ secrets.E2E_ACCOUNT_PASSWORD }}
E2E_STORE_FQDN: ${{ secrets.E2E_STORE_FQDN }}
E2E_SECONDARY_CLIENT_ID: ${{ secrets.E2E_SECONDARY_CLIENT_ID }}
run: npx playwright test
- name: Upload Playwright report
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: packages/e2e/playwright-report/
retention-days: 14
- name: Upload test results
uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-results
path: packages/e2e/test-results/
retention-days: 14
type-diff:
if: github.event.pull_request.head.repo.full_name == github.repository
name: 'Type-diff'
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v3
name: Checkout [main]
with:
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ env.DEFAULT_NODE_VERSION }}
- name: Build
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
- name: Type-diff
working-directory: workspace
id: type-diff
run: pnpm nx run type-diff
- uses: marocchino/sticky-pull-request-comment@fcf6fe9e4a0409cd9316a5011435be0f3327f1e1 # v2.3.1
if: steps.type-diff.outputs.report != ''
with:
header: Type-diff
message: ${{ steps.type-diff.outputs.report }}
recreate: true