games-store-back/.github/workflows/main.yml
2021-10-18 16:39:16 -03:00

117 lines
3.4 KiB
YAML

on:
workflow_dispatch:
inputs:
dispatch_token:
description: 'Token that authorize the dispatch'
required: true
head_sha:
description: 'Head commit SHA that dispatched the workflow'
required: true
pr_author_username:
description: 'Pull Request author username'
required: true
pr_number:
description: 'Pull Request number that dispatched the workflow'
required: true
jobs:
ESLint-evaluator:
runs-on: self-hosted
name: ESLint
steps:
- name: Fetch project repository
uses: actions/checkout@v2
- name: Fetch Blocked Files Checkout action
uses: actions/checkout@v2
with:
repository: betrybe/blocked-files-checkout-action
ref: v2
token: ${{ secrets.GIT_HUB_PAT }}
path: .github/actions/blocked-files-checkout
- name: Fetch ESLint evaluator
uses: actions/checkout@v2
with:
repository: betrybe/eslint-linter-action
ref: v3
token: ${{ secrets.GIT_HUB_PAT }}
path: .github/actions/eslint-evaluator
- name: Setup NodeJS
uses: actions/setup-node@v1.4.4
with:
node-version: '14'
- name: Restore protected files
uses: ./.github/actions/blocked-files-checkout
with:
restore_branch: 'master'
- name: Run ESLint evaluator
uses: ./.github/actions/eslint-evaluator
with:
token: ${{ secrets.GITHUB_TOKEN }}
pr_number: ${{ github.event.inputs.pr_number }}
Evaluator:
runs-on: self-hosted
name: Evaluator
needs: [ESLint-evaluator]
services:
mongodb:
image: mongo
ports:
- "27017:27017"
options: -v ${{ github.workspace }}:/github/workspace
steps:
- name: Fetch project repository
uses: actions/checkout@v2
- name: Fetch Blocked Files Checkout action
uses: actions/checkout@v2
with:
repository: betrybe/blocked-files-checkout-action
ref: v2
token: ${{ secrets.GIT_HUB_PAT }}
path: .github/actions/blocked-files-checkout
- name: Fetch Jest evaluator
uses: actions/checkout@v2
with:
repository: betrybe/jest-evaluator-action
ref: v9
token: ${{ secrets.GIT_HUB_PAT }}
path: .github/actions/jest-evaluator
- name: Fetch Store evaluation
uses: actions/checkout@v2
with:
repository: betrybe/store-evaluation-action
ref: v2
token: ${{ secrets.GIT_HUB_PAT }}
path: .github/actions/store-evaluation
- name: Setup NodeJS
uses: actions/setup-node@v1.4.4
with:
node-version: '12'
- name: Restore protected files
uses: ./.github/actions/blocked-files-checkout
with:
restore_branch: 'master'
- name: Run Jest evaluation
id: evaluator
uses: ./.github/actions/jest-evaluator
with:
pr_author_username: ${{ github.event.inputs.pr_author_username }}
npm-start: true
- name: Run Store evaluation
uses: ./.github/actions/store-evaluation
with:
evaluation-data: ${{ steps.evaluator.outputs.result }}
environment: production
pr-number: ${{ github.event.inputs.pr_number }}