From d7f942ba4ac8ad521ec28872fff803df0414393c Mon Sep 17 00:00:00 2001 From: Samuli Suortti Date: Thu, 20 Oct 2022 15:45:13 +0300 Subject: [PATCH] feat[coral]: Introduce GH action for Coral PR check MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run static checks (eslint + prettier) and unitests for every PR that includes changes to ´/coral/**´ Resolves: #108, #109 --- .github/workflows/coral-pr-pipeline.yml | 102 ++++++++++++++++++++++++ 1 file changed, 102 insertions(+) create mode 100644 .github/workflows/coral-pr-pipeline.yml diff --git a/.github/workflows/coral-pr-pipeline.yml b/.github/workflows/coral-pr-pipeline.yml new file mode 100644 index 0000000000..a0bead50ee --- /dev/null +++ b/.github/workflows/coral-pr-pipeline.yml @@ -0,0 +1,102 @@ +name: Coral PR Pipeline + +on: + pull_request: + branches: + - main + - coral + paths: + - 'coral/**' + - '.github/workflows/coral-checks.yml' + +permissions: + contents: read + +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 + with: + persist-credentials: false + + - name: Setup node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4 + 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 + with: + persist-credentials: false + + - name: Setup node.js + uses: actions/setup-node@v3 + with: + node-version: ${{ env.NODE_VERSION }} + + - name: Setup pnpm + uses: pnpm/action-setup@c3b53f6a16e57305370b4ae5a540c2077a1d50dd # v2.2.4 + 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