mirror of
https://github.com/usememos/memos.git
synced 2024-12-24 11:44:44 +03:00
878e0eabc8
* feat: add crawler plugin * chore: update * chore: go mod tidy * chore: update
89 lines
2.2 KiB
YAML
89 lines
2.2 KiB
YAML
name: Test
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
- "release/v*.*.*"
|
|
pull_request:
|
|
branches: [main]
|
|
|
|
jobs:
|
|
eslint-checks:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "18"
|
|
cache: yarn
|
|
cache-dependency-path: "web/yarn.lock"
|
|
- run: yarn
|
|
working-directory: web
|
|
- name: Run eslint check
|
|
run: yarn lint
|
|
working-directory: web
|
|
|
|
jest-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "18"
|
|
cache: yarn
|
|
cache-dependency-path: "web/yarn.lock"
|
|
- run: yarn
|
|
working-directory: web
|
|
- name: Run jest
|
|
run: yarn test
|
|
working-directory: web
|
|
|
|
frontend-build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-node@v3
|
|
with:
|
|
node-version: "18"
|
|
cache: yarn
|
|
cache-dependency-path: "web/yarn.lock"
|
|
- run: yarn
|
|
working-directory: web
|
|
- name: Run frontend build
|
|
run: yarn build
|
|
working-directory: web
|
|
|
|
go-static-checks:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19
|
|
check-latest: true
|
|
cache: true
|
|
- name: Verify go.mod is tidy
|
|
run: |
|
|
go mod tidy -go=1.19
|
|
git diff --exit-code
|
|
- name: golangci-lint
|
|
uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
args: -v
|
|
skip-cache: true
|
|
|
|
go-tests:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
- uses: actions/setup-go@v3
|
|
with:
|
|
go-version: 1.19
|
|
check-latest: true
|
|
cache: true
|
|
- name: Run all tests
|
|
run: go test -v ./... | tee test.log; exit ${PIPESTATUS[0]}
|
|
- name: Pretty print tests running time
|
|
run: grep --color=never -e '--- PASS:' -e '--- FAIL:' test.log | sed 's/[:()]//g' | awk '{print $2,$3,$4}' | sort -t' ' -nk3 -r | awk '{sum += $3; print $1,$2,$3,sum"s"}'
|