@@ -46,87 +46,29 @@ jobs:
46
46
steps :
47
47
- uses : actions/checkout@v4
48
48
49
- - name : Add hosts entry
50
- shell : bash
51
- run : |
52
- if [ "$RUNNER_OS" == "Windows" ]; then
53
- echo "127.0.0.1 mariadb.example.com" >> /c/Windows/System32/drivers/etc/hosts
54
- else
55
- echo "127.0.0.1 mariadb.example.com" | sudo tee -a /etc/hosts
56
- fi
57
-
58
- - name : Generate self-signed certificates
59
- shell : bash
60
- run : |
61
- chmod +x .github/workflows/generate-certs.sh
62
- ./.github/workflows/generate-certs.sh
63
-
64
- - uses : actions/setup-node@v4
49
+ - name : Setup Test Environment
50
+ id : setup-env
51
+ uses : rusher/mariadb-test-setup@master
65
52
with :
66
53
node-version : ${{ matrix.node }}
67
-
68
- - name : Setup MariaDB
69
- id : mariadb-install
70
- if : matrix.db-type != 'mysql'
71
- uses : rusher/action-setup-mariadb@master
72
- with :
73
- tag : ${{ matrix.db-tag }}
74
- root-password : ${{ env.TEST_DB_PASSWORD }}
75
- database : ${{ env.TEST_DB_DATABASE }}
76
- registry : ${{ matrix.db-type == 'enterprise' && 'docker.mariadb.com/enterprise-server' || (matrix.db-type == 'dev' && 'quay.io/mariadb-foundation/mariadb-devel' || '') }}
54
+ db-type : ${{ matrix.db-type }}
55
+ db-tag : ${{ matrix.db-tag }}
56
+ test-db-password : ${{ env.TEST_DB_PASSWORD }}
57
+ test-db-database : ${{ env.TEST_DB_DATABASE }}
58
+ test-db-port : ${{ env.TEST_DB_PORT }}
59
+ additional-conf : ${{ matrix.additional-conf || '' }}
77
60
registry-user : ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_USER || '' }}
78
61
registry-password : ${{ matrix.db-type == 'enterprise' && secrets.ENTERPRISE_TOKEN || '' }}
79
- additional-conf : |
80
- ${{ matrix.additional-conf || '' }}
81
- ${{ matrix.os == 'ubuntu-latest' && '--ssl-ca=/etc/mysql/conf.d/ca.crt' || '' }}
82
- ${{ matrix.os == 'ubuntu-latest' && '--ssl-cert=/etc/mysql/conf.d/server.crt' || '' }}
83
- ${{ matrix.os == 'ubuntu-latest' && '--ssl-key=/etc/mysql/conf.d/server.key' || '' }}
84
- conf-script-folder : ${{ github.workspace }}/.github/workflows/certs
85
- port : ${{ env.TEST_DB_PORT }}
62
+ os : ${{ matrix.os }}
86
63
87
- - name : Setup MySQL
88
- if : matrix.db-type == 'mysql'
89
- uses :
mirromutth/[email protected]
64
+ - uses : actions/setup-node@v4
90
65
with :
91
- mysql version : ${{ matrix.db-tag }}
92
- mysql database : ${{ env.TEST_DB_DATABASE }}
93
- mysql root password : ${{ env.TEST_DB_PASSWORD }}
94
-
95
- - name : Install dependencies
96
- run : npm install
97
- env :
98
- LOCAL_DB : ${{ steps.mariadb-install.outputs.database-type }}
99
-
100
- - name : Debug - Check MariaDB connection
101
- shell : bash
102
- run : |
103
- echo "=== Network and Port Information ==="
104
- echo "Checking if MariaDB port is accessible..."
105
- netstat -tuln | grep :3306 || echo "Port 3306 not found in netstat"
106
- echo ""
107
- echo "Testing connection to mariadb.example.com:3306..."
108
- timeout 10 bash -c 'cat < /dev/null > /dev/tcp/mariadb.example.com/3306' && echo "✅ Connection successful" || echo "❌ Connection failed"
109
- echo ""
110
- echo "Testing connection to 127.0.0.1:3306..."
111
- timeout 10 bash -c 'cat < /dev/null > /dev/tcp/127.0.0.1/3306' && echo "✅ Connection successful" || echo "❌ Connection failed"
112
- echo ""
113
- echo "=== Environment Variables ==="
114
- echo "TEST_DB_HOST: $TEST_DB_HOST"
115
- echo "TEST_DB_PORT: $TEST_DB_PORT"
116
- echo "TEST_DB_USER: $TEST_DB_USER"
117
- echo "LOCAL_DB: $LOCAL_DB"
118
- echo "DB_TYPE: $DB_TYPE"
119
- env :
120
- TEST_DB_HOST : ${{ env.TEST_DB_HOST }}
121
- TEST_DB_PORT : ${{ env.TEST_DB_PORT }}
122
- TEST_DB_USER : ${{ env.TEST_DB_USER }}
123
- LOCAL_DB : ${{ steps.mariadb-install.outputs.database-type }}
124
- DB_TYPE : ${{ matrix.db-type }}
66
+ node-version : ${{ matrix.node }}
125
67
126
68
- name : Run Tests
127
69
run : npm run coverage:test
128
70
env :
129
- LOCAL_DB : ${{ steps.mariadb-install .outputs.database-type }}
71
+ LOCAL_DB : ${{ steps.setup-env .outputs.database-type }}
130
72
DB_TYPE : ${{ matrix.db-type }}
131
73
TEST_DB_SERVER_CERT : ${{ matrix.db-type == 'container' && './.github/workflows/certs/server.crt' || '' }}
132
74
@@ -153,4 +95,16 @@ jobs:
153
95
esac
154
96
155
97
- name : Generate Coverage Report
156
- run : npm run coverage:report
98
+ shell : bash
99
+ run : |
100
+ npm run coverage:create
101
+ case "$RUNNER_OS" in
102
+ Windows)
103
+ ./codecov.exe --disable=gcov --token=${{ secrets.CODECOV_TOKEN }}
104
+ ;;
105
+ Linux|macOS)
106
+ ./codecov --disable=gcov --token=${{ secrets.CODECOV_TOKEN }}
107
+ ;;
108
+ esac
109
+ env :
110
+ CODECOV_TOKEN : ${{ secrets.CODECOV_TOKEN }}
0 commit comments