Skip to content

Add support for executing GraphQL queries on non-dev stores #142

Add support for executing GraphQL queries on non-dev stores

Add support for executing GraphQL queries on non-dev stores #142

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'
SHOPIFY_FLAG_CLIENT_ID: ${{ secrets.SHOPIFY_FLAG_CLIENT_ID }}
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 }}'
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' ]
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:
VITEST_MIN_THREADS: "1"
VITEST_MAX_THREADS: "4"
acceptance-tests:
name: 'Acceptance tests with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
matrix:
os: [ 'ubuntu-latest', 'macos-latest', 'windows-latest' ]
node: [ '24.1.0' ]
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: Acceptance tests
env:
SHOPIFY_CLI_PARTNERS_TOKEN: ${{ secrets.SHOPIFY_CLI_PARTNERS_TOKEN }}
run: pnpm test:features --output-style=stream
test-coverage:
if: ${{ github.event.pull_request.user.login != 'dependabot[bot]' }}
name: 'Test Coverage'
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: Run and save test coverage
uses: ./.github/actions/run-and-save-test-coverage
with:
branch-name: '${{ github.head_ref }}'
- name: Download and publish test coverage
uses: ./.github/actions/download-and-publish-test-coverage
with:
base-branch-name: '${{ github.base_ref }}'
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 --exclude=features --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