-
Notifications
You must be signed in to change notification settings - Fork 99
144 lines (131 loc) · 5.07 KB
/
ci.yml
File metadata and controls
144 lines (131 loc) · 5.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
---
name: Run CI Tests
on:
push:
pull_request:
workflow_dispatch:
schedule:
# Run weekly on Sundays at 2 AM UTC
- cron: '0 2 * * 0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
env:
TEST_DB_HOST: mariadb.example.com
TEST_DB_PORT: 3306
TEST_DB_USER: root
TEST_DB_PASSWORD: "heyPassw-!*20oRd"
TEST_DB_DATABASE: testn
jobs:
setup:
runs-on: ubuntu-latest
if: |
github.event_name != 'schedule' ||
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/develop') ||
startsWith(github.ref, 'refs/heads/maintenance/3.2') ||
startsWith(github.ref, 'refs/heads/maintenance/3.3') ||
startsWith(github.ref, 'refs/heads/maintenance/3.4')
outputs:
matrix: ${{ steps.set-matrix.outputs.final-matrix }}
steps:
- uses: actions/checkout@v4
- id: set-matrix
name: build matrix
uses: mariadb-corporation/connector-ci-build-matrix@main
with:
additional-matrix: '[{"name": "MariaDB 11.4", "os": "ubuntu-latest", "db-type": "community", "db-tag": "11.4", "node": 24}, {"name": "MariaDB 11.4", "os": "ubuntu-latest", "db-type": "community", "db-tag": "11.4", "node": 20}, {"name": "MariaDB 11.4 - DENO", "os": "ubuntu-latest", "db-type": "community", "db-tag": "11.4", "deno": "v2.x"}]'
ci:
name: ${{ matrix.name }}${{ !matrix.deno && matrix.node != 22 && format(' - node {0}', matrix.node) || '' }}
needs: setup
timeout-minutes: 50
strategy:
matrix: ${{ fromJSON(needs.setup.outputs.matrix) }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.continue-on-error || false }}
steps:
- uses: actions/checkout@v4
- name: Setup Test Environment
id: setup-env
uses: mariadb-corporation/connector-ci-setup@master
with:
node-version: ${{ matrix.node }}
db-type: ${{ matrix.db-type }}
db-tag: ${{ matrix.db-tag }}
test-db-password: ${{ env.TEST_DB_PASSWORD }}
test-db-database: ${{ env.TEST_DB_DATABASE }}
test-db-port: ${{ env.TEST_DB_PORT }}
additional-conf: ${{ matrix.additional-conf || '' }}
registry-user: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_USER || (secrets.DOCKER_TOKEN != '' && secrets.DOCKER_LOGIN || '') }}
registry-password: ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_TOKEN || secrets.DOCKER_TOKEN }}
os: ${{ matrix.os }}
- uses: actions/setup-node@v4
if: ${{ !matrix.deno }}
with:
node-version: ${{ matrix.node }}
- name: Setup Deno
uses: denoland/setup-deno@v2
if: ${{ matrix.deno }}
with:
deno-version: ${{ matrix.deno }}
- name: Install dependencies
run: npm install
- name: Run Tests node
if: ${{ !matrix.deno }}
run: npm run coverage:test
env:
LOCAL_DB: ${{ steps.setup-env.outputs.database-type }}
DB_TYPE: ${{ matrix.db-type }}
TEST_DB_SERVER_CERT: ${{ matrix.db-type == 'container' && './.github/workflows/certs/ca_server.crt' || '' }}
DB_VERSION: ${{ matrix.db-tag }}
TEST_TRACE: 'true'
LOCAL_SOCKET_AVAILABLE: ${{ steps.setup-env.outputs.database-type }}
- name: Run Tests deno
if: ${{ matrix.deno }}
continue-on-error: true
run: |
deno task test
env:
LOCAL_DB: ${{ steps.setup-env.outputs.database-type }}
DB_TYPE: ${{ matrix.db-type }}
TEST_DB_SERVER_CERT: ${{ matrix.db-type == 'container' && './.github/workflows/certs/ca_server.crt' || '' }}
DB_VERSION: ${{ matrix.db-tag }}
TEST_TRACE: 'true'
LOCAL_SOCKET_AVAILABLE: ${{ steps.setup-env.outputs.database-type }}
- name: Download Codecov uploader
if: ${{ !matrix.deno }}
shell: bash
run: |
case "$RUNNER_OS" in
Windows)
powershell -Command Invoke-WebRequest -Uri https://uploader.codecov.io/latest/windows/codecov.exe -Outfile codecov.exe
choco install -y --force nodejs-lts
# force refresh path
export PATH=$(cmd.exe //c "refreshenv > nul & C:\Progra~1\Git\bin\bash -c 'echo \$PATH' ")
;;
Linux)
curl -Os https://uploader.codecov.io/latest/linux/codecov
chmod +x codecov
ls -lrt
;;
macOS)
curl -Os https://uploader.codecov.io/latest/macos/codecov
chmod +x codecov
ls -lrt
;;
esac
- name: Generate Coverage Report
shell: bash
if: ${{ !matrix.deno }}
run: |
npm run coverage:create
case "$RUNNER_OS" in
Windows)
./codecov.exe --disable=gcov --token=${{ secrets.CODECOV_TOKEN }}
;;
Linux|macOS)
./codecov --disable=gcov --token=${{ secrets.CODECOV_TOKEN }}
;;
esac
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}