2021-01-06 20:37:59 +00:00
|
|
|
# SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
|
2020-11-22 20:50:07 +00:00
|
|
|
#
|
|
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
2020-08-31 10:48:58 +00:00
|
|
|
name: lint
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [main]
|
|
|
|
pull_request:
|
|
|
|
branches: [main]
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
lint:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Lints all .ts and .tsx files
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
2020-11-29 09:07:44 +00:00
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
2021-06-21 20:58:54 +00:00
|
|
|
- name: Cache yarn cache
|
2020-11-29 09:07:44 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
2020-08-31 10:48:58 +00:00
|
|
|
with:
|
2020-11-29 09:07:44 +00:00
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
2021-05-24 19:01:16 +00:00
|
|
|
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
|
2020-11-29 09:07:44 +00:00
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
2020-08-31 10:48:58 +00:00
|
|
|
- name: Set up NodeJS
|
2020-12-19 00:39:40 +00:00
|
|
|
uses: actions/setup-node@v2
|
2020-08-31 10:48:58 +00:00
|
|
|
with:
|
2021-05-24 19:01:16 +00:00
|
|
|
node-version: 16
|
2020-08-31 10:48:58 +00:00
|
|
|
- name: Install dependencies
|
2020-11-29 09:07:44 +00:00
|
|
|
run: yarn install --frozen-lockfile --prefer-offline
|
2020-08-31 10:48:58 +00:00
|
|
|
- name: Lint code
|
|
|
|
run: yarn lint
|
2021-06-06 21:14:00 +00:00
|
|
|
format:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Checks codestyle of all .ts and .tsx files
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Get yarn cache directory path
|
|
|
|
id: yarn-cache-dir-path
|
|
|
|
run: echo "::set-output name=dir::$(yarn cache dir)"
|
|
|
|
|
2021-06-21 20:58:54 +00:00
|
|
|
- name: Cache yarn cache
|
2021-06-06 21:14:00 +00:00
|
|
|
uses: actions/cache@v2
|
|
|
|
id: yarn-cache
|
|
|
|
with:
|
|
|
|
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
|
|
|
|
key: ${{ runner.os }}-16-yarn-${{ hashFiles('**/yarn.lock') }}
|
|
|
|
restore-keys: |
|
|
|
|
${{ runner.os }}-yarn-
|
|
|
|
|
|
|
|
- name: Set up NodeJS
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
|
|
|
node-version: 16
|
|
|
|
- name: Install dependencies
|
|
|
|
run: yarn install --frozen-lockfile --prefer-offline
|
|
|
|
- name: Lint code
|
|
|
|
run: yarn format
|