Skip to content

Commit

Permalink
feat: support preview
Browse files Browse the repository at this point in the history
  • Loading branch information
uyarn committed Apr 7, 2024
1 parent 48b30b7 commit 574f6bd
Showing 1 changed file with 46 additions and 5 deletions.
51 changes: 46 additions & 5 deletions .github/workflows/test-build-site.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,58 @@
name: TEST_AND_BUILD
name: TEST_AND_BUILD_SITE

on:
workflow_call:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: check_github_primary_email
run: |
log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo "默认邮箱 $log_emails 校验非法,可以去 https://github.com/settings/emails 更改" && exit 2;else echo "邮箱 $log_emails 校验通过";fi
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: check_local_email
run: |
log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo "本地提交邮箱 $log_emails 校验非法,需要本地更改重新提交" && exit 2;else echo "邮箱 $log_emails 校验通过";fi
test:
# needs: check
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-node@v2
with:
node-version: 18
- uses: actions/cache@v2
env:
cache-name: cache-nodemodules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm install
- run: npm run lint
- run: npm run test
# upload report to codecov
- uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}

site:
runs-on: ubuntu-latest
# needs: test
steps:
- uses: pnpm/action-setup@v3
with:
version: 8
- uses: actions/checkout@v2
with:
submodules: recursive
- uses: actions/setup-node@v2
with:
node-version: 18
Expand All @@ -25,7 +66,7 @@ jobs:
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: pnpm install
- run: npm install
- name: Build site
run: npm run site:preview

Expand Down

0 comments on commit 574f6bd

Please sign in to comment.