name: pull_request on: push: branches: - master pull_request: branches: - master env: pnpm_config_dangerously_allow_all_builds: true SKIP_INSTALL_SIMPLE_GIT_HOOKS: true MYSQL_DB_DATABASE: keyv_test MYSQL_DB_USER: root MYSQL_DB_PASSWORD: root jobs: matrix: if: github.ref != 'refs/heads/master' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-node@v7 - id: matrix run: echo "matrix=$(node .github/workflows/get-matrix.mjs)" >> $GITHUB_OUTPUT - run: echo ${{ steps.matrix.outputs.matrix }} outputs: matrix: ${{ steps.matrix.outputs.matrix }} test: name: Test ${{ matrix.package.name }} (node ${{ matrix.node-version }}) needs: matrix runs-on: ubuntu-latest strategy: fail-fast: false matrix: node-version: [lts/*, latest] package: ${{ fromJson(needs.matrix.outputs.matrix).package }} steps: - name: Checkout uses: actions/checkout@v7 - name: Setup Node.js uses: actions/setup-node@v7 with: node-version: ${{ matrix.node-version }} - name: Setup PNPM uses: pnpm/action-setup@v6 with: version: latest - name: Install run: pnpm install - name: Start Redis if: contains(matrix.package.name, 'redis') uses: supercharge/redis-github-action@v2 - name: Start MongoDB if: contains(matrix.package.name, 'mongo') uses: supercharge/mongodb-github-action@1.12.1 - name: Start MySQL if: contains(matrix.package.name, 'mysql') run: | sudo systemctl start mysql.service mysql -e 'CREATE DATABASE ${{ env.MYSQL_DB_DATABASE }}' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PASSWORD }} mysql -e 'SET GLOBAL max_connections = 300;' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PASSWORD }} - name: Start PostgreSQL if: contains(matrix.package.name, 'postgres') run: | sudo systemctl start postgresql.service pg_isready - name: Setup PostgreSQL for ava tests if: contains(matrix.package.name, 'postgres') run: | sudo -u postgres psql --command="alter system set max_connections = 300;" sudo -u postgres psql --command="CREATE DATABASE keyv_test;" sudo -u postgres psql --command="ALTER ROLE postgres WITH PASSWORD 'postgres';" --command="\du" sudo systemctl restart postgresql.service pg_isready - name: Test run: pnpm --filter "${{ matrix.package.filter }}" exec c8 pnpm test - name: Coverage run: pnpm --filter "${{ matrix.package.filter }}" exec c8 report --reporter=lcov --report-dir=coverage - name: Upload uses: coverallsapp/github-action@main with: flag-name: ${{ matrix.package.name }} parallel: true file: $(pnpm --filter "${{ matrix.package.filter }}" exec pwd)/coverage/lcov.info finish: needs: test runs-on: ubuntu-latest steps: - name: Coveralls Finished uses: coverallsapp/github-action@main with: parallel-finished: true