This repository was archived by the owner on Jan 19, 2025. It is now read-only.
feat(ci): add Node.js CI workflow for backend and frontend builds; re… #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | |
| # For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | |
| name: Node.js Build CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| build-backend: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| matrix: | |
| node-version: [20.x] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Cache pnpm modules | |
| uses: actions/cache@v3 | |
| env: | |
| cache-name: cache-pnpm-modules | |
| with: | |
| path: ~/.pnpm-store | |
| key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| restore-keys: | | |
| ${{ runner.os }}-build-${{ env.cache-name }}-${{ matrix.node-version }}-${{ hashFiles('**/pnpm-lock.yaml') }} | |
| - uses: pnpm/action-setup@v3 | |
| with: | |
| version: latest | |
| run_install: false | |
| - name: Install Dependencies | |
| run: | | |
| cd 'Way Tech+复赛+OpenHealth-开源项目健康度分析平台/open-health-backend' | |
| pnpm i | |
| - name: Build project | |
| run: | | |
| npm run bundle | |
| - name: Start MongoDB | |
| uses: supercharge/[email protected] | |
| with: | |
| mongodb-version: 4.4 | |
| - name: Start Redis | |
| uses: supercharge/[email protected] | |
| with: | |
| redis-version: 6 | |
| - name: Test Bundle Server | |
| run: | | |
| bash scripts/workflow/test-server.sh | |
| build-frontend: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Use Node.js ${{ matrix.node-version }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ matrix.node-version }} | |
| - name: Install Dependencies | |
| run: | | |
| cd 'Way Tech+复赛+OpenHealth-开源项目健康度分析平台/open-health-frontend' | |
| pnpm i | |
| - name: Build project | |
| run: | | |
| npm run build |