Skip to content

Update main.yaml

Update main.yaml #4608

Workflow file for this run

name: CI
on:
push:
branches: [main, develop, feature/enhancing-test-and-build-speed]
pull_request:
branches: [main, develop, 'feature/**']
jobs:
tests:
strategy:
matrix:
shardIndex: [1, 2, 3, 4]
shardTotal: [4]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 20.15.1
cache: 'npm'
- name: Install dependency
run: npm install
- name : Test
run: npx cross-env CI=true vitest --minWorkers 3 --maxWorkers 4 run --reporter=blob --shard=${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --coverage
- run: ls -la
- run: mkdir coverage
- run: ls -la
- name: Move coverage report
run: mv ./test-report.xml coverage/${{matrix.shardIndex}}.xml
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: coverage-artifacts
path: coverage/
# - name: Upload blob report to GitHub Actions Artifacts
# if: ${{ !cancelled() }}
# uses: actions/upload-artifact@v4
# with:
# name: blob-report-${{ matrix.shardIndex }}
# path: .vitest-reports/*
# include-hidden-files: true
# retention-days: 1
merge-reports:
if: ${{ !cancelled() }}
needs: [tests]
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v3
with:
name: coverage-artifacts
path: coverage
- name: Merge Code Coverage
run: npx nyc merge coverage/ ./test-report.xml
Test_Docker:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Build Dockerfile.stage
uses: docker/build-push-action@v6
with:
push: false
file: ./docker/Dockerfile.stage
cache-from: type=gha
cache-to: type=gha, mode=max
tags: ci-dockerfile:stage
build-args: |
NGINX_VERSION=1.19.6
PROXY_API_URL=${secrets.API_URL}
password=${secrets.SERVER_PASS}