Skip to content

Use graphQL to upload theme files #16367

Use graphQL to upload theme files

Use graphQL to upload theme files #16367

Workflow file for this run

name: shopify-cli
on:
workflow_dispatch:
inputs:
branch-name:
type: string
description: 'Branch'
required: true
default: 'main'
node-version:
description: 'Node version'
required: true
default: '18.20.3'
type: choice
options:
- 18.20.3
- 20.14.0
- 22.2.0
os:
description: 'Operating system'
required: true
default: 'ubuntu-latest'
type: choice
options:
- ubuntu-latest
- windows-latest
- macos-latest
debug-enabled:
type: boolean
description: 'Enable tmate debugging'
required: true
default: true
push:
branches:
- main
- stable/3.*
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: '8.15.7'
BUNDLE_WITHOUT: 'test:development'
SHOPIFY_FLAG_CLIENT_ID: ${{ secrets.SHOPIFY_FLAG_CLIENT_ID }}
SHOPIFY_CLI_PARTNERS_TOKEN: ${{ secrets.SHOPIFY_CLI_PARTNERS_TOKEN }}
GH_TOKEN: ${{ secrets.SHOPIFY_GH_READ_CONTENT_TOKEN }}
jobs:
main:
name: '[Main] Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node: ['18.20.3', '20.14.0', '22.2.0']
steps:
- uses: actions/checkout@v3
name: Checkout [${{ github.ref_name }}]
with:
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ matrix.node }}
- name: Build
run: pnpm nx run-many --all --skip-nx-cache --target=build --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Lint
run: pnpm nx run-many --all --skip-nx-cache --target=lint --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Type-check
run: pnpm nx run-many --all --skip-nx-cache --target=type-check --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Bundle
run: pnpm nx run-many --all --skip-nx-cache --target=bundle --output-style=stream
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
- name: Unit tests
run: pnpm nx run-many --all --skip-nx-cache --target=test --exclude=features --output-style=stream
- name: Acceptance tests
if: ${{ matrix.node == '18.20.3' }}
run: pnpm nx run features:test
- name: Send Slack notification on failure
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844 # [email protected]
if: failure()
with:
payload: |
{
"build_url": "https://github.com/Shopify/cli/actions/runs/${{ github.run_id }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
- name: Run and save test coverage
uses: ./.github/actions/run-and-save-test-coverage
if: ${{ matrix.os == 'ubuntu-latest' && matrix.node == '18.20.3' }}
with:
branch-name: ${{ github.ref_name }}
pr-platform-agnostic:
name: '[PR] Run ${{ matrix.target }} with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
target: ['build', 'type-check']
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: ${{ matrix.target }}
run: pnpm nx run-many --all --skip-nx-cache --target=${{ matrix.target }} --output-style=stream
pr-platform-agnostic-lint:
name: '[PR] Run lint with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
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: Lint
run: pnpm nx run-many --all --skip-nx-cache --target=lint --output-style=stream --format=json -o eslint-report.json
continue-on-error: true
- name: Annotate Code Linting Results
uses: ataylorme/eslint-annotate-action@21a1ba0738d8b732639999029c4ff40b6e121bb4 # pin@v3
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
report-json: "packages/*/eslint-report.json"
pr-platform-agnostic-bundle:
name: '[PR] Run bundle with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
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: '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
pr-platform-agnostic-knip:
name: '[PR] Run knip with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
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: Post the knip results
uses: codex-/knip-reporter@1ccefdf649b847793412fbfba286dc0b05defc1e # pin@v2
with:
verbose: true
pr-platform-agnostic-graphql-schema:
name: '[PR] Check graphql-codegen has been run'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' }}
timeout-minutes: 30
strategy:
matrix:
os: ['macos-latest'] # Codegen uses a find command that needs to work on CI and macOS; using the same env keeps this simple
node: ['18.20.3']
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: Get schemas for codegen
run: pnpm graphql-codegen:get-graphql-schemas
- name: Run graphql-codegen
run: pnpm graphql-codegen
- 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: '[PR] Check OCLIF manifests & readme & docs'
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
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: 18.20.3
- 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 documentation
run: pnpm refresh-documentation
- name: Check if there are changes
run: 'test -z "$(git status --porcelain)" || { echo -e "Run pnpm refresh-documentation when you update functions with autogenerated examples. Diff here:\n\n$(git diff)" ; exit 1; }'
- name: Build shopify.dev docs
run: pnpm update-docs
- name: Check if there are changes
run: 'test -z "$(git status --porcelain "docs-shopify.dev/generated/*.json" )" || { echo -e "Run (pnpm update-docs) before pushing new commands or flags." ; exit 1; }'
pr-platform-dependent:
name: '[PR] Test with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest', 'windows-latest', 'macos-latest']
node: ['18.20.3', '20.14.0', '22.2.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 test:unit --output-style=stream
pr-acceptance-tests:
name: '[PR] Accept. Test with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ github.event_name == 'pull_request' || github.event_name == 'merge_group' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
node: ['18.20.3']
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
run: pnpm test:features --output-style=stream
pr-test-coverage:
name: '[PR] Run Test Coverage with Node ${{ matrix.node }} in ${{ matrix.os }}'
runs-on: ${{ matrix.os }}
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'merge_group') && github.event.pull_request.user.login != 'dependabot[bot]' }}
timeout-minutes: 30
strategy:
matrix:
os: ['ubuntu-latest']
node: ['18.20.3']
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: 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 }}'
manually-triggered:
name: '[Manual] Test with Node ${{ inputs.node-version }} in ${{ inputs.os }}'
runs-on: ${{ inputs.os }}
if: ${{ github.event_name == 'workflow_dispatch' }}
timeout-minutes: 60
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.branch-name }}
fetch-depth: 1
- name: Setup deps
uses: ./.github/actions/setup-cli-deps
with:
node-version: ${{ inputs.node-version }}
- name: Unit tests
run: pnpm test:unit --output-style=stream
- name: Acceptance tests
run: pnpm test:features --output-style=stream
- name: Setup tmate session
if: ${{ failure() && inputs.debug-enabled }}
uses: mxschmitt/action-tmate@1005f9c9db5f1b055a495e72c6e589764984baf6 # pin@v3
with:
limit-access-to-actor: true