Skip to content

Merge pull request #5 from corva-ai/chore-test #5

Merge pull request #5 from corva-ai/chore-test

Merge pull request #5 from corva-ai/chore-test #5

Workflow file for this run

name: 'Code Analysis'
on:
pull_request:
types:
- opened
- synchronize
push:
branches:
- develop
permissions:
id-token: write
contents: read
actions: read
checks: write
statuses: write
jobs:
lint:
name: Lint
runs-on: ubuntu-24.04
steps:
- name: Load secrets from 1Password
uses: 1password/load-secrets-action@v2.0.0
id: secrets
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_RO }}
#
APP_ID: 'op://GitHub.Actions/GitHub/corva-bot/APP_ID'
PRIVATE_KEY: 'op://GitHub.Actions/GitHub/corva-bot/PRIVATE_KEY'
- name: Checkout sources
uses: actions/checkout@v4.1.7
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
build: "false"
- name: Cache ESLint
uses: actions/cache@v4.0.2
with:
path: .eslintcache
key: ${{ runner.os }}-eslint-${{ hashFiles('./yarn.lock') }}-${{ hashFiles('./.eslint*') }}
- name: Lint
run: npm run lint
- name: Generate GitHub token
uses: actions/create-github-app-token@v1.10.4
if: ${{ success() || failure() }}
id: token
with:
app-id: ${{ steps.secrets.outputs.APP_ID }}
private-key: ${{ steps.secrets.outputs.PRIVATE_KEY }}
- name: Add PR status check
uses: ouzi-dev/commit-status-updater@v2.0.2
if: ${{ success() || failure() }}
with:
token: ${{ steps.token.outputs.token }}
name: 'Lint'
status: ${{ job.status }}
url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
description: ${{ job.status == 'success' && 'Linted successfully' || 'Linted with errors. Check PR annotations' }}
format:
name: Format
runs-on: ubuntu-24.04
steps:
- name: Load secrets from 1Password
uses: 1password/load-secrets-action@v2.0.0
id: secrets
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_RO }}
#
APP_ID: 'op://GitHub.Actions/GitHub/corva-bot/APP_ID'
PRIVATE_KEY: 'op://GitHub.Actions/GitHub/corva-bot/PRIVATE_KEY'
- name: Checkout sources
uses: actions/checkout@v4.1.7
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
build: "false"
- name: Format
run: npm run format-check
- name: Generate GitHub token
uses: actions/create-github-app-token@v1.10.4
if: ${{ success() || failure() }}
id: token
with:
app-id: ${{ steps.secrets.outputs.APP_ID }}
private-key: ${{ steps.secrets.outputs.PRIVATE_KEY }}
- name: Add PR status check
uses: ouzi-dev/commit-status-updater@v2.0.2
if: ${{ success() || failure() }}
with:
token: ${{ steps.token.outputs.token }}
name: 'Format'
status: ${{ job.status }}
url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
description: ${{ job.status == 'success' && 'Code is properly formatted' || 'Code is not properly formatted. Check PR annotations' }}
test:
name: Unit Test
runs-on: ubuntu-24.04
steps:
- name: Load secrets from 1Password
uses: 1password/load-secrets-action@v2.0.0
id: secrets
with:
export-env: false
env:
OP_SERVICE_ACCOUNT_TOKEN: ${{ secrets.OP_SERVICE_ACCOUNT_TOKEN_RO }}
#
APP_ID: 'op://GitHub.Actions/GitHub/corva-bot/APP_ID'
PRIVATE_KEY: 'op://GitHub.Actions/GitHub/corva-bot/PRIVATE_KEY'
- name: Checkout sources
uses: actions/checkout@v4.1.7
with:
ref: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
- name: Setup Environment
uses: ./.github/actions/setup-environment
with:
build: "false"
- name: Cache Jest
uses: actions/cache@v4.0.2
with:
path: ./node_modules/.cache/jest
key: ${{ runner.os }}-jest-${{ hashFiles('./yarn.lock') }}
- name: Test
run: npm run test
- name: Generate GitHub token
uses: actions/create-github-app-token@v1.10.4
if: ${{ success() || failure() }}
id: token
with:
app-id: ${{ steps.secrets.outputs.APP_ID }}
private-key: ${{ steps.secrets.outputs.PRIVATE_KEY }}
- name: Add PR status check
uses: ouzi-dev/commit-status-updater@v2.0.2
if: ${{ success() || failure() }}
with:
token: ${{ steps.token.outputs.token }}
name: 'Unit Test'
status: ${{ job.status }}
url: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
description: ${{ job.status == 'success' && 'Unit tests ran successfully' || 'Unit tests ran with errors. Check PR annotations' }}