Merge pull request #337 from Rewrite0/ci

feat: 使用pnpm缓存加速构建
This commit is contained in:
Rewrite0
2023-06-15 12:41:59 +08:00
committed by GitHub

View File

@@ -8,21 +8,21 @@ jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f backend/requirements.txt ]; then pip install -r backend/requirements.txt; fi
pip install pytest
- name: Test
working-directory: ./backend/src
run: |
mkdir -p config
pytest
- uses: actions/checkout@v3
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: '3.11'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
if [ -f backend/requirements.txt ]; then pip install -r backend/requirements.txt; fi
pip install pytest
- name: Test
working-directory: ./backend/src
run: |
mkdir -p config
pytest
build-webui:
if: >
@@ -30,26 +30,30 @@ jobs:
(github.event_name == 'push' && github.ref_type == 'tag' && (contains(github.ref, 'alpha') || contains(github.ref, 'beta')))
runs-on: ubuntu-latest
needs: [test]
strategy:
matrix:
node-version: [18]
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
- uses: pnpm/action-setup@v2
with:
version: 8
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: latest
node-version: ${{ matrix.node-version }}
cache: 'pnpm'
cache-dependency-path: webui/pnpm-lock.yaml
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: latest
run_install: true
- name: Install dependencies
run: cd webui && pnpm install
- name: Build
run: |
cd webui
pnpm build && zip -r dist.zip dist
cd webui && pnpm build && zip -r dist.zip dist
- name: Upload artifact
uses: actions/upload-artifact@v3
@@ -57,7 +61,6 @@ jobs:
name: dist
path: webui/dist.zip
build-docker:
runs-on: ubuntu-latest
needs: [build-webui]
@@ -147,9 +150,8 @@ jobs:
(github.event_name == 'pull_request' && github.event.pull_request.merged == true) ||
(github.event_name == 'push' && contains(github.ref, 'tags'))
runs-on: ubuntu-latest
needs: [ build-docker ]
needs: [build-docker]
steps:
- name: Checkout code
uses: actions/checkout@v2
@@ -189,7 +191,7 @@ jobs:
telegram:
runs-on: ubuntu-latest
needs: [ release ]
needs: [release]
steps:
- name: send telegram message on push
uses: appleboy/telegram-action@master