diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 00000000000..d5497de9424 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,84 @@ +name: QA +permissions: + contents: read + +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize, reopened] + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + check-lock: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + + - name: Validate lock file + run: npx lockfile-lint --path package-lock.json --allowed-hosts npm yarn + + tsc-and-linters: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "npm" + + - name: Install deps + run: npm ci + + - name: Run tsc + run: npm run check-types + + - name: Run lint + run: npm run lint + + - name: Check for uncommitted lint changes + run: git diff --exit-code ./src + + - name: Check Prettier formatting + run: npm run format:check + + jest-tests: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "npm" + + - name: Install deps + run: npm ci + + - name: Run tests + run: npm run test:ci + + - name: Upload coverage reports to Codecov + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + slug: saleor/saleor-dashboard + + translation-messages: + runs-on: ubuntu-22.04 + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version-file: ".nvmrc" + cache: "npm" + + - name: Install deps + run: npm ci + + - name: Check message extraction + run: | + npm run extract-messages + git diff --exit-code ./locale diff --git a/.github/workflows/pr-automation.yml b/.github/workflows/pr-automation.yml index 7fa5f352508..67c4f240400 100644 --- a/.github/workflows/pr-automation.yml +++ b/.github/workflows/pr-automation.yml @@ -12,7 +12,7 @@ on: default: 2 # This is the default only for manually (re-)triggered runs. Default for runs triggered by pull requests is configured via `jobs.initialize-cloud.generate-shard-matrix.env.CONCURRENCY`. concurrency: - group: ${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/run-test-manual.yml b/.github/workflows/run-test-manual.yml index 35497beb569..c5e3dad2fde 100644 --- a/.github/workflows/run-test-manual.yml +++ b/.github/workflows/run-test-manual.yml @@ -3,7 +3,7 @@ name: Run test manually on: [workflow_dispatch] concurrency: - group: ${{ github.ref }} + group: ${{ github.workflow }}-${{ github.ref }} cancel-in-progress: true jobs: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml deleted file mode 100644 index 23d029d3248..00000000000 --- a/.github/workflows/test.yml +++ /dev/null @@ -1,120 +0,0 @@ -name: QA - -on: - push: - branches: [main] - pull_request: - types: [opened, synchronize, reopened, ready_for_review, labeled] - -jobs: - check-lock: - runs-on: ubuntu-latest - if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) - steps: - - uses: actions/checkout@v2 - - - name: Validate lock file - run: | - npx lockfile-lint --path package-lock.json --allowed-hosts npm yarn - - tsc-and-linters: - runs-on: ubuntu-latest - if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) - steps: - - uses: actions/checkout@v2 - - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-qa-${{ env.cache-name }}- - ${{ runner.os }}-qa- - ${{ runner.os }}- - - - name: Install deps - run: | - npm ci - - - name: Run tsc - run: | - npm run check-types - - - name: Run lint - run: | - npm run lint - git diff --exit-code ./src - - - name: Check Prettier formatting - run: | - npm run format:check - - jest-tests: - runs-on: ubuntu-latest - if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-qa-${{ env.cache-name }}- - ${{ runner.os }}-qa- - ${{ runner.os }}- - - - name: Install deps - run: | - npm ci - - - name: Run jest - run: | - npm run test:ci - - - name: Upload coverage reports to Codecov - uses: codecov/codecov-action@v5 - with: - token: ${{ secrets.CODECOV_TOKEN }} - slug: saleor/saleor-dashboard - - translation-messages: - runs-on: ubuntu-latest - if: github.event_name == 'push' || (github.event.pull_request.draft == false || contains(github.event.pull_request.labels.*.name, 'Run QA checks')) - steps: - - uses: actions/checkout@v2 - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: ".nvmrc" - - name: Cache node modules - uses: actions/cache@v3 - env: - cache-name: cache-node-modules - with: - # npm cache files are stored in `~/.npm` on Linux/macOS - path: ~/.npm - key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} - restore-keys: | - ${{ runner.os }}-qa-${{ env.cache-name }}- - ${{ runner.os }}-qa- - ${{ runner.os }}- - - - name: Install deps - run: | - npm ci - - - name: Check message extraction - run: | - npm run extract-messages - git diff --exit-code ./locale diff --git a/.nvmrc b/.nvmrc index 209e3ef4b62..09464731e70 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -20 +20.19 diff --git a/codecov.yml b/codecov.yml index acb5b151511..95993d14f10 100644 --- a/codecov.yml +++ b/codecov.yml @@ -1,11 +1,22 @@ coverage: status: + patch: + default: + target: auto project: default: target: auto ignore: - "src/graphql/**" + - "./src/**/queries.ts" + - "./src/**/mutations.ts" + - "./src/**/fragments/*.ts" + - "./src/searches/*.ts" - ".featureFlags/**" - "testUtils/**" - "assets/**" + - "lint/**" + - "scripts/**" + - "**/*.config.js" + - "**/*.config.ts"