
* invite staff * staff members * all tests for staff members * remove unused import * update snap * remove /dashboard/ * uptade test.yml
155 lines
4.9 KiB
YAML
155 lines
4.9 KiB
YAML
name: QA
|
|
|
|
on: [pull_request]
|
|
|
|
jobs:
|
|
check-lock:
|
|
runs-on: ubuntu-latest
|
|
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
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v2
|
|
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
|
|
|
|
jest-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v2
|
|
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
|
|
|
|
cypress-run:
|
|
if: github.event.pull_request.head.repo.full_name == 'mirumee/saleor-dashboard'
|
|
runs-on: ubuntu-16.04
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v1
|
|
|
|
- name: Get custom API_URI
|
|
id: api_uri
|
|
# Search for API_URI in PR description
|
|
env:
|
|
pull_request_body: ${{ github.event.pull_request.body }}
|
|
prefix: API_URI=
|
|
pattern: (http|https)://[a-zA-Z0-9.-]+/graphql/?
|
|
run: |
|
|
echo "::set-output name=custom_api_uri::$(echo $pull_request_body | grep -Eo "$prefix$pattern" | sed s/$prefix// | head -n 1)"
|
|
|
|
- name: Cypress run
|
|
if: ${{ steps.api_uri.outputs.custom_api_uri}} != 'https://qa.staging.saleor.cloud/graphql/'
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
API_URI: ${{ steps.api_uri.outputs.custom_api_uri || secrets.API_URI }}
|
|
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
|
|
CYPRESS_baseUrl: ${{ secrets.CYPRESS_BASEURL }}
|
|
CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
|
|
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
|
|
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
|
|
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
|
|
with:
|
|
build: npm run build
|
|
start: npx local-web-server --spa index.html
|
|
wait-on: http://localhost:9000/
|
|
wait-on-timeout: 120
|
|
spec: cypress/integration/allEnv/**/*.js
|
|
|
|
- name: Cypress run
|
|
if: ${{ steps.api_uri.outputs.custom_api_uri}} == 'https://qa.staging.saleor.cloud/graphql/'
|
|
uses: cypress-io/github-action@v2
|
|
env:
|
|
API_URI: ${{ steps.api_uri.outputs.custom_api_uri || secrets.API_URI }}
|
|
APP_MOUNT_URI: ${{ secrets.APP_MOUNT_URI }}
|
|
CYPRESS_baseUrl: ${{ secrets.CYPRESS_BASEURL }}
|
|
CYPRESS_USER_NAME: ${{ secrets.CYPRESS_USER_NAME }}
|
|
CYPRESS_SECOND_USER_NAME: ${{ secrets.CYPRESS_SECOND_USER_NAME }}
|
|
CYPRESS_USER_PASSWORD: ${{ secrets.CYPRESS_USER_PASSWORD }}
|
|
CYPRESS_PERMISSIONS_USERS_PASSWORD: ${{ secrets.CYPRESS_PERMISSIONS_USERS_PASSWORD }}
|
|
CYPRESS_MAILHOG: ${{ secrets.CYPRESS_MAILHOG }}
|
|
with:
|
|
build: npm run build
|
|
start: npx local-web-server --spa index.html
|
|
wait-on: http://localhost:9000/
|
|
wait-on-timeout: 120
|
|
- uses: actions/upload-artifact@v1
|
|
if: always()
|
|
with:
|
|
name: cypress-videos
|
|
path: cypress/videos
|
|
|
|
translation-messages:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Cache node modules
|
|
uses: actions/cache@v2
|
|
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
|