|
8 | 8 | branches: |
9 | 9 | - master |
10 | 10 |
|
| 11 | +env: |
| 12 | + MYSQL_DB_DATABASE: keyv_test |
| 13 | + MYSQL_DB_USER: root |
| 14 | + MYSQL_DB_PASSWORD: root |
| 15 | + |
11 | 16 | jobs: |
12 | 17 | matrix: |
13 | 18 | runs-on: ubuntu-latest |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + - uses: actions/setup-node@v4 |
| 22 | + - id: matrix |
| 23 | + run: echo "matrix=$(node .github/workflows/get-matrix.mjs)" >> $GITHUB_OUTPUT |
| 24 | + - run: echo ${{ steps.matrix.outputs.matrix }} |
| 25 | + outputs: |
| 26 | + matrix: ${{ steps.matrix.outputs.matrix }} |
14 | 27 |
|
| 28 | + test: |
| 29 | + if: github.ref != 'refs/heads/master' |
| 30 | + needs: matrix |
| 31 | + runs-on: ubuntu-latest |
15 | 32 | strategy: |
16 | | - matrix: |
17 | | - node-version: [20] |
18 | | - # See supported Node.js release schedule at https://nodejs.org/en/about/releases/ |
19 | | - env: |
20 | | - MYSQL_DB_DATABASE: keyv_test |
21 | | - MYSQL_DB_USER: root |
22 | | - MYSQL_DB_PASSWORD: root |
| 33 | + fail-fast: false |
| 34 | + matrix: ${{fromJson(needs.matrix.outputs.matrix)}} |
23 | 35 | steps: |
24 | 36 | - name: Checkout |
25 | 37 | uses: actions/checkout@v4 |
26 | | - - name: Use Node.js ${{ matrix.node-version }} |
| 38 | + - name: Setup Node.js |
27 | 39 | uses: actions/setup-node@v4 |
28 | 40 | with: |
29 | | - node-version: ${{ matrix.node-version }} |
| 41 | + node-version: lts/* |
| 42 | + - name: Setup PNPM |
| 43 | + uses: pnpm/action-setup@v4 |
| 44 | + with: |
| 45 | + version: latest |
| 46 | + run_install: true |
30 | 47 | - name: Start Redis |
| 48 | + if: contains(matrix.package, 'redis') |
31 | 49 | uses: supercharge/redis-github-action@1.8.0 |
32 | | - # - name: Start PostgreSQL |
33 | | - # uses: harmon758/postgresql-action@v1 |
34 | | - # with: |
35 | | - # postgresql version: '11' |
36 | | - # postgresql password: postgres |
37 | | - # postgresql user: postgres |
38 | | - # postgresql db: keyv_test |
39 | 50 | - name: Start MongoDB |
| 51 | + if: contains(matrix.package, 'mongo') |
40 | 52 | uses: supercharge/mongodb-github-action@1.12.0 |
41 | 53 | - name: Start MySQL |
| 54 | + if: contains(matrix.package, 'mysql') |
42 | 55 | run: | |
43 | 56 | sudo systemctl start mysql.service |
44 | 57 | mysql -e 'CREATE DATABASE ${{ env.MYSQL_DB_DATABASE }}' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PASSWORD }} |
45 | 58 | mysql -e 'SET GLOBAL max_connections = 300;' -u${{ env.MYSQL_DB_USER }} -p${{ env.MYSQL_DB_PASSWORD }} |
46 | | - - name: Start PostgreSQL on Ubuntu |
| 59 | + - name: Start PostgreSQL |
| 60 | + if: contains(matrix.package, 'postgres') |
47 | 61 | run: | |
48 | 62 | sudo systemctl start postgresql.service |
49 | 63 | pg_isready |
50 | 64 | - name: Setup PostgreSQL for ava tests |
| 65 | + if: contains(matrix.package, 'postgres') |
51 | 66 | run: | |
52 | 67 | sudo -u postgres psql --command="alter system set max_connections = 300;" |
53 | 68 | sudo -u postgres psql --command="CREATE DATABASE keyv_test;" |
54 | 69 | sudo -u postgres psql --command="ALTER ROLE postgres WITH PASSWORD 'postgres';" --command="\du" |
55 | 70 | sudo systemctl restart postgresql.service |
56 | 71 | pg_isready |
57 | | - - id: matrix |
58 | | - run: echo "matrix=$(node .github/workflows/get-matrix.mjs)" >> $GITHUB_OUTPUT |
59 | | - - run: echo ${{ steps.matrix.outputs.matrix }} |
60 | | - outputs: |
61 | | - matrix: ${{ steps.matrix.outputs.matrix }} |
| 72 | + - name: Rebuild @vscode/sqlite3 |
| 73 | + if: contains(matrix.package, 'multi') || contains(matrix.package, 'sql') |
| 74 | + run: | |
| 75 | + cd $(pnpm --filter "${{ matrix.package }}" exec pwd) |
| 76 | + ls -l |
| 77 | + pnpm install @vscode/sqlite3 |
| 78 | + - name: Test |
| 79 | + run: pnpm --filter "${{ matrix.package }}" exec c8 pnpm test |
| 80 | + - name: Coverage |
| 81 | + run: pnpm --filter "${{ matrix.package }}" exec c8 report --reporter=lcov --report-dir=coverage |
| 82 | + - name: Upload |
| 83 | + uses: coverallsapp/github-action@main |
| 84 | + with: |
| 85 | + flag-name: ${{ matrix.package }} |
| 86 | + parallel: true |
| 87 | + file: $(pnpm --filter "${{ matrix.package }}" exec pwd)/coverage/lcov.info |
62 | 88 |
|
63 | | - test: |
64 | | - if: github.ref != 'refs/heads/master' |
65 | | - needs: matrix |
| 89 | + finish: |
| 90 | + needs: test |
66 | 91 | runs-on: ubuntu-latest |
67 | | - strategy: |
68 | | - fail-fast: false |
69 | | - matrix: ${{fromJson(needs.matrix.outputs.matrix)}} |
70 | 92 | steps: |
71 | | - - name: Checkout |
72 | | - uses: actions/checkout@v4 |
| 93 | + - name: Coveralls Finished |
| 94 | + uses: coverallsapp/github-action@main |
73 | 95 | with: |
74 | | - token: ${{ secrets.GITHUB_TOKEN }} |
75 | | - - name: Setup PNPM |
76 | | - uses: pnpm/action-setup@v4 |
77 | | - with: |
78 | | - version: latest |
79 | | - run_install: true |
80 | | - - name: Test |
81 | | - run: pnpm --filter "${{ matrix.package }}" test |
| 96 | + parallel-finished: true |
| 97 | + |
| 98 | + |
| 99 | + |
0 commit comments