name: Node.js CI on: push: branches: [v4-next] paths-ignore: - '.github/workflows/**' - '!.github/workflows/nodejs.yml' - 'site/**' - 'tutorial/**' - '*.md' - '**/*.md' pull_request: paths-ignore: - '.github/workflows/**' - '!.github/workflows/nodejs.yml' - 'site/**' - 'tutorial/**' - '*.md' - '**/*.md' jobs: build: timeout-minutes: 60 runs-on: ubuntu-latest strategy: matrix: node-version: [20] steps: - name: Git checkout uses: actions/checkout@v4 - name: Install pnpm uses: pnpm/action-setup@v4 with: run_install: false - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'pnpm' - name: Install Docker Compose v2 run: | mkdir -p ~/.docker/cli-plugins/ curl -SL https://github.com/docker/compose/releases/download/v2.37.1/docker-compose-linux-x86_64 -o ~/.docker/cli-plugins/docker-compose chmod +x ~/.docker/cli-plugins/docker-compose docker compose version - name: Set up Docker Compose run: docker compose -f docker-compose.ci.yml up -d - name: Wait for containers to be ready run: | docker compose -f docker-compose.ci.yml ps sleep 20 # docker-compose 内部 DNS 很稳,简单 sleep 即可 - name: Install required tools run: | sudo apt-get update sudo apt-get install -y netcat-openbsd - name: Make wait-for-services.sh executable run: chmod +x scripts/wait-for-services.sh - name: Wait for all services run: scripts/wait-for-services.sh - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build run: pnpm run build --if-present - name: Test ESM dist artifacts run: pnpm test:dist - name: Run sample tests run: pnpm run test:samples - name: Run tests and coverage run: pnpm run cov env: RABBITMQ_URL: amqp://localhost:5672 ALI_SDK_OSS_REGION: ${{ secrets.ALI_SDK_OSS_REGION }} ALI_SDK_OSS_ENDPOINT: ${{ secrets.ALI_SDK_OSS_ENDPOINT }} ALI_SDK_OSS_ID: ${{ secrets.ALI_SDK_OSS_ID }} ALI_SDK_OSS_SECRET: ${{ secrets.ALI_SDK_OSS_SECRET }} ALI_SDK_OSS_BUCKET: ${{ secrets.ALI_SDK_OSS_BUCKET }} ALI_SDK_STS_ID: ${{ secrets.ALI_SDK_STS_ID }} ALI_SDK_STS_SECRET: ${{ secrets.ALI_SDK_STS_SECRET }} ALI_SDK_STS_BUCKET: ${{ secrets.ALI_SDK_STS_BUCKET }} ALI_SDK_STS_ROLE: ${{ secrets.ALI_SDK_STS_ROLE }} - name: Upload coverage to Codecov uses: codecov/codecov-action@v4 # # build-windows: # runs-on: windows-latest # # strategy: # matrix: # node-version: [12, 14.x] # # steps: # - uses: actions/checkout@v2 # - name: Use Node.js ${{ matrix.node-version }} # uses: actions/setup-node@v1 # with: # node-version: ${{ matrix.node-version }} # - run: npm install # - run: npm run build --if-present # - run: npm run cov