93 lines
2.9 KiB
YAML
93 lines
2.9 KiB
YAML
name: QA
|
|
on: [pull_request]
|
|
jobs:
|
|
lint:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: pnpm/action-setup@v2.2.4
|
|
with:
|
|
version: 8.2.0
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
cache: pnpm
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Check linters
|
|
run: pnpm lint
|
|
|
|
test:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: pnpm/action-setup@v2.2.4
|
|
with:
|
|
version: 8.2.0
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
cache: "pnpm"
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Test
|
|
run: pnpm test:ci
|
|
- name: Generate coverage report
|
|
uses: irongut/CodeCoverageSummary@v1.3.0
|
|
with:
|
|
filename: coverage/cobertura-coverage.xml
|
|
format: markdown
|
|
output: file
|
|
|
|
- name: Add Coverage PR Comment
|
|
uses: marocchino/sticky-pull-request-comment@v2
|
|
if: github.event_name == 'pull_request'
|
|
with:
|
|
recreate: true
|
|
path: code-coverage-results.md
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: pnpm/action-setup@v2.2.4
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: 18
|
|
cache: pnpm
|
|
- uses: actions/cache@v3
|
|
with:
|
|
path: |
|
|
${{ github.workspace }}/.next/cache
|
|
key: ${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}-${{ hashFiles('**.[jt]s', '**.[jt]sx') }}
|
|
# If source files changed but packages didn't, rebuild from a prior cache.
|
|
restore-keys: |
|
|
${{ runner.os }}-nextjs-${{ hashFiles('**/pnpm-lock.json') }}-
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Build project
|
|
run: pnpm build
|
|
- name: Creating .npmrc
|
|
run: |
|
|
cat << EOF > "$HOME/.npmrc"
|
|
//registry.npmjs.org/:_authToken=$NPM_TOKEN
|
|
EOF
|
|
env:
|
|
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
- name: Release on @dev tag in npm
|
|
run: npx changeset version --snapshot pr && pnpm publish --tag dev --no-git-checks
|
|
# Store package.json version in env
|
|
- run: echo "PACKAGE_JSON=$(jq -c . < package.json)" >> $GITHUB_ENV
|
|
- run: echo '${{ fromJson(env.PACKAGE_JSON).version }}'
|
|
# Post a comment with released snapshot
|
|
- name: Create with released tag
|
|
uses: peter-evans/create-or-update-comment@v2
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
body: |
|
|
Released snapshot build with `@dev` tag in npm with version: `${{ fromJson(env.PACKAGE_JSON).version }}`
|
|
|
|
Install it with
|
|
```bash
|
|
pnpm add @saleor/app-sdk@${{ fromJson(env.PACKAGE_JSON).version }}
|
|
```
|