# github workflow 设置 yaml 文件
| name: Frontend pr workflow |
| on: |
| pull_request: |
| branches: ["develop"] |
| |
| jobs: |
| build: |
| runs-on: [self-hostsd] |
| steps: |
| - uses: actions/checkout@v3 |
| - name: Use Node.js 16.xx.x |
| uses: setupnoderepo |
| with: |
| node-version: 16.xx.x |
| registry-url: internal public repository url |
| |
| - name: cache npm dependencies |
| uses: actions/cache@v3 |
| id: npm_cache |
| with: |
| path: node_modules |
| key: $<!--swig0-->-node-$<!--swig1--> |
| |
| - name: install packages |
| run: npm install |
| if: steps.npm_cache.outputs.cache-hit != 'true' |
| |
| - run: npm run build |
| |
| - run: npm run test |
| |
| - name: install and start sonar analysis |
| uses: xxx/sonar-xx@stable |
| with: |
| scanner-version: 'xxx' |
| sonar-properties: 'sonar-project.properties' |
| sonar-token: $<!--swig2--> |
| |
| |
| - name:my custom private github actions |
| uses: ./.github/actions/frontend-ci |
| with: |
| docker-username: $<!--swig3--> |
| docker-password: $ |
| sonar-dsp-token: $ |
| build-image: false |