2023-07-12 21:25:05 +00:00
|
|
|
when:
|
|
|
|
- event: pull_request
|
|
|
|
- event: push
|
2023-07-12 21:31:59 +00:00
|
|
|
branch: [ main, release/* ]
|
2023-07-12 21:25:05 +00:00
|
|
|
|
2022-07-17 16:25:56 +00:00
|
|
|
variables:
|
2022-10-25 12:51:29 +00:00
|
|
|
- &node_image 'node:18-alpine'
|
2023-07-10 12:46:55 +00:00
|
|
|
- &when
|
|
|
|
- path: &when_path
|
|
|
|
# related config files
|
|
|
|
- ".woodpecker/web.yml"
|
|
|
|
# web source code
|
|
|
|
- "web/**"
|
2023-07-11 20:52:18 +00:00
|
|
|
# api source code
|
|
|
|
- "server/api/**"
|
2023-07-10 12:46:55 +00:00
|
|
|
branch:
|
|
|
|
exclude: ${CI_REPO_DEFAULT_BRANCH}
|
|
|
|
event: push
|
|
|
|
- path: *when_path
|
|
|
|
event: [pull_request, tag, deployment]
|
2022-07-17 16:25:56 +00:00
|
|
|
|
2023-06-30 11:32:17 +00:00
|
|
|
steps:
|
2021-11-30 16:46:19 +00:00
|
|
|
deps:
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *node_image
|
2022-10-25 12:51:29 +00:00
|
|
|
directory: web/
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
2022-10-08 14:15:07 +00:00
|
|
|
- corepack enable
|
|
|
|
- pnpm install --frozen-lockfile
|
2023-07-10 12:46:55 +00:00
|
|
|
when: *when
|
2021-11-30 16:46:19 +00:00
|
|
|
|
|
|
|
lint:
|
|
|
|
group: test
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *node_image
|
2022-10-25 12:51:29 +00:00
|
|
|
directory: web/
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
2022-10-08 14:15:07 +00:00
|
|
|
- corepack enable
|
|
|
|
- pnpm lint
|
2023-07-10 12:46:55 +00:00
|
|
|
when: *when
|
2021-11-30 16:46:19 +00:00
|
|
|
|
|
|
|
formatcheck:
|
|
|
|
group: test
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *node_image
|
2022-10-25 12:51:29 +00:00
|
|
|
directory: web/
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
2022-10-08 14:15:07 +00:00
|
|
|
- corepack enable
|
|
|
|
- pnpm formatcheck
|
2023-07-10 12:46:55 +00:00
|
|
|
when: *when
|
2021-11-30 16:46:19 +00:00
|
|
|
|
|
|
|
typecheck:
|
|
|
|
group: test
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *node_image
|
2022-10-25 12:51:29 +00:00
|
|
|
directory: web/
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
2022-10-08 14:15:07 +00:00
|
|
|
- corepack enable
|
|
|
|
- pnpm typecheck
|
2023-07-10 12:46:55 +00:00
|
|
|
when: *when
|
2021-11-30 16:46:19 +00:00
|
|
|
|
2022-09-03 18:46:48 +00:00
|
|
|
securitycheck:
|
|
|
|
group: test
|
|
|
|
image: aquasec/trivy:latest
|
|
|
|
commands:
|
|
|
|
- trivy fs --exit-code 0 --skip-dirs node_modules/ --severity UNKNOWN,LOW web/
|
2023-07-03 05:52:25 +00:00
|
|
|
- trivy fs --exit-code 1 --skip-dirs node_modules/ --severity MEDIUM,HIGH,CRITICAL web/
|
2023-07-10 12:46:55 +00:00
|
|
|
when: *when
|
2022-09-03 18:46:48 +00:00
|
|
|
|
2021-11-30 16:46:19 +00:00
|
|
|
test:
|
|
|
|
group: test
|
2022-07-17 16:25:56 +00:00
|
|
|
image: *node_image
|
2022-10-25 12:51:29 +00:00
|
|
|
directory: web/
|
2021-11-30 16:46:19 +00:00
|
|
|
commands:
|
2022-10-08 14:15:07 +00:00
|
|
|
- corepack enable
|
|
|
|
- pnpm test
|
2023-07-10 12:46:55 +00:00
|
|
|
when: *when
|