Skip to content

Commit

Permalink
feat[coral]: Introduce GH action for Coral PR check
Browse files Browse the repository at this point in the history
Run static checks (eslint + prettier) and unitests for every
PR that includes changes to ´/coral/**´

Resolves: #108, #109
  • Loading branch information
SmuliS committed Oct 20, 2022
1 parent 857e051 commit 8323a24
Showing 1 changed file with 95 additions and 0 deletions.
95 changes: 95 additions & 0 deletions .github/workflows/coral-pr-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Coral PR Pipeline

on:
pull_request:
branches:
- main
- coral
paths:
- 'coral/**'
- '.github/workflows/coral-checks.yml'

env:
NODE_VERSION: 16
PNPM_VERSION: 7.13.4

jobs:
static_code_analysis:
name: Static code analysis
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
working-directory: ./coral
run: pnpm install --frozen-lockfile

- name: Run static checks
working-directory: ./coral
run: pnpm run lint

tests:
name: Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup node.js
uses: actions/setup-node@v3
with:
node-version: ${{ env.NODE_VERSION }}

- name: Setup pnpm
uses: pnpm/[email protected]
with:
version: ${{ env.PNPM_VERSION }}
run_install: false

- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
working-directory: ./coral
run: pnpm install --frozen-lockfile

- name: Run unittests
working-directory: ./coral
run: pnpm run test

0 comments on commit 8323a24

Please sign in to comment.