Merge pull request #41 from open-spaced-repetition/merge/master #21
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint and Test | |
on: | |
pull_request: | |
branches: ["**"] | |
push: | |
branches: | |
- "**" | |
jobs: | |
# https://github.com/snezhig/obsidian-front-matter-title/blob/master/.github/workflows/main.yml | |
validate: | |
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: "true" | |
- name: Install Dependencies | |
run: npm install -g pnpm && pnpm install | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.x" | |
cache: "pnpm" | |
- run: pnpm i | |
# - name: Eslint | |
# run: pnpm run lint | |
- name: Run test | |
run: pnpm run test | |
pretty: | |
needs: validate | |
runs-on: ubuntu-latest | |
# if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == 'Newdea/obsidian-spaced-repetition-recall' | |
permissions: write-all | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
# Make sure the actual branch is checked out when running on pull requests | |
ref: ${{ github.head_ref }} | |
- name: Prettify code | |
uses: creyD/prettier_action@v4.3 | |
with: | |
prettier_version: ^3.1.1 | |
# This part is also where you can pass other options, for example: | |
# prettier_options: --write *.ts *.json src test --ignore-path package-lock.json | |
# --config .prettierrc.json --ignore-path package-lock.json pnpm-lock.yaml | |
prettier_options: --write . | |
lint_and_test: | |
needs: pretty | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- uses: actions/checkout@v3 | |
- name: Install Dependencies | |
run: npm install -g pnpm && pnpm install | |
- name: Lint | |
run: pnpm lint | |
- name: Test | |
run: pnpm test |