build: update .npmignore files to properly include source files #493
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
| name: ci | |
| #on: [push, pull_request] | |
| on: | |
| # Triggers the workflow on push or pull request events but only for the master branch | |
| push: | |
| branches: [master] | |
| pull_request: | |
| branches: [master] | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| jobs: | |
| # Job to list all packages in the packages directory | |
| list-packages: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| packages: ${{ steps.set-packages.outputs.packages }} | |
| steps: | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: List packages | |
| id: set-packages | |
| run: | | |
| packages=($(ls -d packages/* | xargs -n 1 basename)) | |
| json="[" | |
| for package in "${packages[@]}"; do | |
| json+="\"$package\"," | |
| done | |
| json="${json%,}]" | |
| echo "::set-output name=packages::$json" | |
| shell: bash | |
| tests: | |
| strategy: | |
| matrix: | |
| os: | |
| - ubuntu-latest | |
| node: | |
| - 20 | |
| # Dynamically generate the package list by scanning the packages directory | |
| package: ${{ fromJSON(needs.list-packages.outputs.packages) }} | |
| runs-on: ${{ matrix.os }} | |
| needs: | |
| list-packages | |
| steps: | |
| - name: Install Redis server | |
| run: sudo apt-get update && sudo apt-get install redis-server | |
| continue-on-error: false | |
| - name: Use Node.js ${{ matrix.node }} | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: ${{ matrix.node }} | |
| - name: Check out repository code | |
| uses: actions/checkout@v3 | |
| - name: Install PNPM package manager | |
| run: npm install pnpm@10 -g | |
| continue-on-error: false | |
| - name: Install dependencies | |
| run: pnpm build:ca | |
| continue-on-error: false | |
| - name: Run tests and collect code coverage | |
| run: pnpm -F ${{ matrix.package }} test | |
| if: success() | |
| - name: Upload code coverage | |
| uses: codecov/codecov-action@v4 | |
| with: | |
| name: codecov-${{ matrix.package }} | |
| flags: ${{ matrix.package }} | |
| directory: packages/${{ matrix.package }}/coverage | |
| token: ${{ secrets.CODECOV_TOKEN }} | |
| if: success() |