mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-09 02:42:47 +00:00
run npm lint when open PR (#6375)
* 01 fix code warnings * 02 change test.yml
This commit is contained in:
18
.github/workflows/test.yml
vendored
18
.github/workflows/test.yml
vendored
@@ -3,10 +3,18 @@ name: Seahub Test CI
|
||||
on:
|
||||
pull_request:
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [20.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- uses: actions/setup-python@v1
|
||||
@@ -40,3 +48,13 @@ jobs:
|
||||
cd $GITHUB_WORKSPACE
|
||||
export CCNET_CONF_DIR=/tmp/ccnet SEAFILE_CONF_DIR=/tmp/seafile-data TRAVIS=1
|
||||
if ./tests/test_seahub_changes.sh; then ./tests/seahubtests.sh init && ./tests/seahubtests.sh runserver && ./tests/seahubtests.sh test; else true; fi
|
||||
|
||||
- uses: actions/setup-node@v2
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: run npm lint
|
||||
run: |
|
||||
cd $GITHUB_WORKSPACE/tests/
|
||||
chmod +x github_actions_npm_lint.sh
|
||||
./github_actions_npm_lint.sh
|
||||
|
@@ -87,5 +87,3 @@ export const generateNavItems = (slateNodes) => {
|
||||
return treeRoot;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
26
tests/github_actions_npm_lint.sh
Normal file
26
tests/github_actions_npm_lint.sh
Normal file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -e
|
||||
set -x
|
||||
|
||||
if test $GITHUB_EVENT_NAME = "pull_request"; then
|
||||
branch=$GITHUB_HEAD_REF
|
||||
else
|
||||
branch=${GITHUB_REF##*/}
|
||||
fi
|
||||
|
||||
export GITHUB_BRANCH=$branch
|
||||
|
||||
echo "GITHUB_BRANCH: $GITHUB_BRANCH"
|
||||
|
||||
export PYTHONPATH="${PYTHONPATH}:/tmp/site-packages"
|
||||
|
||||
echo "PYTHONPATH: $PYTHONPATH"
|
||||
|
||||
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >~/.npmrc
|
||||
|
||||
cd $GITHUB_WORKSPACE
|
||||
|
||||
echo "npm run lint on frontend/src files..."
|
||||
|
||||
cd ./frontend && npm install && npm run lint
|
Reference in New Issue
Block a user